Skip to content

Commit 86e5d08

Browse files
authored
Merge pull request #7289 from TheHPXProject/cpp_modules
Adapt remaining HPX Modules to C++20 modules
2 parents 1c84f4e + 81ae969 commit 86e5d08

355 files changed

Lines changed: 7753 additions & 7132 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
shell: bash
101101
working-directory: build
102102
run: |
103-
ctest -N | python3 ../.github/ci-scripts/generate_test_matrix.py 20 > test_matrix.json
103+
ctest -N | python3 ../.github/ci-scripts/generate_test_matrix.py 23 > test_matrix.json
104104
printf 'matrix=%s\n' "$(cat test_matrix.json)" >> "$GITHUB_OUTPUT"
105105
106106
- name: Package Build Artifacts
@@ -134,4 +134,4 @@ jobs:
134134
build-artifact-name: hpx-build-${{ github.sha }}
135135
build-targets: ${{ matrix.targets }}
136136
ctest-regex: ${{ matrix.tests }}
137-
artifact-job-name: ${{ matrix.name }}
137+
artifact-job-name: ${{ matrix.name }}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Copyright (c) 2020 Mikael Simberg
2+
# Copyright (c) 2024-2026 The STE||AR Group
3+
#
4+
# SPDX-License-Identifier: BSL-1.0
5+
# Distributed under the Boost Software License, Version 1.0. (See accompanying
6+
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7+
8+
name: Windows CI (Debug, VS2026 toolset, C++20 Modules)
9+
10+
on: [pull_request]
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: windows-2025-vs2026
19+
20+
steps:
21+
- uses: actions/checkout@v6
22+
- uses: lukka/get-cmake@v4.3.2
23+
24+
- name: Install dependencies
25+
run: |
26+
md C:\projects
27+
$client = new-object System.Net.WebClient
28+
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2026.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
29+
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
30+
- name: Configure
31+
shell: bash
32+
run: |
33+
cmake . -Bbuild -G'Visual Studio 18 2026' \
34+
-DCMAKE_BUILD_TYPE=Debug \
35+
-DCMAKE_TOOLCHAIN_FILE='C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake' \
36+
-DHPX_WITH_FETCH_ASIO=ON \
37+
-DHPX_WITH_ASIO_TAG=asio-1-38-0 \
38+
-DHPX_WITH_EXAMPLES=OFF \
39+
-DHPX_WITH_TESTS=OFF \
40+
-DHPX_WITH_TESTS_EXAMPLES=OFF \
41+
-DHPX_WITH_DEPRECATION_WARNINGS=OFF \
42+
-DHPX_WITH_TESTS_MAX_THREADS_PER_LOCALITY=2 \
43+
-DHPX_COROUTINES_WITH_SWAP_CONTEXT_EMULATION=ON \
44+
-DHPX_WITH_VERIFY_LOCKS=ON \
45+
-DHPX_WITH_VERIFY_LOCKS_BACKTRACE=ON \
46+
-DHPX_WITH_CHECK_MODULE_DEPENDENCIES=ON \
47+
-DHPX_WITH_CXX_MODULES=ON \
48+
-DHPX_WITH_DATAPAR=ON \
49+
-DHPX_WITH_DATAPAR_BACKEND=EMULATE
50+
- name: Build
51+
shell: bash
52+
run: |
53+
cmake --build build --config Debug --target ALL_BUILD \
54+
-- -maxcpucount:2 -verbosity:minimal -nologo
55+
- name: Install
56+
shell: bash
57+
run: |
58+
cmake --install build --config Debug
59+
# - name: Test
60+
# run: |
61+
# $exclude_regex = & "$env:GITHUB_WORKSPACE/.github/ci-scripts/generate_ctest_exclude_regex.ps1" `
62+
# "$env:GITHUB_WORKSPACE/.github/workflows/tests.examples.targets"
63+
# cd build
64+
# ctest `
65+
# --output-on-failure `
66+
# --build-config Debug `
67+
# --tests-regex tests.examples `
68+
# --exclude-regex $exclude_regex

CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,19 @@ if(HPX_WITH_DOCUMENTATION)
293293
endif()
294294

295295
if(WIN32)
296-
set(HPX_WITH_PSEUDO_DEPENDENCIES
297-
OFF
298-
CACHE INTERNAL "" FORCE
299-
)
296+
set(HPX_WITH_PSEUDO_DEPENDENCIES_DEFAULT OFF)
300297
else()
301-
set(HPX_WITH_PSEUDO_DEPENDENCIES
302-
ON
303-
CACHE INTERNAL "" FORCE
304-
)
298+
set(HPX_WITH_PSEUDO_DEPENDENCIES_DEFAULT ON)
305299
endif()
306300

