Skip to content

Commit a24be1a

Browse files
fixed fetched stdexec target setup on Windows
Signed-off-by: guptapratykshh <pratykshgupta9999@gmail.com>
1 parent 5680063 commit a24be1a

5 files changed

Lines changed: 74 additions & 49 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,13 @@ if(WIN32)
20712071
# Make sure that __cplusplus is properly defined
20722072
hpx_add_target_compile_option(-Zc:__cplusplus PUBLIC)
20732073

2074+
# stdexec requires the conforming MSVC preprocessor.
2075+
if(NOT (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"
2076+
AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
2077+
)
2078+
hpx_add_target_compile_option(-Zc:preprocessor PUBLIC)
2079+
endif()
2080+
20742081
# Silence C++17 deprecation warnings
20752082
hpx_add_config_cond_define(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
20762083

cmake/HPX_SetupStdexec.cmake

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,58 +21,56 @@ if(HPX_WITH_FETCH_STDEXEC)
2121
"HPX_WITH_FETCH_STDEXEC=${HPX_WITH_FETCH_STDEXEC}, Stdexec will be fetched using CMake's FetchContent and installed alongside HPX (HPX_WITH_STDEXEC_TAG=${HPX_WITH_STDEXEC_TAG})"
2222
)
2323

24-
if(UNIX)
25-
include(FetchContent)
26-
fetchcontent_declare(
27-
Stdexec
28-
GIT_REPOSITORY https://github.com/NVIDIA/stdexec.git
29-
GIT_TAG ${HPX_WITH_STDEXEC_TAG}
30-
)
24+
include(FetchContent)
25+
fetchcontent_declare(
26+
Stdexec
27+
GIT_REPOSITORY https://github.com/NVIDIA/stdexec.git
28+
GIT_TAG ${HPX_WITH_STDEXEC_TAG}
29+
)
3130

32-
fetchcontent_getproperties(Stdexec)
33-
if(NOT Stdexec_POPULATED)
34-
fetchcontent_populate(Stdexec)
35-
endif()
36-
set(Stdexec_ROOT ${stdexec_SOURCE_DIR})
31+
fetchcontent_getproperties(Stdexec)
32+
if(NOT Stdexec_POPULATED)
33+
fetchcontent_populate(Stdexec)
34+
endif()
35+
set(Stdexec_ROOT ${stdexec_SOURCE_DIR})
3736

38-
add_library(Stdexec INTERFACE)
39-
target_include_directories(
40-
Stdexec SYSTEM INTERFACE $<BUILD_INTERFACE:${stdexec_SOURCE_DIR}/include>
41-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
42-
)
37+
add_library(Stdexec INTERFACE)
38+
target_include_directories(
39+
Stdexec SYSTEM INTERFACE $<BUILD_INTERFACE:${stdexec_SOURCE_DIR}/include>
40+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
41+
)
4342

44-
install(
45-
TARGETS Stdexec
46-
EXPORT HPXStdexecTarget
47-
COMPONENT core
48-
)
43+
install(
44+
TARGETS Stdexec
45+
EXPORT HPXStdexecTarget
46+
COMPONENT core
47+
)
4948

50-
install(
51-
DIRECTORY ${Stdexec_ROOT}/include/
52-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
53-
COMPONENT core
54-
FILES_MATCHING
55-
PATTERN "*.hpp"
56-
)
49+
install(
50+
DIRECTORY ${Stdexec_ROOT}/include/
51+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
52+
COMPONENT core
53+
FILES_MATCHING
54+
PATTERN "*.hpp"
55+
)
5756

58-
export(
59-
TARGETS Stdexec
60-
NAMESPACE Stdexec::
61-
FILE "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/HPXStdexecTarget.cmake"
62-
)
57+
export(
58+
TARGETS Stdexec
59+
NAMESPACE Stdexec::
60+
FILE "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/HPXStdexecTarget.cmake"
61+
)
6362

64-
install(
65-
EXPORT HPXStdexecTarget
66-
NAMESPACE Stdexec::
67-
FILE HPXStdexecTarget.cmake
68-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}
69-
COMPONENT cmake
70-
)
63+
install(
64+
EXPORT HPXStdexecTarget
65+
NAMESPACE Stdexec::
66+
FILE HPXStdexecTarget.cmake
67+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}
68+
COMPONENT cmake
69+
)
7170

