Files
FESADev/tests/CMakeLists.txt
T
2026-09-29 22:24:48 +09:00

240 lines
8.5 KiB
CMake

include(GoogleTest)
add_executable(
fesa_unit_tests
unit/build_info_test.cpp
unit/analysis/analysis_test.cpp
unit/analysis/analysis_model_test.cpp
unit/analysis/analysis_state_test.cpp
unit/analysis/dynamic_analysis_state_test.cpp
unit/analysis/eigen_reduction_test.cpp
unit/analysis/eigen_mass_assembly_test.cpp
unit/analysis/hht_time_integration_test.cpp
unit/analysis/hht_shell_physics_test.cpp
unit/analysis/hht_energy_verification_test.cpp
unit/analysis/hht_temporal_verification_test.cpp
unit/analysis/hht_dynamic_algebra_test.cpp
unit/analysis/hht_dynamic_procedure_test.cpp
unit/analysis/nonlinear_analysis_state_test.cpp
unit/analysis/nonlinear_static_control_test.cpp
unit/analysis/newton_iteration_log_test.cpp
unit/analysis/thermal_time_grid_test.cpp
unit/analysis/thermal_analysis_state_test.cpp
unit/analysis/transient_heat_procedure_test.cpp
unit/assembly/parallel_for_test.cpp
unit/assembly/load_assembler_test.cpp
unit/assembly/surface_pressure_assembler_test.cpp
unit/assembly/sparse_assembler_test.cpp
unit/assembly/thermal_assembler_test.cpp
unit/app/output_paths_test.cpp
unit/constraints/boundary_condition_test.cpp
unit/constraints/essential_constraints_test.cpp
unit/core/ascii_test.cpp
unit/core/diagnostic_test.cpp
unit/core/source_identity_test.cpp
unit/core/status_test.cpp
unit/elements/element_factory_test.cpp
unit/elements/euler_beam_3d_test.cpp
unit/elements/finite_rotation_test.cpp
unit/elements/mitc4_shell_test.cpp
unit/elements/mitc4_shell_mass_contract_test.cpp
unit/elements/nonlinear_mitc4_shell_test.cpp
unit/elements/nonlinear_mitc4_inertia_test.cpp
unit/elements/nonlinear_mitc4_shell_tangent_test.cpp
unit/elements/thermal_shell_test.cpp
unit/fem/dof_manager_test.cpp
unit/math/dense_blas_internal_test.cpp
unit/math/matrix_test.cpp
unit/math/sparse_matrix_test.cpp
unit/math/vector3_test.cpp
unit/math/vector_test.cpp
unit/io/abaqus/domain_mapping_components_test.cpp
unit/io/abaqus/domain_mapper_test.cpp
unit/io/abaqus/eigen_domain_test.cpp
unit/io/abaqus/hht_dynamic_domain_test.cpp
unit/io/abaqus/thermal_domain_test.cpp
unit/io/abaqus/input_reader_test.cpp
unit/io/abaqus/input_syntax_test.cpp
unit/io/abaqus/shell_surface_pressure_domain_test.cpp
unit/io/hdf5/hdf5_results_writer_test.cpp
unit/io/hdf5/dynamic_hdf5_results_writer_test.cpp
unit/io/hdf5/eigen_hdf5_results_writer_test.cpp
unit/io/hdf5/nonlinear_hdf5_results_writer_test.cpp
unit/io/hdf5/hdf5_writer_components_test.cpp
unit/io/hdf5/thermal_hdf5_results_writer_test.cpp
unit/loads/load_test.cpp
unit/loads/shell_surface_pressure_test.cpp
unit/model/domain_test.cpp
unit/model/thermal_semantics_test.cpp
unit/model/thermal_shell_geometry_test.cpp
unit/model/model_types_test.cpp
unit/model/shell_geometry_test.cpp
unit/model/source_target_resolver_test.cpp
unit/materials/material_test.cpp
unit/properties/element_property_test.cpp
unit/results/result_records_test.cpp
unit/results/result_recovery_components_test.cpp
unit/results/result_recovery_test.cpp
unit/results/results_writer_test.cpp
unit/solvers/eigen/mkl_feast_eigen_solver_test.cpp
unit/solvers/linear/linear_solver_test.cpp
unit/solvers/linear/mkl_pardiso_solver_test.cpp
unit/solvers/linear/tangent_solver_test.cpp
)
target_include_directories(
fesa_unit_tests
PRIVATE
"${PROJECT_SOURCE_DIR}/src/fesa"
)
target_link_libraries(
fesa_unit_tests
PRIVATE
fesa_solver
Fesa::HDF5
Fesa::MKL
GTest::gtest_main
)
add_executable(
fesa_integration_tests
integration/analysis/linear_static_analysis_test.cpp
integration/analysis/linear_frequency_procedure_test.cpp
integration/analysis/shell_surface_pressure_linear_test.cpp
integration/analysis/shell_surface_pressure_nonlinear_test.cpp
integration/analysis/nonlinear_static_procedure_test.cpp
integration/app/fesa_application_test.cpp
integration/app/eigen_application_test.cpp
integration/app/shell_surface_pressure_application_test.cpp
integration/app/thermal_application_test.cpp
)
add_dependencies(fesa_integration_tests fesa_cli)
target_link_libraries(
fesa_integration_tests
PRIVATE
fesa_solver
Fesa::HDF5
GTest::gtest_main
)
add_executable(
fesa_reference_tests
reference/reference_tolerance_policy.cpp
reference/eigen_reference_comparison.cpp
reference/eigen_reference_comparison_test.cpp
reference/eigen_reference_cases_test.cpp
reference/reference_tolerance_policy_test.cpp
reference/reference_comparison.cpp
reference/reference_comparison_test.cpp
reference/b33_reference_comparison_test.cpp
reference/mitc4_reference_comparison.cpp
reference/mitc4_reference_comparison_test.cpp
reference/mitc4_reference_cases_test.cpp
reference/nonlinear_static_reference_comparison.cpp
reference/nonlinear_static_reference_cases_test.cpp
reference/shell_surface_pressure_reference_test.cpp
)
target_link_libraries(
fesa_reference_tests
PRIVATE
fesa_solver
Fesa::HDF5
GTest::gtest_main
)
target_compile_definitions(
fesa_reference_tests
PRIVATE
FESA_TEST_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
FESA_TEST_BINARY_DIR="${PROJECT_BINARY_DIR}"
)
if(WIN32)
if(NOT TARGET MKL::mkl_intel_thread OR NOT TARGET MKL::mkl_core OR
NOT OMP_DLL_DIR OR NOT OMP_DLLNAME)
message(FATAL_ERROR "The oneMKL runtime files required by tests were not resolved")
endif()
if(NOT EXISTS "${OMP_DLL_DIR}/libmmd.dll")
message(FATAL_ERROR "The Intel runtime required by the selected HDF5 DLL was not resolved")
endif()
file(GLOB _fesa_mkl_dispatch_dlls "${MKL_ROOT}/bin/mkl_def.*.dll")
if(NOT _fesa_mkl_dispatch_dlls)
message(FATAL_ERROR "The oneMKL default dispatch runtime was not resolved")
endif()
list(SORT _fesa_mkl_dispatch_dlls COMPARE NATURAL ORDER DESCENDING)
list(GET _fesa_mkl_dispatch_dlls 0 _fesa_mkl_dispatch_dll)
function(fesa_stage_test_runtime target_name)
# Stage dynamic backend dependencies before post-build GoogleTest
# discovery; the exact validation commands do not assume oneAPI in PATH.
add_custom_command(
TARGET "${target_name}"
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"$<TARGET_FILE:TBB::tbb>"
"$<TARGET_FILE_DIR:${target_name}>"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"$<TARGET_FILE:MKL::mkl_intel_thread>"
"$<TARGET_FILE_DIR:${target_name}>"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"$<TARGET_FILE:MKL::mkl_core>"
"$<TARGET_FILE_DIR:${target_name}>"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${OMP_DLL_DIR}/${OMP_DLLNAME}"
"$<TARGET_FILE_DIR:${target_name}>"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${OMP_DLL_DIR}/libmmd.dll"
"$<TARGET_FILE_DIR:${target_name}>"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${_fesa_mkl_dispatch_dll}"
"$<TARGET_FILE_DIR:${target_name}>"
# Imported-target runtime closure includes the normalized HDF5 DLL.
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"$<TARGET_RUNTIME_DLLS:${target_name}>"
"$<TARGET_FILE_DIR:${target_name}>"
COMMAND_EXPAND_LISTS
)
endfunction()
fesa_stage_test_runtime(fesa_unit_tests)
fesa_stage_test_runtime(fesa_integration_tests)
fesa_stage_test_runtime(fesa_reference_tests)
unset(_fesa_mkl_dispatch_dll)
unset(_fesa_mkl_dispatch_dlls)
endif()
gtest_discover_tests(
fesa_unit_tests
DISCOVERY_MODE PRE_TEST
PROPERTIES
LABELS "linear-static-3d-euler-beam;unit"
)
gtest_discover_tests(
fesa_integration_tests
DISCOVERY_MODE PRE_TEST
PROPERTIES
LABELS "linear-static-3d-euler-beam;integration"
)
gtest_discover_tests(
fesa_reference_tests
DISCOVERY_MODE PRE_TEST
PROPERTIES
LABELS "linear-static-3d-euler-beam;reference"
)
add_custom_target(
fesa_tests
DEPENDS
fesa_unit_tests
fesa_integration_tests
fesa_reference_tests
)