301+
hpx_option(
302+
HPX_WITH_PSEUDO_DEPENDENCIES
303+
BOOL
304+
"Turn compiler warnings into errors (default: ${HPX_WITH_PSEUDO_DEPENDENCIES_DEFAULT})"
305+
${HPX_WITH_PSEUDO_DEPENDENCIES_DEFAULT}
306+
ADVANCED
307+
)
308+
307309
hpx_option(
308310
HPX_WITH_UNITY_BUILD BOOL
309311
"Enable unity build for certain build targets (default OFF)" OFF ADVANCED

cmake/HPX_SetupAsio.cmake

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,20 @@ elseif(NOT TARGET Asio::asio AND NOT HPX_FIND_PACKAGE)
4646
set(Asio_ROOT ${asio_SOURCE_DIR})
4747

4848
add_library(asio INTERFACE)
49+
50+
# convert ASIO tag into CMake version
51+
string(REGEX REPLACE "asio-([0-9]+)-([0-9]+)-([0-9]+)" "\\1.\\2.\\3" VERSION
52+
"${HPX_WITH_ASIO_TAG}"
53+
)
54+
55+
# starting v1.37.0 ASIO has changed its directory structure
56+
set(asio_base_directory ${Asio_ROOT}/asio/include)
57+
if(VERSION VERSION_GREATER "1.36.0")
58+
set(asio_base_directory ${Asio_ROOT}/include)
59+
endif()
60+
4961
target_include_directories(
50-
asio SYSTEM INTERFACE $<BUILD_INTERFACE:${Asio_ROOT}/asio/include>
62+
asio SYSTEM INTERFACE $<BUILD_INTERFACE:${asio_base_directory}>
5163
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
5264
)
5365

@@ -58,7 +70,7 @@ elseif(NOT TARGET Asio::asio AND NOT HPX_FIND_PACKAGE)
5870
)
5971

6072
install(
61-
DIRECTORY ${Asio_ROOT}/asio/include/
73+
DIRECTORY ${asio_base_directory}/
6274
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
6375
COMPONENT core
6476
FILES_MATCHING

cmake/HPX_SetupSYCL.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 Gregor Daiß
1+
# Copyright (c) 2022 Gregor Daiss
22
#
33
# SPDX-License-Identifier: BSL-1.0
44
# Distributed under the Boost Software License, Version 1.0. (See accompanying

cmake/HPX_SetupTarget.cmake

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,23 +264,23 @@ function(hpx_setup_target target)
264264
target_compile_definitions(
265265
${target} PRIVATE HPX_HAVE_FORCE_NO_CXX_MODULES
266266
)
267-
268-
# If modules are enabled, Clang emits DWARF v5, which requires using lld
269-
# instead of ld.
270-
if((NOT MSVC)
271-
AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
272-
AND (NOT (CMAKE_CXX_COMPILER_ID MATCHES "AppleClang"))
273-
)
274-
get_target_property(_type ${target} TYPE)
275-
if((_type STREQUAL "SHARED_LIBRARY") OR (_type STREQUAL "EXECUTABLE"))
276-
target_link_options(${target} PRIVATE "-fuse-ld=lld")
277-
endif()
278-
endif()
279267
endif()
280268

281269
set_target_properties(${target} PROPERTIES CXX_SCAN_FOR_MODULES OFF)
282270
endif()
283271

272+
# Newer Clang emits DWARF v5, which requires using lld instead of ld.
273+
if(HPX_WITH_CXX_MODULES
274+
AND (NOT MSVC)
275+
AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
276+
AND (NOT (CMAKE_CXX_COMPILER_ID MATCHES "AppleClang"))
277+
)
278+
get_target_property(_type ${target} TYPE)
279+
if((_type STREQUAL "SHARED_LIBRARY") OR (_type STREQUAL "EXECUTABLE"))
280+
target_link_options(${target} PRIVATE "-fuse-ld=lld")
281+
endif()
282+
endif()
283+
284284
get_target_property(target_EXCLUDE_FROM_ALL ${target} EXCLUDE_FROM_ALL)
285285

286286
if(target_EXPORT AND NOT target_EXCLUDE_FROM_ALL)

cmake/templates/std_headers.hpp.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
# undef exception_info
5959
#endif
6060

61-
# include <asio.hpp>
6261
# include <hwloc.h>
6362

6463
#if defined(HPX_HAVE_MODULE_LIKWID)
@@ -128,7 +127,3 @@
128127
# include <Vc/global.h>
129128
# endif
130129
#endif
131-
132-
#if defined(HPX_HAVE_DISTRIBUTED_RUNTIME)
133-
# include <boost/accumulators/accumulators.hpp>
134-
#endif

components/component_storage/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,15 @@ add_hpx_pseudo_dependencies(
5050
components.component_storage component_storage_component
5151
)
5252

53+
# MSVC V1951 and V1952 exposes ICE compiling this in C++20 module mode
54+
if(HPX_WITH_CXX_MODULES
55+
AND (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
56+
AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 1952))
57+
)
58+
target_compile_definitions(
59+
component_storage_component PRIVATE HPX_HAVE_FORCE_NO_CXX_MODULES
60+
)
61+
endif()
62+
5363
add_subdirectory(tests)
5464
add_subdirectory(examples)

components/component_storage/include/hpx/components/component_storage/server/migrate_from_storage.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include <hpx/modules/errors.hpp>
1212
#include <hpx/modules/functional.hpp>
1313
#include <hpx/modules/naming_base.hpp>
14-
#include <hpx/runtime_distributed/runtime_support.hpp>
15-
#include <hpx/runtime_distributed/server/migrate_component.hpp>
14+
#include <hpx/modules/runtime_distributed.hpp>
1615

1716
#include <hpx/components/component_storage/export_definitions.hpp>
1817
#include <hpx/components/component_storage/server/component_storage.hpp>

components/component_storage/src/server/component_storage_server.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
66

77
#include <hpx/config.hpp>
8-
#include <hpx/components/component_storage/server/component_storage.hpp>
98
#include <hpx/modules/errors.hpp>
10-
#include <hpx/runtime_distributed/find_localities.hpp>
9+
#include <hpx/modules/runtime_distributed.hpp>
10+
11+
#include <hpx/components/component_storage/server/component_storage.hpp>
1112

1213
#include <vector>
1314

0 commit comments

Comments
 (0)