Reduce cmake test boilerplate
All instances of mujoco_test in the code base were followed by a call to target_link_libraries(<testname> fixture gmock). As anyhow mujoco_test already was calling target_link_libraries to some predefined list of targets (mujoco and gtest_main), this PR adds to the list of default linked targets also fixture and gmock, to reduce the boilerplate. Furthermore, to completly remove the need for calling target_link_libraries after a call to mujoco_test, this PR also add to the mujoco_test macro the ADDITIONAL_LINK_LIBRARIES argument, that can be used if a given test needs to link some additional targets beside the default ones. To permit to use these new features also for mujoco benchmarks, this PR adds a MAIN_TARGET parameter to mujoco_test, to select if gtest_main or another target is used to provide the main entry point to the test executable.
This commit is contained in:
@@ -13,91 +13,59 @@
|
||||
# limitations under the License.
|
||||
|
||||
mujoco_test(engine_collision_box_test)
|
||||
target_link_libraries(engine_collision_box_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_collision_convex_test)
|
||||
target_link_libraries(engine_collision_convex_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_collision_driver_test)
|
||||
target_link_libraries(engine_collision_driver_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_collision_gjk_test)
|
||||
target_link_libraries(engine_collision_gjk_test fixture gmock ccd)
|
||||
mujoco_test(engine_collision_gjk_test ADDITIONAL_LINK_LIBRARIES ccd)
|
||||
|
||||
mujoco_test(engine_core_constraint_test)
|
||||
target_link_libraries(engine_core_constraint_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_core_smooth_test)
|
||||
target_link_libraries(engine_core_smooth_test fixture gmock absl::span)
|
||||
mujoco_test(engine_core_smooth_test ADDITIONAL_LINK_LIBRARIES absl::span)
|
||||
|
||||
mujoco_test(engine_derivative_test)
|
||||
target_link_libraries(engine_derivative_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_forward_test)
|
||||
target_link_libraries(engine_forward_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_inverse_test)
|
||||
target_link_libraries(engine_inverse_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_island_test)
|
||||
target_link_libraries(engine_island_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_io_test)
|
||||
target_link_libraries(
|
||||
engine_io_test
|
||||
fixture
|
||||
gmock
|
||||
absl::str_format
|
||||
)
|
||||
mujoco_test(engine_io_test ADDITIONAL_LINK_LIBRARIES absl::str_format)
|
||||
|
||||
mujoco_test(
|
||||
engine_plugin_test
|
||||
ADDITIONAL_LINK_LIBRARIES
|
||||
absl::str_format
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"MUJOCO_PLUGIN_DIR=$<TARGET_FILE_DIR:elasticity>"
|
||||
)
|
||||
target_link_libraries(
|
||||
engine_plugin_test
|
||||
fixture
|
||||
gmock
|
||||
absl::str_format
|
||||
)
|
||||
|
||||
mujoco_test(engine_passive_test)
|
||||
target_link_libraries(engine_passive_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_print_test)
|
||||
target_link_libraries(engine_print_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_ray_test)
|
||||
target_link_libraries(engine_ray_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_sensor_test)
|
||||
target_link_libraries(engine_sensor_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_solver_test)
|
||||
target_link_libraries(engine_solver_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_sort_test)
|
||||
target_link_libraries(engine_sort_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_support_test)
|
||||
target_link_libraries(engine_support_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_thread_test)
|
||||
target_link_libraries(engine_thread_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_util_blas_test)
|
||||
target_link_libraries(engine_util_blas_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_util_errmem_test)
|
||||
target_link_libraries(engine_util_errmem_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_util_solve_test)
|
||||
target_link_libraries(engine_util_solve_test fixture gmock)
|
||||
|
||||
mujoco_test(engine_util_spatial_test)
|
||||
target_link_libraries(engine_util_spatial_test fixture gmock)
|
||||
|
||||
mujoco_test(
|
||||
engine_vis_state_test
|
||||
@@ -105,4 +73,3 @@ mujoco_test(
|
||||
ENVIRONMENT
|
||||
"MUJOCO_PLUGIN_DIR=$<TARGET_FILE_DIR:elasticity>"
|
||||
)
|
||||
target_link_libraries(engine_vis_state_test fixture gmock)
|
||||
|
||||
Reference in New Issue
Block a user