22# Tests
33################################################################################
44
5- add_executable (ipc_toolkit_tests
6- main.cpp
7-
8- # Test barrier and dertivatives
9- barrier/test_barrier.cpp
10-
11- # Test candidates
12- candidates/test_candidates.cpp
13-
14- # Test CCD
15- broad_phase/benchmark_broad_phase.cpp
16- broad_phase/brute_force_comparison.cpp
17- broad_phase/test_aabb.cpp
18- broad_phase/test_broad_phase.cpp
19- broad_phase/test_spatial_hash.cpp
20- broad_phase/test_voxel_size_heuristic.cpp
21- ccd/benchmark_ccd.cpp
22- ccd/collision_generator.cpp
23- ccd/test_ccd.cpp
24- ccd/test_ccd_benchmark.cpp
25- ccd/test_point_point_ccd.cpp
26- ccd/test_point_edge_ccd.cpp
27- ccd/test_point_triangle_ccd.cpp
28- ccd/test_edge_edge_ccd.cpp
29- ccd/test_ccd.cpp
30- test_cfl.cpp
31-
32- # Test distances and dertivatives
33- distance/test_distance_type.cpp
34- distance/test_edge_edge.cpp
35- distance/test_line_line.cpp
36- distance/test_point_edge.cpp
37- distance/test_point_line.cpp
38- distance/test_point_plane.cpp
39- distance/test_point_point.cpp
40- distance/test_point_triangle.cpp
41-
42- # Test collision constraints
43- collisions/test_constraints.cpp
44-
45- # Test friction
46- friction/friction_data_generator.cpp
47- friction/test_closest_point.cpp
48- friction/test_force_jacobian.cpp
49- friction/test_friction.cpp
50- friction/test_normal_force_magnitude.cpp
51- friction/test_relative_velocity.cpp
52- friction/test_smooth_friction_mollifier.cpp
53- friction/test_tangent_basis.cpp
54-
55- # Test general interface
56- test_ipc.cpp
57- test_collision_mesh.cpp
58-
59- # Test intersection checks
60- test_has_intersections.cpp
61-
62- # Tes utility functions
63- test_utils.cpp
64-
65- # Utilities for tests
66- utils.cpp
67-
68- benchmark_eigen.cpp
69- )
70-
71- target_include_directories (ipc_toolkit_tests PUBLIC "." )
5+ include (CMakeDependentOption)
6+ cmake_dependent_option(IPC_TOOLKIT_TESTS_CCD_BENCHMARK "Enable CCD benchmark test" OFF "IPC_TOOLKIT_BUILD_TESTS" OFF )
7+ if (IPC_TOOLKIT_TESTS_CCD_BENCHMARK)
8+ mark_as_advanced (CLEAR IPC_TOOLKIT_TESTS_CCD_BENCHMARK_DIR)
9+ mark_as_advanced (CLEAR IPC_TOOLKIT_TESTS_NEW_CCD_BENCHMARK_DIR)
10+ set (IPC_TOOLKIT_TESTS_CCD_BENCHMARK_DIR "" CACHE PATH "Path to the CCD benchmark directory" )
11+ set (IPC_TOOLKIT_TESTS_NEW_CCD_BENCHMARK_DIR "" CACHE PATH "Path to the new CCD benchmark directory" )
12+ else ()
13+ mark_as_advanced (FORCE IPC_TOOLKIT_TESTS_CCD_BENCHMARK_DIR)
14+ mark_as_advanced (FORCE IPC_TOOLKIT_TESTS_NEW_CCD_BENCHMARK_DIR)
15+ endif ()
16+
17+ ### Configuration
18+ set (IPC_TOOLKIT_TESTS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /src/tests" )
19+ set (IPC_TOOLKIT_TESTS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /src" )
20+
21+ ### Data directory
22+ cmake_path(APPEND IPC_TOOLKIT_TESTS_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR} " "data" )
23+
24+ ################################################################################
25+ # IPC Toolkit Tests Executable
26+ ################################################################################
27+
28+ # Add an empty library and fill in the list of sources in `src/tests/CMakeLists.txt`.
29+ add_executable (ipc_toolkit_tests)
30+
31+ # Fill in configuration options
32+ configure_file (
33+ "${IPC_TOOLKIT_TESTS_SOURCE_DIR} /config.hpp.in"
34+ "${IPC_TOOLKIT_TESTS_SOURCE_DIR} /config.hpp" )
35+
36+ # Add source and header files to ipc_toolkit_tests
37+ add_subdirectory ("${IPC_TOOLKIT_TESTS_SOURCE_DIR} " )
38+
39+ # Public include directory for IPC Toolkit tests
40+ target_include_directories (ipc_toolkit_tests PUBLIC "${IPC_TOOLKIT_TESTS_INCLUDE_DIR} " )
7241
7342################################################################################
7443# Required Libraries
@@ -85,17 +54,14 @@ target_link_libraries(ipc_toolkit_tests PUBLIC finitediff::finitediff)
8554include (json)
8655target_link_libraries (ipc_toolkit_tests PUBLIC nlohmann_json::nlohmann_json)
8756
88- if (IPC_TOOLKIT_TEST_CCD_BENCHMARK )
57+ if (IPC_TOOLKIT_TESTS_CCD_BENCHMARK )
8958 include (ccd_query_io)
9059 target_link_libraries (ipc_toolkit_tests PUBLIC ccd_io::ccd_io)
91- target_compile_definitions (ipc_toolkit_tests PRIVATE IPC_TOOLKIT_TEST_CCD_BENCHMARK)
9260 if (NOT (IPC_TOOLKIT_CCD_BENCHMARK_DIR STREQUAL "" ))
9361 message (STATUS "Using CCD benchmark directory: ${IPC_TOOLKIT_CCD_BENCHMARK_DIR} " )
94- target_compile_definitions (ipc_toolkit_tests PRIVATE IPC_TOOLKIT_CCD_BENCHMARK_DIR="${IPC_TOOLKIT_CCD_BENCHMARK_DIR} " )
9562 endif ()
9663 if (NOT (IPC_TOOLKIT_CCD_NEW_BENCHMARK_DIR STREQUAL "" ))
9764 message (STATUS "Using new CCD benchmark directory: ${IPC_TOOLKIT_CCD_NEW_BENCHMARK_DIR} " )
98- target_compile_definitions (ipc_toolkit_tests PRIVATE IPC_TOOLKIT_CCD_NEW_BENCHMARK_DIR="${IPC_TOOLKIT_CCD_NEW_BENCHMARK_DIR} " )
9965 endif ()
10066endif ()
10167
@@ -114,13 +80,6 @@ target_link_libraries(ipc_toolkit_tests PRIVATE ipc::toolkit::warnings)
11480
11581target_compile_definitions (ipc_toolkit_tests PUBLIC CATCH_CONFIG_ENABLE_BENCHMARKING)
11682
117- # Test data directory definition
118- if (WIN32 )
119- target_compile_definitions (ipc_toolkit_tests PUBLIC TEST_DATA_DIR_CSTR="${CMAKE_CURRENT_SOURCE_DIR} \\\\ data\\\\ " )
120- else ()
121- target_compile_definitions (ipc_toolkit_tests PUBLIC TEST_DATA_DIR_CSTR="${CMAKE_CURRENT_SOURCE_DIR} /data/" )
122- endif ()
123-
12483################################################################################
12584# Register tests
12685################################################################################
@@ -131,4 +90,4 @@ include(Catch)
13190
13291# Register tests
13392set (PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS ON )
134- catch_discover_tests(ipc_toolkit_tests)
93+ catch_discover_tests(ipc_toolkit_tests)
0 commit comments