From 336c66f297c9601302006fc6be6d2d445c461f36 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 28 Nov 2022 23:43:44 -0600 Subject: [PATCH] CMake: Reorganize configure_bundled() definition to bundled subdirectory --- bundled/CMakeLists.txt | 4 + .../libs/iostreams/src/CMakeLists.txt | 5 - .../libs/serialization/src/CMakeLists.txt | 5 - .../libs/system/src/CMakeLists.txt | 5 - .../libs/thread/src/CMakeLists.txt | 5 - bundled/kokkos-3.7.00/CMakeLists.txt | 1 - bundled/setup_bundled.cmake | 86 ++++++++++++ bundled/tbb-2018_U2/src/CMakeLists.txt | 1 - bundled/umfpack/AMD/Source/CMakeLists.txt | 2 - bundled/umfpack/UMFPACK/Source/CMakeLists.txt | 2 - cmake/configure/configure_10_taskflow.cmake | 5 - cmake/configure/configure_10_tbb.cmake | 17 --- cmake/configure/configure_20_boost.cmake | 132 +++--------------- cmake/configure/configure_20_umfpack.cmake | 7 +- cmake/configure/configure_30_kokkos.cmake | 11 +- cmake/configure/configure_50_muparser.cmake | 5 - cmake/macros/macro_configure_feature.cmake | 3 +- 17 files changed, 116 insertions(+), 180 deletions(-) diff --git a/bundled/CMakeLists.txt b/bundled/CMakeLists.txt index cc3fe0cef5..f45c0afbd0 100644 --- a/bundled/CMakeLists.txt +++ b/bundled/CMakeLists.txt @@ -19,6 +19,10 @@ message(STATUS "Setting up bundled features") +include_directories( + ${DEAL_II_BUNDLED_INCLUDE_DIRS} + ${DEAL_II_INCLUDE_DIRS} + ) if(FEATURE_BOOST_BUNDLED_CONFIGURED) add_subdirectory(${BOOST_FOLDER}/libs/serialization/src) diff --git a/bundled/boost-1.70.0/libs/iostreams/src/CMakeLists.txt b/bundled/boost-1.70.0/libs/iostreams/src/CMakeLists.txt index 9dc08a8d53..34e3572668 100644 --- a/bundled/boost-1.70.0/libs/iostreams/src/CMakeLists.txt +++ b/bundled/boost-1.70.0/libs/iostreams/src/CMakeLists.txt @@ -14,11 +14,6 @@ ## ## --------------------------------------------------------------------- -include_directories( - ${BOOST_BUNDLED_INCLUDE_DIRS} - ${DEAL_II_INCLUDE_DIRS} - ) - set(src_boost_iostreams file_descriptor.cpp gzip.cpp diff --git a/bundled/boost-1.70.0/libs/serialization/src/CMakeLists.txt b/bundled/boost-1.70.0/libs/serialization/src/CMakeLists.txt index 8994ed57be..0f633ed25b 100644 --- a/bundled/boost-1.70.0/libs/serialization/src/CMakeLists.txt +++ b/bundled/boost-1.70.0/libs/serialization/src/CMakeLists.txt @@ -14,11 +14,6 @@ ## ## --------------------------------------------------------------------- -include_directories( - ${BOOST_BUNDLED_INCLUDE_DIRS} - ${DEAL_II_INCLUDE_DIRS} - ) - set(src_boost_serialization archive_exception.cpp basic_archive.cpp diff --git a/bundled/boost-1.70.0/libs/system/src/CMakeLists.txt b/bundled/boost-1.70.0/libs/system/src/CMakeLists.txt index 02f08a432d..a3b6ebc67e 100644 --- a/bundled/boost-1.70.0/libs/system/src/CMakeLists.txt +++ b/bundled/boost-1.70.0/libs/system/src/CMakeLists.txt @@ -14,11 +14,6 @@ ## ## --------------------------------------------------------------------- -include_directories( - ${BOOST_BUNDLED_INCLUDE_DIRS} - ${DEAL_II_INCLUDE_DIRS} - ) - set(src_boost_system error_code.cpp ) diff --git a/bundled/boost-1.70.0/libs/thread/src/CMakeLists.txt b/bundled/boost-1.70.0/libs/thread/src/CMakeLists.txt index 40d6bc2830..0dea7c241b 100644 --- a/bundled/boost-1.70.0/libs/thread/src/CMakeLists.txt +++ b/bundled/boost-1.70.0/libs/thread/src/CMakeLists.txt @@ -14,11 +14,6 @@ ## ## --------------------------------------------------------------------- -include_directories( - ${BOOST_BUNDLED_INCLUDE_DIRS} - ${DEAL_II_INCLUDE_DIRS} - ) - if(DEAL_II_USE_MT_POSIX) set(src_boost_thread pthread/once.cpp diff --git a/bundled/kokkos-3.7.00/CMakeLists.txt b/bundled/kokkos-3.7.00/CMakeLists.txt index 19d5c80c49..964f8f5fba 100644 --- a/bundled/kokkos-3.7.00/CMakeLists.txt +++ b/bundled/kokkos-3.7.00/CMakeLists.txt @@ -63,7 +63,6 @@ set(src_kokkos simd/src/Kokkos_SIMD_dummy.cpp containers/src/impl/Kokkos_UnorderedMap_impl.cpp ) -include_directories(${KOKKOS_BUNDLED_INCLUDE_DIRS}) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-float-conversion) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-missing-field-initializers) diff --git a/bundled/setup_bundled.cmake b/bundled/setup_bundled.cmake index a7227eb8d9..0934bdb3fb 100644 --- a/bundled/setup_bundled.cmake +++ b/bundled/setup_bundled.cmake @@ -18,6 +18,7 @@ # setup of compilation targets and installation here: # + # # Boost C++ libraries # @@ -30,6 +31,48 @@ option(DEAL_II_FORCE_BUNDLED_BOOST set(BOOST_FOLDER "${CMAKE_SOURCE_DIR}/bundled/boost-1.70.0") +macro(feature_boost_configure_bundled) + # + # Add rt to the link interface as well, boost/chrono needs it. + # + if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") + find_system_library(rt_LIBRARY NAMES rt) + mark_as_advanced(rt_LIBRARY) + if(NOT rt_LIBRARY MATCHES "-NOTFOUND") + list(APPEND DEAL_II_LIBRARIES ${rt_LIBRARY}) + endif() + endif() + + # + # We still need the version information, which is set up in the FindBoost + # module in the non-bundled case: + # + file(STRINGS "${BOOST_FOLDER}/include/boost/version.hpp" + BOOST_VERSION_STRING + REGEX "#define.*BOOST_VERSION") + + string(REGEX REPLACE "^.*BOOST_VERSION.* ([0-9]+).*" "\\1" + BOOST_VERSION_NUMBER "${BOOST_VERSION_STRING}" + ) + math(EXPR Boost_MAJOR_VERSION "${BOOST_VERSION_NUMBER} / 100000") + math(EXPR Boost_MINOR_VERSION "${BOOST_VERSION_NUMBER} / 100 % 1000") + math(EXPR Boost_SUBMINOR_VERSION "${BOOST_VERSION_NUMBER} % 100") + + if(CMAKE_SYSTEM_NAME MATCHES "Windows") + # + # Bundled boost tries to (dl)open itself as a dynamic library on + # Windows. Disable this undesired behavior by exporting + # BOOST_ALL_NO_LIB on Windows platforms (for bundled boost). + # + list(APPEND DEAL_II_DEFINITIONS "BOOST_ALL_NO_LIB") + endif() + + enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-unused-local-typedefs") + + list(APPEND DEAL_II_BUNDLED_INCLUDE_DIRS ${BOOST_FOLDER}/include) +endmacro() + + # # Kokkos # @@ -42,6 +85,17 @@ option(DEAL_II_FORCE_BUNDLED_KOKKOS set(KOKKOS_FOLDER "${CMAKE_SOURCE_DIR}/bundled/kokkos-3.7.00") +macro(feature_kokkos_configure_bundled) + list(APPEND DEAL_II_BUNDLED_INCLUDE_DIRS + ${KOKKOS_FOLDER}/algorithms/src + ${KOKKOS_FOLDER}/containers/src + ${KOKKOS_FOLDER}/core/src + ${KOKKOS_FOLDER}/simd/src + ${KOKKOS_FOLDER}/tpls/desul/include + ) +endmacro() + + # # Taskflow # @@ -54,6 +108,10 @@ option(DEAL_II_FORCE_BUNDLED_TASKFLOW set(TASKFLOW_FOLDER "${CMAKE_SOURCE_DIR}/bundled/taskflow-2.5.0") +macro(feature_taskflow_configure_bundled) + list(APPEND DEAL_II_BUNDLED_INCLUDE_DIRS ${TASKFLOW_FOLDER}/include) +endmacro() + # # Threading Building Blocks library @@ -73,6 +131,23 @@ if( NOT CMAKE_SYSTEM_NAME MATCHES "CYGWIN" set(TBB_FOLDER "${CMAKE_SOURCE_DIR}/bundled/tbb-2018_U2") endif() +macro(feature_tbb_configure_bundled) + # + # We have to disable a bunch of warnings: + # + enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-parentheses") + + # + # tbb uses dlopen/dlclose, so link against libdl.so as well: + # + list(APPEND DEAL_II_LIBRARIES ${CMAKE_DL_LIBS}) + + list(APPEND DEAL_II_BUNDLED_INCLUDE_DIRS ${TBB_FOLDER}/include) + + set(DEAL_II_TBB_WITH_ONEAPI FALSE) +endmacro() + + # # UMFPACK, AMD and UFCONFIG: # @@ -85,6 +160,12 @@ option(DEAL_II_FORCE_BUNDLED_UMFPACK set(UMFPACK_FOLDER "${CMAKE_SOURCE_DIR}/bundled/umfpack") +macro(feature_umfpack_configure_bundled) + list(APPEND DEAL_II_BUNDLED_INCLUDE_DIRS + ${UMFPACK_FOLDER}/UMFPACK/Include ${UMFPACK_FOLDER}/AMD/Include + ) +endmacro() + # # muparser @@ -96,3 +177,8 @@ option(DEAL_II_FORCE_BUNDLED_MUPARSER OFF) set(MUPARSER_FOLDER "${CMAKE_SOURCE_DIR}/bundled/muparser_v2_3_3/") + + +macro(feature_muparser_configure_bundled) + list(APPEND DEAL_II_BUNDLED_INCLUDE_DIRS ${MUPARSER_FOLDER}/include) +endmacro() diff --git a/bundled/tbb-2018_U2/src/CMakeLists.txt b/bundled/tbb-2018_U2/src/CMakeLists.txt index 16b273d056..9a9310102f 100644 --- a/bundled/tbb-2018_U2/src/CMakeLists.txt +++ b/bundled/tbb-2018_U2/src/CMakeLists.txt @@ -45,7 +45,6 @@ enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-tautological-overlap-compare") set(CMAKE_INCLUDE_CURRENT_DIR TRUE) include_directories( - ${TBB_BUNDLED_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/rml/include ) diff --git a/bundled/umfpack/AMD/Source/CMakeLists.txt b/bundled/umfpack/AMD/Source/CMakeLists.txt index f1bf0293c9..d3c3c5eff9 100644 --- a/bundled/umfpack/AMD/Source/CMakeLists.txt +++ b/bundled/umfpack/AMD/Source/CMakeLists.txt @@ -13,8 +13,6 @@ ## ## --------------------------------------------------------------------- -include_directories(${UMFPACK_BUNDLED_INCLUDE_DIRS}) - strip_flag(DEAL_II_CXX_FLAGS "-Wfloat-conversion") set(src_amd diff --git a/bundled/umfpack/UMFPACK/Source/CMakeLists.txt b/bundled/umfpack/UMFPACK/Source/CMakeLists.txt index 1929a68b02..6ffffa611e 100644 --- a/bundled/umfpack/UMFPACK/Source/CMakeLists.txt +++ b/bundled/umfpack/UMFPACK/Source/CMakeLists.txt @@ -281,8 +281,6 @@ # .................................................. # -include_directories(${UMFPACK_BUNDLED_INCLUDE_DIRS}) - # # *Shush!* # (Remove locally in this subdirectory) diff --git a/cmake/configure/configure_10_taskflow.cmake b/cmake/configure/configure_10_taskflow.cmake index a713948d67..27d5209f9e 100644 --- a/cmake/configure/configure_10_taskflow.cmake +++ b/cmake/configure/configure_10_taskflow.cmake @@ -70,10 +70,5 @@ macro(feature_taskflow_find_external var) endmacro() -macro(feature_taskflow_configure_bundled) - list(APPEND TASKFLOW_BUNDLED_INCLUDE_DIRS ${TASKFLOW_FOLDER}/include) -endmacro() - - configure_feature(TASKFLOW) diff --git a/cmake/configure/configure_10_tbb.cmake b/cmake/configure/configure_10_tbb.cmake index 76e846fcf6..29b3ff6ba0 100644 --- a/cmake/configure/configure_10_tbb.cmake +++ b/cmake/configure/configure_10_tbb.cmake @@ -65,21 +65,4 @@ macro(feature_tbb_find_external var) endmacro() -macro(feature_tbb_configure_bundled) - # - # We have to disable a bunch of warnings: - # - enable_if_supported(TBB_CXX_FLAGS "-Wno-parentheses") - - # - # tbb uses dlopen/dlclose, so link against libdl.so as well: - # - list(APPEND TBB_LIBRARIES ${CMAKE_DL_LIBS}) - - list(APPEND TBB_BUNDLED_INCLUDE_DIRS ${TBB_FOLDER}/include) - - set(DEAL_II_TBB_WITH_ONEAPI FALSE) -endmacro() - - configure_feature(TBB) diff --git a/cmake/configure/configure_20_boost.cmake b/cmake/configure/configure_20_boost.cmake index 295616fda6..5513de65bf 100644 --- a/cmake/configure/configure_20_boost.cmake +++ b/cmake/configure/configure_20_boost.cmake @@ -32,116 +32,6 @@ set(DEAL_II_WITH_BOOST ON # Always true. We need it :-] ) -macro(feature_boost_configure_common) - # Some standard library implementations do not implement std::auto_ptr - # (anymore) which was deprecated for C++11 and removed in the C++17 standard. - # Older boost versions can't know about this but provide a possibility to - # circumvent the issue. Hence, we just check ourselves. - if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - add_flags(CMAKE_REQUIRED_FLAGS "/WX /EHsc") - else() - add_flags(CMAKE_REQUIRED_FLAGS "-Werror") - endif() - # The configure function is called only once. In case an externally provided - # boost library is detected, BOOST_INCLUDE_DIRS contains the include paths to - # be used and BOOST_BUNDLED_INCLUDE_DIRS is empty. For the bundled library, it - # is the other way around. - list(APPEND CMAKE_REQUIRED_INCLUDES ${BOOST_INCLUDE_DIRS} ${BOOST_BUNDLED_INCLUDE_DIRS}) - - # In case, the boost library already sets BOOST_NO_AUTO_PTR we report - # DEAL_II_HAS_AUTO_PTR to be true to avoid redefining the macro. - CHECK_CXX_SOURCE_COMPILES( - " - #include - #include - - int main() - { - #ifndef BOOST_NO_AUTO_PTR - int *i = new int; - std::auto_ptr x(i); - #endif - return 0; - } - " - DEAL_II_HAS_AUTO_PTR) - - reset_cmake_required() - - # Fix some problems by defining some additional preprocessor symbols. - # Ultimately these are added into DEAL_II_DEFINITIONS. They are separate - # here so that they show up in detailed.log under DEAL_II_WITH_BOOST as, - # logically, they are part of our boost configuration. - if(NOT DEAL_II_HAS_AUTO_PTR) - list(APPEND BOOST_DEFINITIONS "BOOST_NO_AUTO_PTR") - endif() - - enable_if_supported(BOOST_CXX_FLAGS "-Wno-unused-local-typedefs") - - # At least BOOST 1.74 has the problem that some of the BOOST headers - # include other BOOST headers that are deprecated, and this then leads to - # warnings. That's rather annoying. - - # The configure function is called only once. In case an externally provided - # boost library is detected, BOOST_INCLUDE_DIRS contains the include paths to - # be used and BOOST_BUNDLED_INCLUDE_DIRS is empty. For the bundled library, it - # is the other way around. - list(APPEND CMAKE_REQUIRED_INCLUDES ${BOOST_INCLUDE_DIRS} ${BOOST_BUNDLED_INCLUDE_DIRS}) - - check_cxx_compiler_bug( - " - #define BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED - #define BOOST_HEADER_DEPRECATED(a) _Pragma(\"GCC error \\\"stop compilation\\\"\"); - #include - int main() { return 0; } - " - DEAL_II_BOOST_HAS_BROKEN_HEADER_DEPRECATIONS) - reset_cmake_required() -endmacro() - - -macro(feature_boost_configure_bundled) - # - # Add rt to the link interface as well, boost/chrono needs it. - # - if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") - find_system_library(rt_LIBRARY NAMES rt) - mark_as_advanced(rt_LIBRARY) - if(NOT rt_LIBRARY MATCHES "-NOTFOUND") - set(BOOST_LIBRARIES ${rt_LIBRARY}) - endif() - endif() - - # We need to set this path before calling the configure function - # to be able to use the include paths in the checks. - set(BOOST_BUNDLED_INCLUDE_DIRS ${BOOST_FOLDER}/include) - # - # We still need the version information, which is set up in the FindBoost - # module in the non-bundled case: - # - file(STRINGS "${BOOST_BUNDLED_INCLUDE_DIRS}/boost/version.hpp" - BOOST_VERSION_STRING - REGEX "#define.*BOOST_VERSION") - - string(REGEX REPLACE "^.*BOOST_VERSION.* ([0-9]+).*" "\\1" - BOOST_VERSION_NUMBER "${BOOST_VERSION_STRING}" - ) - math(EXPR Boost_MAJOR_VERSION "${BOOST_VERSION_NUMBER} / 100000") - math(EXPR Boost_MINOR_VERSION "${BOOST_VERSION_NUMBER} / 100 % 1000") - math(EXPR Boost_SUBMINOR_VERSION "${BOOST_VERSION_NUMBER} % 100") - - FEATURE_BOOST_CONFIGURE_COMMON() - - if(CMAKE_SYSTEM_NAME MATCHES "Windows") - # - # Bundled boost tries to (dl)open itself as a dynamic library on - # Windows. Disable this undesired behavior by exporting - # BOOST_ALL_NO_LIB on Windows platforms (for bundled boost). - # - list(APPEND BOOST_DEFINITIONS "BOOST_ALL_NO_LIB") - endif() -endmacro() - macro(feature_boost_find_external var) find_package(DEAL_II_BOOST) @@ -256,7 +146,27 @@ endmacro() macro(feature_boost_configure_external) - FEATURE_BOOST_CONFIGURE_COMMON() + enable_if_supported(BOOST_CXX_FLAGS "-Wno-unused-local-typedefs") + + # At least BOOST 1.74 has the problem that some of the BOOST headers + # include other BOOST headers that are deprecated, and this then leads to + # warnings. That's rather annoying. + + # The configure function is called only once. In case an externally provided + # boost library is detected, BOOST_INCLUDE_DIRS contains the include paths to + # be used and BOOST_BUNDLED_INCLUDE_DIRS is empty. For the bundled library, it + # is the other way around. + list(APPEND CMAKE_REQUIRED_INCLUDES ${BOOST_INCLUDE_DIRS} ${BOOST_BUNDLED_INCLUDE_DIRS}) + + check_cxx_compiler_bug( + " + #define BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED + #define BOOST_HEADER_DEPRECATED(a) _Pragma(\"GCC error \\\"stop compilation\\\"\"); + #include + int main() { return 0; } + " + DEAL_II_BOOST_HAS_BROKEN_HEADER_DEPRECATIONS) + reset_cmake_required() endmacro() diff --git a/cmake/configure/configure_20_umfpack.cmake b/cmake/configure/configure_20_umfpack.cmake index 5c2bfc04eb..9f7ffef5e1 100644 --- a/cmake/configure/configure_20_umfpack.cmake +++ b/cmake/configure/configure_20_umfpack.cmake @@ -19,12 +19,6 @@ set(FEATURE_UMFPACK_DEPENDS LAPACK) -macro(feature_umfpack_configure_bundled) - set(UMFPACK_BUNDLED_INCLUDE_DIRS - ${UMFPACK_FOLDER}/UMFPACK/Include - ${UMFPACK_FOLDER}/AMD/Include - ) -endmacro() macro(feature_umfpack_error_message) message(FATAL_ERROR "\n" @@ -43,4 +37,5 @@ macro(feature_umfpack_error_message) ) endmacro() + configure_feature(UMFPACK) diff --git a/cmake/configure/configure_30_kokkos.cmake b/cmake/configure/configure_30_kokkos.cmake index d744e42e5b..d020a7bfe4 100644 --- a/cmake/configure/configure_30_kokkos.cmake +++ b/cmake/configure/configure_30_kokkos.cmake @@ -21,18 +21,10 @@ set(DEAL_II_WITH_KOKKOS ON # Always true. We need it :-] CACHE BOOL "Build deal.II with support for Kokkos." FORCE ) -macro(feature_kokkos_configure_bundled) - set(KOKKOS_BUNDLED_INCLUDE_DIRS - ${KOKKOS_FOLDER}/algorithms/src - ${KOKKOS_FOLDER}/containers/src - ${KOKKOS_FOLDER}/core/src - ${KOKKOS_FOLDER}/simd/src - ${KOKKOS_FOLDER}/tpls/desul/include - ) -endmacro() configure_feature(KOKKOS) + # # DEAL_II_WITH_KOKKOS is always required. # @@ -46,3 +38,4 @@ if(NOT DEAL_II_WITH_KOKKOS) ) endif() endif() + diff --git a/cmake/configure/configure_50_muparser.cmake b/cmake/configure/configure_50_muparser.cmake index b1d6f4c206..0467f32c88 100644 --- a/cmake/configure/configure_50_muparser.cmake +++ b/cmake/configure/configure_50_muparser.cmake @@ -17,9 +17,4 @@ # Configuration for the MUPARSER library: # -macro(feature_muparser_configure_bundled) - set(MUPARSER_BUNDLED_INCLUDE_DIRS ${MUPARSER_FOLDER}/include) -endmacro() - - configure_feature(MUPARSER) diff --git a/cmake/macros/macro_configure_feature.cmake b/cmake/macros/macro_configure_feature.cmake index 8cffd83f2c..dc4e6a1c7d 100644 --- a/cmake/macros/macro_configure_feature.cmake +++ b/cmake/macros/macro_configure_feature.cmake @@ -218,7 +218,8 @@ macro(configure_feature _feature) purge_feature(${_feature}) if(FEATURE_${_feature}_HAVE_BUNDLED) - evaluate_expression("FEATURE_${_feature}_CONFIGURE_BUNDLED()") + evaluate_expression("feature_${_feature}_configure_bundled()") + message(STATUS "") message(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.") set(FEATURE_${_feature}_BUNDLED_CONFIGURED TRUE) set_cached_option(${_feature} ON) -- 2.39.5