72-
# TODO: Enforce a single spelling
73-
add_library(Stdexec::Stdexec ALIAS Stdexec)
74-
add_library(STDEXEC::stdexec ALIAS Stdexec)
75-
endif()
71+
# TODO: Enforce a single spelling
72+
add_library(Stdexec::Stdexec ALIAS Stdexec)
73+
add_library(STDEXEC::stdexec ALIAS Stdexec)
7674
else()
7775
find_package(Stdexec)
7876

libs/core/execution_base/include/hpx/execution_base/stdexec_forward.hpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,31 @@
3030
#pragma clang diagnostic ignored "-Weverything"
3131
#endif
3232

33-
// NOLINTBEGIN(bugprone-crtp-constructor-accessibility,bugprone-unhandled-exception-at-new)
33+
// GCC advertises constexpr exceptions in C++26, but current stdexec main
34+
// selects a code path that is not accepted by GCC yet. Hide the feature-test
35+
// macro while including stdexec so it falls back to the pre-C++26 path.
36+
#if defined(HPX_GCC_VERSION) && defined(__cpp_constexpr_exceptions) && \
37+
(__cpp_constexpr_exceptions >= 202411L)
38+
#define HPX_STDEXEC_RESTORE___cpp_constexpr_exceptions \
39+
__cpp_constexpr_exceptions
40+
#undef __cpp_constexpr_exceptions
41+
#endif
42+
43+
// NOLINTBEGIN(bugprone-crtp-constructor-accessibility)
44+
// NOLINTBEGIN(bugprone-unhandled-exception-at-new)
3445
#include <exec/ensure_started.hpp>
3546
#include <exec/execute.hpp>
3647
#include <exec/split.hpp>
3748
#include <exec/start_detached.hpp>
3849
#include <stdexec/execution.hpp>
39-
// NOLINTEND(bugprone-crtp-constructor-accessibility,bugprone-unhandled-exception-at-new)
50+
// NOLINTEND(bugprone-unhandled-exception-at-new)
51+
// NOLINTEND(bugprone-crtp-constructor-accessibility)
52+
53+
#if defined(HPX_STDEXEC_RESTORE___cpp_constexpr_exceptions)
54+
#define __cpp_constexpr_exceptions \
55+
HPX_STDEXEC_RESTORE___cpp_constexpr_exceptions
56+
#undef HPX_STDEXEC_RESTORE___cpp_constexpr_exceptions
57+
#endif
4058

4159
#if defined(HPX_GCC_VERSION)
4260
#pragma GCC diagnostic pop

libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ namespace hpx::execution::experimental {
188188
explicit_scheduler_executor const& exec, F&& f, S const& shape,
189189
Ts&&... ts)
190190
{
191-
// We are using HPX's bulk implementation for now, so this works for
191+
// We are using HPX's bulk implementation for now,
192+
// so this works for
192193
// other types too.
193194
// static_assert(
194195
// std::is_integral_v<S>,

libs/core/executors/include/hpx/executors/thread_pool_scheduler.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ namespace hpx::execution::experimental {
445445
return policy_;
446446
}
447447

448-
/// Returns the execution domain of this scheduler (following system_context.hpp pattern).
448+
/// Returns the execution domain of this scheduler
449+
/// (following system_context.hpp pattern).
449450
[[nodiscard]]
450451
auto query(stdexec::get_domain_t) const noexcept
451452
-> thread_pool_domain<Policy>

0 commit comments

Comments
 (0)