Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Boost as CMake subproject #6510

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/windows_clang_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_clang_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_debug_vs2019.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_debug_vs2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows_debug_vs2022_fetch_boost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on: [pull_request]
jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- uses: jwlawson/[email protected]
Expand All @@ -21,7 +21,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_debug_vs2022_fetch_hwloc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_release_2019.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_release_2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_release_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2024.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
- name: Configure
shell: bash
Expand Down
19 changes: 13 additions & 6 deletions cmake/HPX_GeneratePackageUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,23 @@ function(hpx_sanitize_usage_requirements property is_build)

endfunction(hpx_sanitize_usage_requirements)

function(hpx_filter_cuda_flags cflag_list)
function(hpx_filter_language_flags cflag_list)
set(_cflag_list "${${cflag_list}}")
string(REGEX REPLACE "\\$<\\$<COMPILE_LANGUAGE:CUDA>:[^>]*>;?" "" _cflag_list
"${_cflag_list}"
# We are always in CXX, so replace conditional values with the values
# themselves
string(REGEX REPLACE "\\$<\\$<COMPILE_LANGUAGE:CXX>:([^>]*)>?" "\\1"
_cflag_list "${_cflag_list}"
)
# Remove conditional values for other languages
string(REGEX REPLACE "\\$<\\$<COMPILE_LANGUAGE:[^>]*>:([^>]*)>?" ""
_cflag_list "${_cflag_list}"
)

set(${cflag_list}
${_cflag_list}
PARENT_SCOPE
)
endfunction(hpx_filter_cuda_flags)
endfunction(hpx_filter_language_flags)

# Append the corresponding (-D, -I) flags for the compilation
function(
Expand Down Expand Up @@ -383,8 +390,8 @@ function(hpx_generate_pkgconfig_from_target target template is_build)
hpx_compile_definitions hpx_compile_options hpx_pic_option
hpx_include_directories hpx_system_include_directories hpx_cflags_list
)
# Cannot generate one file per language yet so filter out cuda
hpx_filter_cuda_flags(hpx_cflags_list)
# Generator expressions that depend on language must be filtered out
hpx_filter_language_flags(hpx_cflags_list)
hpx_construct_library_list(
hpx_link_libraries hpx_link_options hpx_library_list
)
Expand Down
219 changes: 97 additions & 122 deletions cmake/HPX_SetupBoost.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) 2024 Panos Syskakis
# Copyright (c) 2018 Christopher Hinz
# Copyright (c) 2014 Thomas Heller
# Copyright (c) 2007-2024 The STE||AR-Group
Expand All @@ -6,70 +7,6 @@
# 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(HPX_WITH_FETCH_BOOST)
set(HPX_WITH_BOOST_VERSION "1.84.0")
hpx_info(
"HPX_WITH_FETCH_BOOST=${HPX_WITH_FETCH_BOOST}, Boost v${HPX_WITH_BOOST_VERSION} will be fetched using CMake's FetchContent"
)
include(FetchContent)
fetchcontent_declare(
Boost
URL https://github.com/boostorg/boost/releases/download/boost-${HPX_WITH_BOOST_VERSION}/boost-${HPX_WITH_BOOST_VERSION}.tar.gz
TLS_VERIFY true
DOWNLOAD_EXTRACT_TIMESTAMP true
)
fetchcontent_populate(Boost)
set(HPX_WITH_BUILD_FETCHED_BOOST
"Execute process"
CACHE STRING "Used by command line tool to build fetched Boost"
)
set(HPX_WITH_BUILD_FETCHED_BOOST_CHECK
""
CACHE
STRING
"for internal use only, do not modify. Checks if fetched Boost is built"
)

