From 27047045fe0a6145ff16b29fb7253662b666269c Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 28 Nov 2022 16:02:29 -0600 Subject: [PATCH] CMake: introduce define_object_target() and harmonize naming --- .../libs/iostreams/src/CMakeLists.txt | 2 +- .../libs/serialization/src/CMakeLists.txt | 2 +- .../libs/system/src/CMakeLists.txt | 2 +- bundled/kokkos-3.7.00/CMakeLists.txt | 2 +- bundled/muparser_v2_3_3/CMakeLists.txt | 2 +- bundled/tbb-2018_U2/src/CMakeLists.txt | 8 +- bundled/umfpack/AMD/Source/CMakeLists.txt | 10 +-- bundled/umfpack/UMFPACK/Source/CMakeLists.txt | 78 +++++++++---------- cmake/macros/macro_configure_feature.cmake | 2 + .../macro_deal_ii_add_definitions.cmake | 2 +- cmake/macros/macro_deal_ii_add_library.cmake | 66 ---------------- cmake/macros/macro_define_object_target.cmake | 77 ++++++++++++++++++ source/algorithms/CMakeLists.txt | 4 +- source/arborx/CMakeLists.txt | 4 +- source/base/CMakeLists.txt | 4 +- source/cgal/CMakeLists.txt | 4 +- source/differentiation/ad/CMakeLists.txt | 4 +- source/differentiation/sd/CMakeLists.txt | 4 +- source/distributed/CMakeLists.txt | 4 +- source/dofs/CMakeLists.txt | 4 +- source/fe/CMakeLists.txt | 4 +- source/gmsh/CMakeLists.txt | 4 +- source/grid/CMakeLists.txt | 4 +- source/hp/CMakeLists.txt | 4 +- source/integrators/CMakeLists.txt | 2 +- source/lac/CMakeLists.txt | 4 +- source/matrix_free/CMakeLists.txt | 4 +- source/meshworker/CMakeLists.txt | 4 +- source/multigrid/CMakeLists.txt | 4 +- source/non_matching/CMakeLists.txt | 4 +- source/numerics/CMakeLists.txt | 4 +- source/opencascade/CMakeLists.txt | 4 +- source/optimization/rol/CMakeLists.txt | 4 +- source/particles/CMakeLists.txt | 4 +- source/physics/CMakeLists.txt | 4 +- source/physics/elasticity/CMakeLists.txt | 4 +- source/sundials/CMakeLists.txt | 4 +- source/trilinos/CMakeLists.txt | 4 +- 38 files changed, 184 insertions(+), 171 deletions(-) delete mode 100644 cmake/macros/macro_deal_ii_add_library.cmake create mode 100644 cmake/macros/macro_define_object_target.cmake 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 34e3572668..4c672a2224 100644 --- a/bundled/boost-1.70.0/libs/iostreams/src/CMakeLists.txt +++ b/bundled/boost-1.70.0/libs/iostreams/src/CMakeLists.txt @@ -24,4 +24,4 @@ enable_if_supported(DEAL_II_CXX_FLAGS -Wno-c11-extensions) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-deprecated-copy) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-uninitialized) -deal_ii_add_library(obj_boost_iostreams OBJECT ${src_boost_iostreams}) +define_object_library(bundled_boost_iostreams OBJECT ${src_boost_iostreams}) 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 0f633ed25b..91097eb044 100644 --- a/bundled/boost-1.70.0/libs/serialization/src/CMakeLists.txt +++ b/bundled/boost-1.70.0/libs/serialization/src/CMakeLists.txt @@ -58,4 +58,4 @@ enable_if_supported(DEAL_II_CXX_FLAGS -Wno-c11-extensions) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-deprecated-copy) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-uninitialized) -deal_ii_add_library(obj_boost_serialization OBJECT ${src_boost_serialization}) +define_object_library(bundled_boost_serialization OBJECT ${src_boost_serialization}) 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 a3b6ebc67e..28655b04f9 100644 --- a/bundled/boost-1.70.0/libs/system/src/CMakeLists.txt +++ b/bundled/boost-1.70.0/libs/system/src/CMakeLists.txt @@ -18,5 +18,5 @@ set(src_boost_system error_code.cpp ) -deal_ii_add_library(obj_boost_system OBJECT ${src_boost_system}) +define_object_library(bundled_boost_system OBJECT ${src_boost_system}) diff --git a/bundled/kokkos-3.7.00/CMakeLists.txt b/bundled/kokkos-3.7.00/CMakeLists.txt index 964f8f5fba..5c225804a5 100644 --- a/bundled/kokkos-3.7.00/CMakeLists.txt +++ b/bundled/kokkos-3.7.00/CMakeLists.txt @@ -69,4 +69,4 @@ enable_if_supported(DEAL_II_CXX_FLAGS -Wno-missing-field-initializers) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-suggest-override) enable_if_supported(DEAL_II_CXX_FLAGS -Wno-unused-but-set-parameter) -deal_ii_add_library(obj_kokkos OBJECT ${src_kokkos}) +define_object_library(bundled_kokkos OBJECT ${src_kokkos}) diff --git a/bundled/muparser_v2_3_3/CMakeLists.txt b/bundled/muparser_v2_3_3/CMakeLists.txt index 5a3139bd11..7ab7c80942 100644 --- a/bundled/muparser_v2_3_3/CMakeLists.txt +++ b/bundled/muparser_v2_3_3/CMakeLists.txt @@ -28,7 +28,7 @@ include_directories( include/ ) -deal_ii_add_library(obj_muparser OBJECT +define_object_library(bundled_muparser OBJECT src/muParserBase.cpp src/muParserBytecode.cpp src/muParserCallback.cpp diff --git a/bundled/tbb-2018_U2/src/CMakeLists.txt b/bundled/tbb-2018_U2/src/CMakeLists.txt index 9a9310102f..7a9b9204c6 100644 --- a/bundled/tbb-2018_U2/src/CMakeLists.txt +++ b/bundled/tbb-2018_U2/src/CMakeLists.txt @@ -89,14 +89,14 @@ set(src_tbb tbb/tbb_thread.cpp tbb/x86_rtm_rw_mutex.cpp ) -deal_ii_add_library(obj_tbb OBJECT ${src_tbb}) +define_object_library(bundled_tbb OBJECT ${src_tbb}) # # Add necessary definitions: # -deal_ii_add_definitions(obj_tbb "__TBB_BUILD=1") -deal_ii_add_definitions(obj_tbb "USE_PTHREAD") +deal_ii_add_definitions(bundled_tbb "__TBB_BUILD=1") +deal_ii_add_definitions(bundled_tbb "USE_PTHREAD") if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") - deal_ii_add_definitions(obj_tbb "DO_ITT_NOTIFY") + deal_ii_add_definitions(bundled_tbb "DO_ITT_NOTIFY") endif() diff --git a/bundled/umfpack/AMD/Source/CMakeLists.txt b/bundled/umfpack/AMD/Source/CMakeLists.txt index d3c3c5eff9..1a9fac9a5a 100644 --- a/bundled/umfpack/AMD/Source/CMakeLists.txt +++ b/bundled/umfpack/AMD/Source/CMakeLists.txt @@ -30,11 +30,11 @@ set(src_amd amd_valid.cc ) -deal_ii_add_library(obj_amd_int OBJECT ${src_amd}) -deal_ii_add_definitions(obj_amd_int "DINT") +define_object_library(bundled_amd_int OBJECT ${src_amd}) +deal_ii_add_definitions(bundled_amd_int "DINT") -deal_ii_add_library(obj_amd_long OBJECT ${src_amd}) -deal_ii_add_definitions(obj_amd_long "DLONG") +define_object_library(bundled_amd_long OBJECT ${src_amd}) +deal_ii_add_definitions(bundled_amd_long "DLONG") -deal_ii_add_library(obj_amd_global OBJECT "amd_global.cc") +define_object_library(bundled_amd_global OBJECT "amd_global.cc") diff --git a/bundled/umfpack/UMFPACK/Source/CMakeLists.txt b/bundled/umfpack/UMFPACK/Source/CMakeLists.txt index 6ffffa611e..2c697053ee 100644 --- a/bundled/umfpack/UMFPACK/Source/CMakeLists.txt +++ b/bundled/umfpack/UMFPACK/Source/CMakeLists.txt @@ -355,17 +355,17 @@ set(src_umfpack_GENERIC #------------------------------------------------------------------------------- # Do what the GNUmakefile calls the DI targets: -deal_ii_add_library(obj_umfpack_L_UMF OBJECT ${src_umfpack_DL_AND_ZL}) -deal_ii_add_definitions(obj_umfpack_L_UMF "DLONG") +define_object_library(bundled_umfpack_L_UMF OBJECT ${src_umfpack_DL_AND_ZL}) +deal_ii_add_definitions(bundled_umfpack_L_UMF "DLONG") # Repeat these steps for complex-valued matrices. This corresponds to # the ZL targets: -deal_ii_add_library(obj_umfpack_Z_UMF OBJECT ${src_umfpack_DL_AND_ZL}) -deal_ii_add_definitions(obj_umfpack_Z_UMF "ZLONG") +define_object_library(bundled_umfpack_Z_UMF OBJECT ${src_umfpack_DL_AND_ZL}) +deal_ii_add_definitions(bundled_umfpack_Z_UMF "ZLONG") # Do what the GNUmakefile calls the LL targets: -deal_ii_add_library(obj_umfpack_L_UMFPACK OBJECT ${src_umfpack_LL}) -deal_ii_add_definitions(obj_umfpack_L_UMFPACK "DLONG") +define_object_library(bundled_umfpack_L_UMFPACK OBJECT ${src_umfpack_LL}) +deal_ii_add_definitions(bundled_umfpack_L_UMFPACK "DLONG") #------------------------------------------------------------------------------- @@ -373,58 +373,58 @@ deal_ii_add_definitions(obj_umfpack_L_UMFPACK "DLONG") # version. #------------------------------------------------------------------------------- -deal_ii_add_library(obj_umfpack_DL_TSOLVE OBJECT umf_ltsolve.cc umf_utsolve.cc) -deal_ii_add_definitions(obj_umfpack_DL_TSOLVE "DLONG" "CONJUGATE_SOLVE") +define_object_library(bundled_umfpack_DL_TSOLVE OBJECT umf_ltsolve.cc umf_utsolve.cc) +deal_ii_add_definitions(bundled_umfpack_DL_TSOLVE "DLONG" "CONJUGATE_SOLVE") -deal_ii_add_library(obj_umfpack_DL_TRIPLET_MAP_NOX OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_DL_TRIPLET_MAP_NOX "DLONG" "DO_MAP") +define_object_library(bundled_umfpack_DL_TRIPLET_MAP_NOX OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_DL_TRIPLET_MAP_NOX "DLONG" "DO_MAP") -deal_ii_add_library(obj_umfpack_DL_TRIPLET_MAP_X OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_DL_TRIPLET_MAP_X "DLONG" "DO_MAP" "DO_VALUES") +define_object_library(bundled_umfpack_DL_TRIPLET_MAP_X OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_DL_TRIPLET_MAP_X "DLONG" "DO_MAP" "DO_VALUES") -deal_ii_add_library(obj_umfpack_DL_TRIPLET_NOMAP_X OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_DL_TRIPLET_NOMAP_X "DLONG" "DO_VALUES") +define_object_library(bundled_umfpack_DL_TRIPLET_NOMAP_X OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_DL_TRIPLET_NOMAP_X "DLONG" "DO_VALUES") -deal_ii_add_library(obj_umfpack_DL_TRIPLET_NOMAP_NOX OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_DL_TRIPLET_NOMAP_NOX "DLONG") +define_object_library(bundled_umfpack_DL_TRIPLET_NOMAP_NOX OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_DL_TRIPLET_NOMAP_NOX "DLONG") -deal_ii_add_library(obj_umfpack_DL_STORE OBJECT umf_store_lu.cc) -deal_ii_add_definitions(obj_umfpack_DL_STORE "DLONG" "DROP") +define_object_library(bundled_umfpack_DL_STORE OBJECT umf_store_lu.cc) +deal_ii_add_definitions(bundled_umfpack_DL_STORE "DLONG" "DROP") -deal_ii_add_library(obj_umfpack_DL_ASSEMBLE OBJECT umf_assemble.cc) -deal_ii_add_definitions(obj_umfpack_DL_ASSEMBLE "DLONG" "FIXQ") +define_object_library(bundled_umfpack_DL_ASSEMBLE OBJECT umf_assemble.cc) +deal_ii_add_definitions(bundled_umfpack_DL_ASSEMBLE "DLONG" "FIXQ") -deal_ii_add_library(obj_umfpack_DL_SOLVE OBJECT umfpack_solve.cc) -deal_ii_add_definitions(obj_umfpack_DL_SOLVE "DLONG" "WSOLVE") +define_object_library(bundled_umfpack_DL_SOLVE OBJECT umfpack_solve.cc) +deal_ii_add_definitions(bundled_umfpack_DL_SOLVE "DLONG" "WSOLVE") # Again with complex arguments: -deal_ii_add_library(obj_umfpack_ZL_TSOLVE OBJECT umf_ltsolve.cc umf_utsolve.cc) -deal_ii_add_definitions(obj_umfpack_ZL_TSOLVE "ZLONG" "CONJUGATE_SOLVE") +define_object_library(bundled_umfpack_ZL_TSOLVE OBJECT umf_ltsolve.cc umf_utsolve.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_TSOLVE "ZLONG" "CONJUGATE_SOLVE") -deal_ii_add_library(obj_umfpack_ZL_TRIPLET_MAP_NOX OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_ZL_TRIPLET_MAP_NOX "ZLONG" "DO_MAP") +define_object_library(bundled_umfpack_ZL_TRIPLET_MAP_NOX OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_TRIPLET_MAP_NOX "ZLONG" "DO_MAP") -deal_ii_add_library(obj_umfpack_ZL_TRIPLET_MAP_X OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_ZL_TRIPLET_MAP_X "ZLONG" "DO_MAP" "DO_VALUES") +define_object_library(bundled_umfpack_ZL_TRIPLET_MAP_X OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_TRIPLET_MAP_X "ZLONG" "DO_MAP" "DO_VALUES") -deal_ii_add_library(obj_umfpack_ZL_TRIPLET_NOMAP_X OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_ZL_TRIPLET_NOMAP_X "ZLONG" "DO_VALUES") +define_object_library(bundled_umfpack_ZL_TRIPLET_NOMAP_X OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_TRIPLET_NOMAP_X "ZLONG" "DO_VALUES") -deal_ii_add_library(obj_umfpack_ZL_TRIPLET_NOMAP_NOX OBJECT umf_triplet.cc) -deal_ii_add_definitions(obj_umfpack_ZL_TRIPLET_NOMAP_NOX "ZLONG") +define_object_library(bundled_umfpack_ZL_TRIPLET_NOMAP_NOX OBJECT umf_triplet.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_TRIPLET_NOMAP_NOX "ZLONG") -deal_ii_add_library(obj_umfpack_ZL_STORE OBJECT umf_store_lu.cc) -deal_ii_add_definitions(obj_umfpack_ZL_STORE "ZLONG" "DROP") +define_object_library(bundled_umfpack_ZL_STORE OBJECT umf_store_lu.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_STORE "ZLONG" "DROP") -deal_ii_add_library(obj_umfpack_ZL_ASSEMBLE OBJECT umf_assemble.cc) -deal_ii_add_definitions(obj_umfpack_ZL_ASSEMBLE "ZLONG" "FIXQ") +define_object_library(bundled_umfpack_ZL_ASSEMBLE OBJECT umf_assemble.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_ASSEMBLE "ZLONG" "FIXQ") -deal_ii_add_library(obj_umfpack_ZL_SOLVE OBJECT umfpack_solve.cc) -deal_ii_add_definitions(obj_umfpack_ZL_SOLVE "ZLONG" "WSOLVE") +define_object_library(bundled_umfpack_ZL_SOLVE OBJECT umfpack_solve.cc) +deal_ii_add_definitions(bundled_umfpack_ZL_SOLVE "ZLONG" "WSOLVE") #------------------------------------------------------------------------------- # Create the generic routines (GN) using a generic rule #------------------------------------------------------------------------------- -deal_ii_add_library(obj_umfpack_GENERIC OBJECT ${src_umfpack_GENERIC}) +define_object_library(bundled_umfpack_GENERIC OBJECT ${src_umfpack_GENERIC}) diff --git a/cmake/macros/macro_configure_feature.cmake b/cmake/macros/macro_configure_feature.cmake index c1080faeb6..7587eaf044 100644 --- a/cmake/macros/macro_configure_feature.cmake +++ b/cmake/macros/macro_configure_feature.cmake @@ -250,6 +250,7 @@ macro(configure_feature _feature) endif() define_interface_target(${_feature}) + message(STATUS "") message(STATUS "DEAL_II_WITH_${_feature} successfully set up with external dependencies.") set(FEATURE_${_feature}_EXTERNAL_CONFIGURED TRUE) set_cached_option(${_feature} ON) @@ -263,6 +264,7 @@ macro(configure_feature _feature) if(FEATURE_${_feature}_HAVE_BUNDLED AND DEAL_II_ALLOW_BUNDLED) evaluate_expression("feature_${_feature}_configure_bundled()") + message(STATUS "") message(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.") set(DEAL_II_FEATURE_${_feature}_BUNDLED_CONFIGURED TRUE) set_cached_option(${_feature} ON) diff --git a/cmake/macros/macro_deal_ii_add_definitions.cmake b/cmake/macros/macro_deal_ii_add_definitions.cmake index c306c9c219..19e8f192cd 100644 --- a/cmake/macros/macro_deal_ii_add_definitions.cmake +++ b/cmake/macros/macro_deal_ii_add_definitions.cmake @@ -15,7 +15,7 @@ # # A small wrapper around -# SET_TARget_property(... PROPERTIES COMPILE_DEFINITIONS ...) +# set_target_property(... PROPERTIES COMPILE_DEFINITIONS ...) # to _add_ compile definitions to every target we have specified. # diff --git a/cmake/macros/macro_deal_ii_add_library.cmake b/cmake/macros/macro_deal_ii_add_library.cmake deleted file mode 100644 index 7f4c657bf3..0000000000 --- a/cmake/macros/macro_deal_ii_add_library.cmake +++ /dev/null @@ -1,66 +0,0 @@ -## --------------------------------------------------------------------- -## -## Copyright (C) 2012 - 2018 by the deal.II authors -## -## This file is part of the deal.II library. -## -## The deal.II library is free software; you can use it, redistribute -## it, and/or modify it under the terms of the GNU Lesser General -## Public License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## The full text of the license can be found in the file LICENSE.md at -## the top level directory of deal.II. -## -## --------------------------------------------------------------------- - -# -# A small wrapper around ADD_LIBRARY that will define a target for each -# build type specified in DEAL_II_BUILD_TYPES. Only compatible with object -# targets (as used in the build system). -# -# It is assumed that the desired compilation configuration is set via -# DEAL_II_CXX_FLAGS_${build} -# DEAL_II_DEFINITIONS_${build} -# -# as well as the global (for all build types) -# DEAL_II_CXX_FLAGS -# DEAL_II_DEFINITIONS -# - -macro(deal_ii_add_library _library) - - foreach(_build ${DEAL_II_BUILD_TYPES}) - string(TOLOWER ${_build} _build_lowercase) - - add_library(${_library}_${_build_lowercase} - ${ARGN} - ) - - set_target_properties(${_library}_${_build_lowercase} PROPERTIES - LINKER_LANGUAGE "CXX" - ) - - set(_flags "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}") - - # Make sure some CUDA warning flags don't get deduplicated - string(REGEX REPLACE "(-Xcudafe --diag_suppress=[^ ]+)" "\"SHELL:\\1\"" _flags ${_flags}) - - separate_arguments(_flags UNIX_COMMAND ${_flags}) - - target_compile_options(${_library}_${_build_lowercase} PUBLIC ${_flags}) - - target_compile_definitions(${_library}_${_build_lowercase} - PUBLIC ${DEAL_II_DEFINITIONS} ${DEAL_II_DEFINITIONS_${_build}} - ) - - target_include_directories(${_library}_${_build_lowercase} - PUBLIC ${DEAL_II_INCLUDE_DIRS}) - target_include_directories(${_library}_${_build_lowercase} - SYSTEM PUBLIC ${DEAL_II_BUNDLED_INCLUDE_DIRS}) - - set_property(GLOBAL APPEND PROPERTY DEAL_II_OBJECTS_${_build} - "$" - ) - endforeach() - -endmacro() diff --git a/cmake/macros/macro_define_object_target.cmake b/cmake/macros/macro_define_object_target.cmake new file mode 100644 index 0000000000..f64939fd11 --- /dev/null +++ b/cmake/macros/macro_define_object_target.cmake @@ -0,0 +1,77 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2012 - 2018 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + +# +# define_object_target() +# +# A small wrapper around add_library that will define a target for each +# build type specified in DEAL_II_BUILD_TYPES. The specified library name +# must start with either object_ or bundled_. +# +# The function automatically "links" all object targets to the interface +# targets specified in DEAL_II_TARGETS and DEAL_II_TARGETS_(BUILD|RELEASE). +# The scope is PUBLIC so that properties of the interface targets propagate +# to the final shared library targets. +# +# In addition, if the library name is of the form "object_*" then all +# bundled targets are added to the "link" interface as well. The scope is +# private. +# + +function(define_object_library _library) + + if(NOT "${_library}" MATCHES "^object_" AND NOT "${_library}" MATCHES "^bundled_") + message(FATAL_ERROR + "Internal error: The specified target name must begin with object_ " + "or bundled_. Encountered: ${_library}" + ) + endif() + + foreach(_build ${DEAL_II_BUILD_TYPES}) + string(TOLOWER ${_build} _build_lowercase) + + add_library(${_library}_${_build_lowercase} ${ARGN}) + + set_target_properties(${_library}_${_build_lowercase} PROPERTIES + LINKER_LANGUAGE "CXX" + ) + + target_link_libraries(${_library}_${_build_lowercase} + PUBLIC ${DEAL_II_TARGETS} ${DEAL_II_TARGETS_${_build}} + ) + + if("${_library}" MATCHES "^bundled_") + # + # Record all bundled object libraries in the global property + # DEAL_II_BUNDLED_TARGETS_${_build} + # + set_property(GLOBAL APPEND PROPERTY DEAL_II_BUNDLED_TARGETS_${_build} + ${_library}_${_build_lowercase} + ) + else() + get_property(_bundled_object_targets + GLOBAL PROPERTY DEAL_II_BUNDLED_TARGETS_${build} + ) + target_link_libraries(${_library}_${_build_lowercase} + PRIVATE ${_bundled_object_targets} + ) + endif() + + set_property(GLOBAL APPEND PROPERTY DEAL_II_OBJECT_TARGETS_${_build} + ${_library}_${_build_lowercase} + ) + endforeach() + +endfunction() diff --git a/source/algorithms/CMakeLists.txt b/source/algorithms/CMakeLists.txt index d38d501474..eb1c12e2b2 100644 --- a/source/algorithms/CMakeLists.txt +++ b/source/algorithms/CMakeLists.txt @@ -29,5 +29,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/algorithms/*.h ) -deal_ii_add_library(obj_algorithms OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_algorithms "${_inst}") +define_object_library(object_algorithms OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_algorithms "${_inst}") diff --git a/source/arborx/CMakeLists.txt b/source/arborx/CMakeLists.txt index 65c200bf58..fc2c709f9f 100644 --- a/source/arborx/CMakeLists.txt +++ b/source/arborx/CMakeLists.txt @@ -27,5 +27,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/arborx/*.h ) -deal_ii_add_library(obj_arborx OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_arborx "${_inst}") +define_object_library(object_arborx OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_arborx "${_inst}") diff --git a/source/base/CMakeLists.txt b/source/base/CMakeLists.txt index 1768b520be..ed6baf880c 100644 --- a/source/base/CMakeLists.txt +++ b/source/base/CMakeLists.txt @@ -155,7 +155,7 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/base/*.h ) -deal_ii_add_library(obj_base OBJECT ${_src} ${_header} ${_inst} +define_object_library(object_base OBJECT ${_src} ${_header} ${_inst} ${CMAKE_BINARY_DIR}/include/deal.II/base/config.h ) -expand_instantiations(obj_base "${_inst}") +expand_instantiations(object_base "${_inst}") diff --git a/source/cgal/CMakeLists.txt b/source/cgal/CMakeLists.txt index c47b4e5bab..8898bc44a1 100644 --- a/source/cgal/CMakeLists.txt +++ b/source/cgal/CMakeLists.txt @@ -33,5 +33,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/cgal/*.h ) -deal_ii_add_library(obj_cgal OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_cgal "${_inst}") +define_object_library(object_cgal OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_cgal "${_inst}") diff --git a/source/differentiation/ad/CMakeLists.txt b/source/differentiation/ad/CMakeLists.txt index 92861074f7..f0d77650e0 100644 --- a/source/differentiation/ad/CMakeLists.txt +++ b/source/differentiation/ad/CMakeLists.txt @@ -38,5 +38,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/differentiation/ad/*.h ) -deal_ii_add_library(obj_differentiation_ad OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_differentiation_ad "${_inst}") +define_object_library(object_differentiation_ad OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_differentiation_ad "${_inst}") diff --git a/source/differentiation/sd/CMakeLists.txt b/source/differentiation/sd/CMakeLists.txt index 5de96d1ca6..a545a01a6f 100644 --- a/source/differentiation/sd/CMakeLists.txt +++ b/source/differentiation/sd/CMakeLists.txt @@ -36,5 +36,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/differentiation/sd/*.h ) -deal_ii_add_library(obj_differentiation_sd OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_differentiation_sd "${_inst}") +define_object_library(object_differentiation_sd OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_differentiation_sd "${_inst}") diff --git a/source/distributed/CMakeLists.txt b/source/distributed/CMakeLists.txt index 1964c91bb8..86a2350fd7 100644 --- a/source/distributed/CMakeLists.txt +++ b/source/distributed/CMakeLists.txt @@ -59,5 +59,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/distributed/*.h ) -deal_ii_add_library(obj_distributed OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_distributed "${_inst}") +define_object_library(object_distributed OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_distributed "${_inst}") diff --git a/source/dofs/CMakeLists.txt b/source/dofs/CMakeLists.txt index 14d583940a..aa49031970 100644 --- a/source/dofs/CMakeLists.txt +++ b/source/dofs/CMakeLists.txt @@ -61,5 +61,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/dofs/*.h ) -deal_ii_add_library(obj_dofs OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_dofs "${_inst}") +define_object_library(object_dofs OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_dofs "${_inst}") diff --git a/source/fe/CMakeLists.txt b/source/fe/CMakeLists.txt index 776c82fe45..7f88c1771d 100644 --- a/source/fe/CMakeLists.txt +++ b/source/fe/CMakeLists.txt @@ -150,5 +150,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/fe/*.h ) -deal_ii_add_library(obj_fe OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_fe "${_inst}") +define_object_library(object_fe OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_fe "${_inst}") diff --git a/source/gmsh/CMakeLists.txt b/source/gmsh/CMakeLists.txt index 66d853f3a3..270faa21ff 100644 --- a/source/gmsh/CMakeLists.txt +++ b/source/gmsh/CMakeLists.txt @@ -27,5 +27,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/gmsh/*.h ) -deal_ii_add_library(obj_gmsh OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_gmsh "${_inst}") +define_object_library(object_gmsh OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_gmsh "${_inst}") diff --git a/source/grid/CMakeLists.txt b/source/grid/CMakeLists.txt index 079d416ea6..6d2a964169 100644 --- a/source/grid/CMakeLists.txt +++ b/source/grid/CMakeLists.txt @@ -97,5 +97,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/grid/*.h ) -deal_ii_add_library(obj_grid OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_grid "${_inst}") +define_object_library(object_grid OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_grid "${_inst}") diff --git a/source/hp/CMakeLists.txt b/source/hp/CMakeLists.txt index 0f310715af..e7544c3aa1 100644 --- a/source/hp/CMakeLists.txt +++ b/source/hp/CMakeLists.txt @@ -45,5 +45,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/hp/*.h ) -deal_ii_add_library(obj_hp OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_hp "${_inst}") +define_object_library(object_hp OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_hp "${_inst}") diff --git a/source/integrators/CMakeLists.txt b/source/integrators/CMakeLists.txt index e0381dde06..5804c13ab3 100644 --- a/source/integrators/CMakeLists.txt +++ b/source/integrators/CMakeLists.txt @@ -22,4 +22,4 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/integrators/*.h ) -deal_ii_add_library(obj_integrators OBJECT ${_src} ${_header}) +define_object_library(object_integrators OBJECT ${_src} ${_header}) diff --git a/source/lac/CMakeLists.txt b/source/lac/CMakeLists.txt index da74b1d615..d1b9568113 100644 --- a/source/lac/CMakeLists.txt +++ b/source/lac/CMakeLists.txt @@ -192,5 +192,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/lac/*.h ) -deal_ii_add_library(obj_lac OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_lac "${_inst}") +define_object_library(object_lac OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_lac "${_inst}") diff --git a/source/matrix_free/CMakeLists.txt b/source/matrix_free/CMakeLists.txt index 4002f809d2..e0297cfc36 100644 --- a/source/matrix_free/CMakeLists.txt +++ b/source/matrix_free/CMakeLists.txt @@ -64,5 +64,5 @@ if(DEAL_II_WITH_CUDA) ) endif() -deal_ii_add_library(obj_matrix_free OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_matrix_free "${_inst}") +define_object_library(object_matrix_free OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_matrix_free "${_inst}") diff --git a/source/meshworker/CMakeLists.txt b/source/meshworker/CMakeLists.txt index dd31a12d2a..d541931787 100644 --- a/source/meshworker/CMakeLists.txt +++ b/source/meshworker/CMakeLists.txt @@ -32,5 +32,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/meshworker/*.h ) -deal_ii_add_library(obj_meshworker OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_meshworker "${_inst}") +define_object_library(object_meshworker OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_meshworker "${_inst}") diff --git a/source/multigrid/CMakeLists.txt b/source/multigrid/CMakeLists.txt index bd11cf289f..6c8bf3ec56 100644 --- a/source/multigrid/CMakeLists.txt +++ b/source/multigrid/CMakeLists.txt @@ -57,5 +57,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/multigrid/*.h ) -deal_ii_add_library(obj_multigrid OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_multigrid "${_inst}") +define_object_library(object_multigrid OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_multigrid "${_inst}") diff --git a/source/non_matching/CMakeLists.txt b/source/non_matching/CMakeLists.txt index 10385cb64a..6b7837b127 100644 --- a/source/non_matching/CMakeLists.txt +++ b/source/non_matching/CMakeLists.txt @@ -36,5 +36,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/non_matching/*.h ) -deal_ii_add_library(obj_non_matching OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_non_matching "${_inst}") +define_object_library(object_non_matching OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_non_matching "${_inst}") diff --git a/source/numerics/CMakeLists.txt b/source/numerics/CMakeLists.txt index b3f277c35c..f8f61fdd33 100644 --- a/source/numerics/CMakeLists.txt +++ b/source/numerics/CMakeLists.txt @@ -112,5 +112,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/numerics/*.h ) -deal_ii_add_library(obj_numerics OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_numerics "${_inst}") +define_object_library(object_numerics OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_numerics "${_inst}") diff --git a/source/opencascade/CMakeLists.txt b/source/opencascade/CMakeLists.txt index 444da92ddf..a5b03c3db6 100644 --- a/source/opencascade/CMakeLists.txt +++ b/source/opencascade/CMakeLists.txt @@ -29,5 +29,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/opencascade/*.h ) -deal_ii_add_library(obj_opencascade OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_opencascade "${_inst}") +define_object_library(object_opencascade OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_opencascade "${_inst}") diff --git a/source/optimization/rol/CMakeLists.txt b/source/optimization/rol/CMakeLists.txt index 4c08aa314d..f826d7ee3a 100644 --- a/source/optimization/rol/CMakeLists.txt +++ b/source/optimization/rol/CMakeLists.txt @@ -25,5 +25,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/optimization/rol/*.h ) -deal_ii_add_library(obj_rol OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_rol "${_inst}") +define_object_library(object_rol OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_rol "${_inst}") diff --git a/source/particles/CMakeLists.txt b/source/particles/CMakeLists.txt index c01bc32183..30a8b472d6 100644 --- a/source/particles/CMakeLists.txt +++ b/source/particles/CMakeLists.txt @@ -37,5 +37,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/particles/*.h ) -deal_ii_add_library(obj_particle OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_particle "${_inst}") +define_object_library(object_particle OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_particle "${_inst}") diff --git a/source/physics/CMakeLists.txt b/source/physics/CMakeLists.txt index 2288388548..79eab43f6f 100644 --- a/source/physics/CMakeLists.txt +++ b/source/physics/CMakeLists.txt @@ -30,5 +30,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/physics/*.h ) -deal_ii_add_library(obj_physics OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_physics "${_inst}") +define_object_library(object_physics OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_physics "${_inst}") diff --git a/source/physics/elasticity/CMakeLists.txt b/source/physics/elasticity/CMakeLists.txt index e1774024a5..4ebcd18f61 100644 --- a/source/physics/elasticity/CMakeLists.txt +++ b/source/physics/elasticity/CMakeLists.txt @@ -30,5 +30,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/physics/elasticity/*.h ) -deal_ii_add_library(obj_physics_elasticity OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_physics_elasticity "${_inst}") +define_object_library(object_physics_elasticity OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_physics_elasticity "${_inst}") diff --git a/source/sundials/CMakeLists.txt b/source/sundials/CMakeLists.txt index 06b4d08143..3c3c5450e6 100644 --- a/source/sundials/CMakeLists.txt +++ b/source/sundials/CMakeLists.txt @@ -32,5 +32,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/sundials/*.h ) -deal_ii_add_library(obj_sundials OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_sundials "${_inst}") +define_object_library(object_sundials OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_sundials "${_inst}") diff --git a/source/trilinos/CMakeLists.txt b/source/trilinos/CMakeLists.txt index 021ecd072e..06024f482c 100644 --- a/source/trilinos/CMakeLists.txt +++ b/source/trilinos/CMakeLists.txt @@ -27,5 +27,5 @@ file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/trilinos/*.h ) -deal_ii_add_library(obj_trilinos OBJECT ${_src} ${_header} ${_inst}) -expand_instantiations(obj_trilinos "${_inst}") +define_object_library(object_trilinos OBJECT ${_src} ${_header} ${_inst}) +expand_instantiations(object_trilinos "${_inst}") -- 2.39.5