diff --git a/.github/workflows/windows_clang_debug.yml b/.github/workflows/windows_clang_debug.yml index 2da4c6b4a9e6..9dab2000f4a7 100644 --- a/.github/workflows/windows_clang_debug.yml +++ b/.github/workflows/windows_clang_debug.yml @@ -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 diff --git a/.github/workflows/windows_clang_release.yml b/.github/workflows/windows_clang_release.yml index 9d595b1793c5..899d2556364f 100644 --- a/.github/workflows/windows_clang_release.yml +++ b/.github/workflows/windows_clang_release.yml @@ -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 diff --git a/.github/workflows/windows_debug_vs2019.yml b/.github/workflows/windows_debug_vs2019.yml index 4ef381b46f08..ee56df5e4ae2 100644 --- a/.github/workflows/windows_debug_vs2019.yml +++ b/.github/workflows/windows_debug_vs2019.yml @@ -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 diff --git a/.github/workflows/windows_debug_vs2022.yml b/.github/workflows/windows_debug_vs2022.yml index 74d23bfc4973..0a0f73ca18cf 100644 --- a/.github/workflows/windows_debug_vs2022.yml +++ b/.github/workflows/windows_debug_vs2022.yml @@ -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 diff --git a/.github/workflows/windows_debug_vs2022_fetch_boost.yml b/.github/workflows/windows_debug_vs2022_fetch_boost.yml index d6653a73e0e3..6d6128c6477d 100644 --- a/.github/workflows/windows_debug_vs2022_fetch_boost.yml +++ b/.github/workflows/windows_debug_vs2022_fetch_boost.yml @@ -11,7 +11,7 @@ on: [pull_request] jobs: build: runs-on: windows-latest - + steps: - uses: actions/checkout@v4 - uses: jwlawson/actions-setup-cmake@v2.0 @@ -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 diff --git a/.github/workflows/windows_debug_vs2022_fetch_hwloc.yml b/.github/workflows/windows_debug_vs2022_fetch_hwloc.yml index 5054c2468412..d8818e25b897 100644 --- a/.github/workflows/windows_debug_vs2022_fetch_hwloc.yml +++ b/.github/workflows/windows_debug_vs2022_fetch_hwloc.yml @@ -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 diff --git a/.github/workflows/windows_release_2019.yml b/.github/workflows/windows_release_2019.yml index 25a20d8617be..0f39dbdb7c9e 100644 --- a/.github/workflows/windows_release_2019.yml +++ b/.github/workflows/windows_release_2019.yml @@ -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 diff --git a/.github/workflows/windows_release_2022.yml b/.github/workflows/windows_release_2022.yml index 0ab767cd09a0..00985b93cef5 100644 --- a/.github/workflows/windows_release_2022.yml +++ b/.github/workflows/windows_release_2022.yml @@ -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 diff --git a/.github/workflows/windows_release_static.yml b/.github/workflows/windows_release_static.yml index e6321d74249c..fad0195e836f 100644 --- a/.github/workflows/windows_release_static.yml +++ b/.github/workflows/windows_release_static.yml @@ -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 diff --git a/cmake/HPX_GeneratePackageUtils.cmake b/cmake/HPX_GeneratePackageUtils.cmake index ae25a6db95a3..497e8ef5e082 100644 --- a/cmake/HPX_GeneratePackageUtils.cmake +++ b/cmake/HPX_GeneratePackageUtils.cmake @@ -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 "\\$<\\$:[^>]*>;?" "" _cflag_list - "${_cflag_list}" + # We are always in CXX, so replace conditional values with the values + # themselves + string(REGEX REPLACE "\\$<\\$:([^>]*)>?" "\\1" + _cflag_list "${_cflag_list}" ) + # Remove conditional values for other languages + string(REGEX REPLACE "\\$<\\$]*>:([^>]*)>?" "" + _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( @@ -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 ) diff --git a/cmake/HPX_SetupBoost.cmake b/cmake/HPX_SetupBoost.cmake index 14aa36c25df8..1a7d4f09e600 100644 --- a/cmake/HPX_SetupBoost.cmake +++ b/cmake/HPX_SetupBoost.cmake @@ -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 @@ -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 @@ -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 ) @@ -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 @@ -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 @@ -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() diff --git a/cmake/templates/HPXConfig.cmake.in b/cmake/templates/HPXConfig.cmake.in index 3c5161690bde..ba64cfb6c96d 100644 --- a/cmake/templates/HPXConfig.cmake.in +++ b/cmake/templates/HPXConfig.cmake.in @@ -91,6 +91,26 @@ if("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "SVE") endif() endif() +if(HPX_WITH_FETCH_BOOST) + # Boost has been installed alongside HPX + # Let HPX_SetupBoost find it + set(HPX_BOOST_ROOT "${CMAKE_CURRENT_LIST_DIR}/../") + include(HPX_SetupBoost) + include(HPX_SetupBoostFilesystem) + include(HPX_SetupBoostIostreams) +else() + # Boost Separate boost targets to be unarily linked to some modules + set(HPX_BOOST_ROOT "@Boost_ROOT@") + # By default Boost_ROOT is set to HPX_BOOST_ROOT (not necessary for PAPI or + # HWLOC cause we are specifying HPX__ROOT as an HINT to find_package) + if(NOT Boost_ROOT AND NOT "$ENV{BOOST_ROOT}") + set(Boost_ROOT ${HPX_BOOST_ROOT}) + endif() + include(HPX_SetupBoost) + include(HPX_SetupBoostFilesystem) + include(HPX_SetupBoostIostreams) +endif() + include("${CMAKE_CURRENT_LIST_DIR}/HPXInternalTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/HPXTargets.cmake") @@ -156,17 +176,6 @@ include(HPX_SetupAllocator) include(HPX_SetupThreads) -# Boost Separate boost targets to be unarily linked to some modules -set(HPX_BOOST_ROOT "@Boost_ROOT@") -# By default Boost_ROOT is set to HPX_BOOST_ROOT (not necessary for PAPI or -# HWLOC cause we are specifying HPX__ROOT as an HINT to find_package) -if(NOT Boost_ROOT AND NOT "$ENV{BOOST_ROOT}") - set(Boost_ROOT ${HPX_BOOST_ROOT}) -endif() -include(HPX_SetupBoost) -include(HPX_SetupBoostFilesystem) -include(HPX_SetupBoostIostreams) - # HIP include(HPX_SetupHIP) diff --git a/cmake/templates/HPXMacros.cmake.in b/cmake/templates/HPXMacros.cmake.in index a3dd7a5f8e13..518aced7c4f9 100644 --- a/cmake/templates/HPXMacros.cmake.in +++ b/cmake/templates/HPXMacros.cmake.in @@ -88,7 +88,7 @@ function(hpx_check_compiler_compatibility) endfunction() function(hpx_check_boost_compatibility) - if(HPX_IGNORE_BOOST_COMPATIBILITY) + if(HPX_IGNORE_BOOST_COMPATIBILITY OR HPX_WITH_FETCH_BOOST) return() endif() if(NOT DEFINED Boost_ROOT)