From da0c6c50a28b5b5543606547db403ede85106166 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 4 Feb 2025 20:44:41 -0700 Subject: [PATCH] Exclude files from compiling if they are functionally empty. --- source/arborx/CMakeLists.txt | 22 ++++++++---- source/base/CMakeLists.txt | 18 ++++++++-- source/differentiation/ad/CMakeLists.txt | 33 +++++++++++++++--- source/differentiation/sd/CMakeLists.txt | 36 +++++++++++--------- source/distributed/CMakeLists.txt | 43 +++++++++++++++--------- source/lac/CMakeLists.txt | 14 ++++++-- source/trilinos/CMakeLists.txt | 21 ++++++++---- 7 files changed, 136 insertions(+), 51 deletions(-) diff --git a/source/arborx/CMakeLists.txt b/source/arborx/CMakeLists.txt index c57d758005..18278b5913 100644 --- a/source/arborx/CMakeLists.txt +++ b/source/arborx/CMakeLists.txt @@ -12,13 +12,23 @@ ## ## ------------------------------------------------------------------------ -set(_src - access_traits.cc - ) -set(_inst - access_traits.inst.in - ) + +set(_src) +set(_inst) + +if(DEAL_II_WITH_ARBORX) + set(_src + ${_src} + access_traits.cc + ) + + set(_inst + ${_inst} + access_traits.inst.in + ) +endif() + file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/arborx/*.h diff --git a/source/base/CMakeLists.txt b/source/base/CMakeLists.txt index 6fa4cc3f9e..9b827593cb 100644 --- a/source/base/CMakeLists.txt +++ b/source/base/CMakeLists.txt @@ -46,7 +46,6 @@ set(_unity_include_src index_set.cc job_identifier.cc logstream.cc - hdf5.cc kokkos.cc mpi.cc mpi_noncontiguous_partitioner.cc @@ -82,7 +81,6 @@ set(_unity_include_src polynomials_raviart_thomas.cc polynomials_rt_bubbles.cc polynomials_wedge.cc - process_grid.cc qprojector.cc quadrature.cc quadrature_lib.cc @@ -109,6 +107,21 @@ set(_separate_src symmetric_tensor.cc ) +if(DEAL_II_WITH_SCALAPACK) + set(_unity_include_src + ${_unity_include_src} + process_grid.cc + ) +endif() + +if(DEAL_II_WITH_HDF5) + set(_unity_include_src + ${_unity_include_src} + hdf5.cc + ) +endif() + + # determined by profiling set(_n_includes_per_unity_file 29) @@ -141,6 +154,7 @@ set(_inst time_stepping.inst.in ) + file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/base/*.h ) diff --git a/source/differentiation/ad/CMakeLists.txt b/source/differentiation/ad/CMakeLists.txt index f978c5a6eb..5a5fb5ea7c 100644 --- a/source/differentiation/ad/CMakeLists.txt +++ b/source/differentiation/ad/CMakeLists.txt @@ -15,8 +15,6 @@ set(_src ad_drivers.cc ad_helpers.cc - adolc_number_types.cc - sacado_number_types.cc ) set(_inst @@ -26,11 +24,36 @@ set(_inst ad_helpers.inst.in ad_helpers.inst1.in ad_helpers.inst2.in - adolc_number_types.inst.in - sacado_number_types.inst1.in - sacado_number_types.inst2.in ) + +if(DEAL_II_WITH_ADOLC) + set(_src + ${_src} + adolc_number_types.cc + ) + + set(_inst + ${_inst} + adolc_number_types.inst.in + ) +endif() + + +if(DEAL_II_TRILINOS_WITH_SACADO) + set(_src + ${_src} + sacado_number_types.cc + ) + + set(_inst + ${_inst} + sacado_number_types.inst1.in + sacado_number_types.inst2.in + ) +endif() + + file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/differentiation/ad/*.h ) diff --git a/source/differentiation/sd/CMakeLists.txt b/source/differentiation/sd/CMakeLists.txt index 9536ee4f05..f4b45801bf 100644 --- a/source/differentiation/sd/CMakeLists.txt +++ b/source/differentiation/sd/CMakeLists.txt @@ -12,22 +12,28 @@ ## ## ------------------------------------------------------------------------ -set(_src - symengine_math.cc - symengine_number_types.cc - symengine_number_visitor_internal.cc - symengine_optimizer.cc - symengine_scalar_operations.cc - symengine_tensor_operations.cc - symengine_types.cc - symengine_utilities.cc - ) +set(_src) +set(_inst) + +if(DEAL_II_WITH_SYMENGINE) + set(_src + symengine_math.cc + symengine_number_types.cc + symengine_number_visitor_internal.cc + symengine_optimizer.cc + symengine_scalar_operations.cc + symengine_tensor_operations.cc + symengine_types.cc + symengine_utilities.cc + ) + + set(_inst + symengine_number_visitor_internal.inst.in + symengine_optimizer.inst.in + symengine_tensor_operations.inst.in + ) +endif() -set(_inst - symengine_number_visitor_internal.inst.in - symengine_optimizer.inst.in - symengine_tensor_operations.inst.in - ) file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/differentiation/sd/*.h diff --git a/source/distributed/CMakeLists.txt b/source/distributed/CMakeLists.txt index 5eb431c6d3..70b6ac8a97 100644 --- a/source/distributed/CMakeLists.txt +++ b/source/distributed/CMakeLists.txt @@ -13,35 +13,20 @@ ## ------------------------------------------------------------------------ set(_unity_include_src - grid_refinement.cc cell_weights.cc - cell_data_transfer.cc fully_distributed_tria.cc repartitioning_policy_tools.cc tria.cc tria_base.cc shared_tria.cc p4est_wrappers.cc - field_transfer.cc ) set(_separate_src ) -# concatenate all unity inclusion files in one file -set(_n_includes_per_unity_file 15) - -setup_source_list("${_unity_include_src}" - "${_separate_src}" - ${_n_includes_per_unity_file} - _src - ) - set(_inst - grid_refinement.inst.in cell_weights.inst.in - cell_data_transfer.inst.in - field_transfer.inst.in fully_distributed_tria.inst.in repartitioning_policy_tools.inst.in tria.inst.in @@ -50,6 +35,34 @@ set(_inst p4est_wrappers.inst.in ) +if(DEAL_II_WITH_P4EST) + set(_unity_include_src + ${_unity_include_src} + grid_refinement.cc + cell_data_transfer.cc + field_transfer.cc + ) + + set(_inst + ${_inst} + grid_refinement.inst.in + cell_data_transfer.inst.in + field_transfer.inst.in + ) +endif() + + +# concatenate all unity inclusion files in one file +set(_n_includes_per_unity_file 15) + +setup_source_list("${_unity_include_src}" + "${_separate_src}" + ${_n_includes_per_unity_file} + _src + ) + + + file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/distributed/*.h ) diff --git a/source/lac/CMakeLists.txt b/source/lac/CMakeLists.txt index aa320376f2..a98f55f752 100644 --- a/source/lac/CMakeLists.txt +++ b/source/lac/CMakeLists.txt @@ -22,7 +22,6 @@ set(_unity_include_src chunk_sparsity_pattern.cc dynamic_sparsity_pattern.cc exceptions.cc - scalapack.cc la_parallel_vector.cc la_parallel_block_vector.cc matrix_out.cc @@ -71,7 +70,6 @@ set(_inst petsc_communication_pattern.inst.in relaxation_block.inst.in read_write_vector.inst.in - scalapack.inst.in solver.inst.in solver_gmres.inst.in sparse_matrix_ez.inst.in @@ -159,6 +157,18 @@ if(DEAL_II_WITH_TRILINOS) ) endif() +if(DEAL_II_WITH_SCALAPACK) + set(_unity_include_src + ${_unity_include_src} + scalapack.cc + ) + set(_inst + ${_inst} + scalapack.inst.in + ) +endif() + + # determined by profiling set(_n_includes_per_unity_file 20) diff --git a/source/trilinos/CMakeLists.txt b/source/trilinos/CMakeLists.txt index 7ef4008649..ac12d97d2e 100644 --- a/source/trilinos/CMakeLists.txt +++ b/source/trilinos/CMakeLists.txt @@ -14,13 +14,22 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -set(_src - nox.cc - ) -set(_inst - nox.inst.in - ) +set(_src) +set(_inst) + +if(DEAL_II_TRILINOS_WITH_NOX) + set(_src + ${_src} + nox.cc + ) + + set(_inst + ${_inst} + nox.inst.in + ) +endif() + file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/trilinos/*.h -- 2.39.5