Skip to content

Commit

Permalink
Minor HPX_WITH_FETCH_BOOST fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pansysk75 committed Jan 21, 2025
1 parent c6a37f9 commit 726b213
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cmake/HPX_GeneratePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if(HPX_WITH_PKGCONFIG)
endif()

# Build dir
set(HPX_CONFIG_IS_INSTALL FALSE)
set(HPX_CONFIG_IS_INSTALL OFF)
configure_file(
cmake/templates/${HPX_PACKAGE_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/${HPX_PACKAGE_NAME}Config.cmake"
Expand Down
32 changes: 15 additions & 17 deletions cmake/HPX_SetupBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,11 @@ if(NOT TARGET hpx_dependencies_boost)

set(__boost_libraries "")

if(HPX_PARCELPORT_LIBFABRIC_WITH_LOGGING
OR HPX_PARCELPORT_LIBFABRIC_WITH_DEV_MODE
)
set(__boost_libraries ${__boost_libraries} log log_setup date_time chrono
thread
)
endif()

if(HPX_WITH_GENERIC_CONTEXT_COROUTINES)
# if context is needed, we should still link with boost thread and chrono
set(__boost_libraries ${__boost_libraries} context thread chrono)
endif()

list(REMOVE_DUPLICATES __boost_libraries)

# compatibility with older CMake versions
if(BOOST_ROOT AND NOT Boost_ROOT)
set(Boost_ROOT
Expand Down Expand Up @@ -63,7 +53,6 @@ if(NOT TARGET hpx_dependencies_boost)

elseif(NOT TARGET Boost::boost AND NOT HPX_FIND_PACKAGE)
# Fetch Boost using CMake's FetchContent

if(NOT HPX_WITH_BOOST_VERSION)
set(HPX_WITH_BOOST_VERSION "1.86.0")
endif()
Expand All @@ -81,26 +70,35 @@ if(NOT TARGET hpx_dependencies_boost)
)

# Also need to explicitly list header-only dependencies, since Cmake-Boost
# installs each library's headers individually, as opposed to b2-built Boost.
# installs each library's headers individually, as opposed to b2-built
# Boost.
set(__boost_libraries
${__boost_libraries}
accumulators
bind
config
exception
filesystem
functional
fusion
iostreams
log
optional
parameter
phoenix
regex
spirit
variant
)

if(HPX_FILESYSTEM_WITH_BOOST_FILESYSTEM_COMPATIBILITY)
set(__boost_libraries ${__boost_libraries} filesystem)
endif()

if(HPX_WITH_TOOLS)
set(__boost_libraries ${__boost_libraries} regex)
endif()

if(HPX_WITH_DISTRIBUTED_RUNTIME)
set(__boost_libraries ${__boost_libraries} iostreams)
endif()

set(BOOST_INCLUDE_LIBRARIES ${__boost_libraries})
set(BOOST_SKIP_INSTALL_RULES OFF)

Expand All @@ -109,7 +107,7 @@ if(NOT TARGET hpx_dependencies_boost)
add_library(hpx_dependencies_boost INTERFACE)

list(TRANSFORM __boost_libraries
PREPEND "boost_" OUTPUT_VARIABLE __boost_libraries_prefixed
PREPEND "Boost::" OUTPUT_VARIABLE __boost_libraries_prefixed
)

target_link_libraries(
Expand Down
1 change: 0 additions & 1 deletion cmake/HPX_SetupBoostFilesystem.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
if(HPX_FILESYSTEM_WITH_BOOST_FILESYSTEM_COMPATIBILITY)
# In case find_package(HPX) is called multiple times
if(NOT TARGET Boost::filesystem)
hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now

find_package(
Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE
Expand Down
1 change: 0 additions & 1 deletion cmake/HPX_SetupBoostIostreams.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if((HPX_WITH_COMPRESSION_BZIP2
OR HPX_WITH_COMPRESSION_ZLIB)
AND NOT TARGET Boost::iostreams
)
hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now

find_package(
Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE COMPONENTS iostreams
Expand Down
1 change: 0 additions & 1 deletion cmake/HPX_SetupBoostRegex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

if(NOT TARGET Boost::regex)
hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now

find_package(
Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE COMPONENTS regex
Expand Down
18 changes: 9 additions & 9 deletions cmake/templates/HPXConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ else()
include(HPX_SetupAsio)
endif()


# Stdexec can be installed by HPX or externally installed. In the first case we use
# exported targets, in the second we find Stdexec again using find_package.
# Stdexec can be installed by HPX or externally installed. In the first case we
# use exported targets, in the second we find Stdexec again using find_package.
if(HPX_WITH_STDEXEC)
if(HPX_WITH_FETCH_STDEXEC)
include("${CMAKE_CURRENT_LIST_DIR}/HPXStdexecTarget.cmake")
Expand All @@ -40,8 +39,6 @@ if(HPX_WITH_STDEXEC)
endif()
endif()



# NLohnmann JSON can be installed by HPX or externally installed. In the first
# case we use exported targets, in the second we find JSON again using
# find_package.
Expand Down Expand Up @@ -93,10 +90,13 @@ if("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "SVE")
endif()

if(HPX_WITH_FETCH_BOOST)
# Boost has been installed alongside HPX
# Let HPX_SetupBoost find it
# Boost has been installed alongside HPX, let HPX_SetupBoost find it
if(NOT HPX_CONFIG_IS_INSTALL)
message(FATAL_ERROR "HPX_WITH_FETCH_BOOST=ON requires HPX to be installed.")
hpx_error(
"HPX_WITH_FETCH_BOOST=ON requires HPX to be installed after it is built.
Please execute the CMake install step (cmake --install) on your HPX build
directory, and link your project against the installed instance of HPX."
)
endif()
set(HPX_BOOST_ROOT "${CMAKE_CURRENT_LIST_DIR}/../")
include(HPX_SetupBoost)
Expand All @@ -108,7 +108,7 @@ else()
# By default Boost_ROOT is set to HPX_BOOST_ROOT (not necessary for PAPI or
# HWLOC cause we are specifying HPX_<lib>_ROOT as an HINT to find_package)
if(NOT Boost_ROOT AND NOT "$ENV{BOOST_ROOT}")
set(Boost_ROOT ${HPX_BOOST_ROOT})
set(Boost_ROOT ${HPX_BOOST_ROOT})
endif()
include(HPX_SetupBoost)
include(HPX_SetupBoostFilesystem)
Expand Down

0 comments on commit 726b213

Please sign in to comment.