Skip to content

Commit

Permalink
move code to HPX_SetupStdexec
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorostsa committed Aug 26, 2024
1 parent 05b6e36 commit 0535f6c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
24 changes: 0 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -601,30 +601,6 @@ hpx_option(
ADVANCED
)

if(Stdexec_ROOT OR HPX_WITH_FETCH_STDEXEC)
# explicitly enable HPX_WITH_STDEXEC
set(HPX_WITH_STDEXEC ON)

# prefer Stdexec_ROOT over HPX_WITH_FETCH_STDEXEC by default
if(Stdexec_ROOT AND HPX_WITH_FETCH_STDEXEC)
set(HPX_WITH_FETCH_STDEXEC OFF)
hpx_warn(
"Both Stdexec_ROOT and HPX_WITH_FETCH_STDEXEC are provided. HPX_WITH_FETCH_STDEXEC is set to OFF."
)
endif()
elseif(HPX_WITH_STDEXEC)
hpx_error(
"HPX_WITH_STDEXEC is set to ON, but Stdexec_ROOT is not provided and HPX_WITH_FETCH_STDEXEC is not enabled. Please provide Stdexec_ROOT or set HPX_WITH_FETCH_STDEXEC to ON."
)
endif()

# STDEXEC requires C++20
if(HPX_WITH_STDEXEC AND HPX_WITH_CXX_STANDARD LESS 20)
hpx_error(
"HPX_WITH_STDEXEC is set to ON, but HPX_WITH_CXX_STANDARD is less than 20. Please set HPX_WITH_CXX_STANDARD to 20 or higher."
)
endif()

if(HPX_WITH_FETCH_STDEXEC)
hpx_option(
HPX_WITH_STDEXEC_TAG
Expand Down
24 changes: 24 additions & 0 deletions cmake/HPX_SetupStdexec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

if(Stdexec_ROOT OR HPX_WITH_FETCH_STDEXEC)
# explicitly enable HPX_WITH_STDEXEC
set(HPX_WITH_STDEXEC ON)

# prefer Stdexec_ROOT over HPX_WITH_FETCH_STDEXEC by default
if(Stdexec_ROOT AND HPX_WITH_FETCH_STDEXEC)
set(HPX_WITH_FETCH_STDEXEC OFF)
hpx_warn(
"Both Stdexec_ROOT and HPX_WITH_FETCH_STDEXEC are provided. HPX_WITH_FETCH_STDEXEC is set to OFF."
)
endif()
elseif(HPX_WITH_STDEXEC)
hpx_error(
"HPX_WITH_STDEXEC is set to ON, but Stdexec_ROOT is not provided and HPX_WITH_FETCH_STDEXEC is not enabled. Please provide Stdexec_ROOT or set HPX_WITH_FETCH_STDEXEC to ON."
)
endif()

# STDEXEC requires C++20
if(HPX_WITH_STDEXEC AND HPX_WITH_CXX_STANDARD LESS 20)
hpx_error(
"HPX_WITH_STDEXEC is set to ON, but HPX_WITH_CXX_STANDARD is less than 20. Please set HPX_WITH_CXX_STANDARD to 20 or higher."
)
endif()

if(HPX_WITH_STDEXEC AND NOT TARGET STDEXEC::stdexec)
hpx_add_config_define(HPX_HAVE_STDEXEC)

Expand Down
5 changes: 0 additions & 5 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ if(TARGET APEX::apex)
target_link_libraries(hpx_full INTERFACE APEX::apex)
endif()

# Do I need this here?
# if(TARGET STDEXEC::stdexec)
# target_link_libraries(hpx_full INTERFACE STDEXEC::stdexec)
# endif()

if(TARGET Gperftools::gperftools)
target_link_libraries(hpx_full PRIVATE Gperftools::gperftools)
endif()
Expand Down

0 comments on commit 0535f6c

Please sign in to comment.