if(NOT HPX_WITH_BUILD_FETCHED_BOOST STREQUAL
HPX_WITH_BUILD_FETCHED_BOOST_CHECK
)
if(WIN32)
execute_process(
COMMAND
cmd /C
"cd ${CMAKE_BINARY_DIR}\\_deps\\boost-src && .\\bootstrap.bat && .\\b2 headers cxxflags=/std:c++${HPX_CXX_STANDARD}"
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
execute_process(
COMMAND
sh -c
"cd ${CMAKE_BINARY_DIR}/_deps/boost-src && ./bootstrap.sh --prefix=${CMAKE_BINARY_DIR}/_deps/boost-installed && ./b2 && ./b2 install --prefix=${CMAKE_BINARY_DIR}/_deps/boost-installed cxxflags=--std=c++${HPX_CXX_STANDARD}"
)
else()
execute_process(
COMMAND
sh -c
"cd ${CMAKE_BINARY_DIR}/_deps/boost-src && ./bootstrap.sh && ./b2 headers cxxflags=--std=c++${HPX_CXX_STANDARD}"
)
endif()
set(HPX_WITH_BUILD_FETCHED_BOOST_CHECK
${HPX_WITH_BUILD_FETCHED_BOOST}
CACHE
INTERNAL
"for internal use only, do not modify. Checks if fetched Boost is built"
)
endif()

set(Boost_DIR
"${CMAKE_BINARY_DIR}/_deps/boost-src"
CACHE INTERNAL ""
)
set(Boost_INCLUDE_DIR
"${CMAKE_BINARY_DIR}/_deps/boost-src"
CACHE INTERNAL ""
)
endif()

# In case find_package(HPX) is called multiple times
if(NOT TARGET hpx_dependencies_boost)
# We first try to find the required minimum set of Boost libraries. This will
Expand All @@ -78,45 +15,7 @@ if(NOT TARGET hpx_dependencies_boost)
set(Boost_USE_STATIC_LIBS ON)
endif()

# Add additional version to recognize
# cmake-format: off
set(Boost_ADDITIONAL_VERSIONS
${Boost_ADDITIONAL_VERSIONS}
"1.85.0" "1.85"
"1.84.0" "1.84"
"1.83.0" "1.83"
"1.82.0" "1.82"
"1.81.0" "1.81"
"1.80.0" "1.80"
"1.79.0" "1.79"
"1.78.0" "1.78"
"1.77.0" "1.77"
"1.76.0" "1.76"
"1.75.0" "1.75"
"1.74.0" "1.74"
"1.73.0" "1.73"
"1.72.0" "1.72"
"1.71.0" "1.71"
)
# cmake-format: on
set(Boost_MINIMUM_VERSION
"1.71"
CACHE INTERNAL "1.71" FORCE
)

set(Boost_NO_BOOST_CMAKE ON) # disable the search for boost-cmake

hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now

# Find the headers and get the version
find_package(Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE REQUIRED)
if(NOT Boost_VERSION_STRING)
set(Boost_VERSION_STRING
"${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}"
)
endif()

set(__boost_libraries "")
# set(__boost_libraries disable_autolinking)
if(HPX_PARCELPORT_LIBFABRIC_WITH_LOGGING
OR HPX_PARCELPORT_LIBFABRIC_WITH_DEV_MODE
)
Expand All @@ -141,15 +40,101 @@ if(NOT TARGET hpx_dependencies_boost)
unset(BOOST_ROOT CACHE)
endif()

find_package(
Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE REQUIRED
COMPONENTS ${__boost_libraries}
)
if((NOT HPX_WITH_FETCH_BOOST) OR HPX_FIND_PACKAGE)

set(Boost_MINIMUM_VERSION
"1.71"
CACHE INTERNAL "1.71" FORCE
)

if(NOT Boost_FOUND)
hpx_error(
"Could not find Boost. Please set Boost_ROOT to point to your Boost installation."
find_package(
Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE REQUIRED
COMPONENTS ${__boost_libraries} HINTS ${HPX_BOOST_ROOT} $ENV{BOOST_ROOT}
)

add_library(hpx_dependencies_boost INTERFACE IMPORTED)

target_link_libraries(hpx_dependencies_boost INTERFACE Boost::boost)

foreach(__boost_library ${__boost_libraries})
target_link_libraries(
hpx_dependencies_boost INTERFACE Boost::${__boost_library}
)
endforeach()

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()

hpx_info(
"HPX_WITH_FETCH_BOOST=${HPX_WITH_FETCH_BOOST}, Boost v${HPX_WITH_BOOST_VERSION} will be fetched using CMake's FetchContent"
)

include(FetchContent)
fetchcontent_declare(
Boost
URL https://github.com/boostorg/boost/releases/download/boost-${HPX_WITH_BOOST_VERSION}/boost-${HPX_WITH_BOOST_VERSION}-cmake.tar.xz
TLS_VERIFY true
DOWNLOAD_EXTRACT_TIMESTAMP true
)

# Need to explicitly list header-only dependencies, since Cmake-Boost has
# 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
)

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

fetchcontent_makeavailable(Boost)

add_library(hpx_dependencies_boost INTERFACE)

list(TRANSFORM __boost_libraries
PREPEND "boost_" OUTPUT_VARIABLE __boost_libraries_prefixed
)

target_link_libraries(
hpx_dependencies_boost INTERFACE ${__boost_libraries_prefixed}
)

install(
TARGETS hpx_dependencies_boost
EXPORT HPXBoostTarget
COMPONENT core
)

install(
EXPORT HPXBoostTarget
FILE HPXBoostTarget.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}
)

export(
TARGETS hpx_dependencies_boost
FILE "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/HPXBoostTarget.cmake"
)

endif()

# We are assuming that there is only one Boost Root
Expand All @@ -163,15 +148,6 @@ if(NOT TARGET hpx_dependencies_boost)
file(TO_CMAKE_PATH ${Boost_ROOT} Boost_ROOT)
endif()

add_library(hpx_dependencies_boost INTERFACE IMPORTED)

target_link_libraries(hpx_dependencies_boost INTERFACE Boost::boost)
foreach(__boost_library ${__boost_libraries})
target_link_libraries(
hpx_dependencies_boost INTERFACE Boost::${__boost_library}
)
endforeach()

if(HPX_WITH_HIP AND Boost_VERSION VERSION_LESS 1.78)
target_compile_definitions(
hpx_dependencies_boost
Expand All @@ -185,11 +161,10 @@ if(NOT TARGET hpx_dependencies_boost)
if(NOT Boost_USE_STATIC_LIBS)
hpx_add_config_cond_define(BOOST_ALL_DYN_LINK)
endif()

if(NOT MSVC)
hpx_add_config_define(HPX_COROUTINE_NO_SEPARATE_CALL_SITES)
endif()

hpx_add_config_cond_define(BOOST_BIGINT_HAS_NATIVE_INT64)
target_link_libraries(
hpx_dependencies_boost INTERFACE Boost::disable_autolinking
)
endif()
Loading
Loading