monado/tests/CMakeLists.txt

110 lines
3.3 KiB
CMake

# Copyright 2018-2024, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
set(tests
tests_cxx_wrappers
tests_deque
tests_generic_callbacks
tests_history_buf
tests_id_ringbuffer
tests_input_transform
tests_json
tests_lowpass_float
tests_lowpass_integer
tests_pacing
tests_quatexpmap
tests_quat_change_of_basis
tests_quat_swing_twist
tests_rational
tests_relation_chain
tests_vector
tests_worker
tests_pose
tests_vec3_angle
)
if(XRT_HAVE_D3D11)
list(APPEND tests tests_aux_d3d_d3d11 tests_comp_client_d3d11)
endif()
if(XRT_HAVE_D3D12)
list(APPEND tests tests_comp_client_d3d12)
endif()
if(XRT_HAVE_VULKAN)
list(APPEND tests tests_comp_client_vulkan tests_uv_to_tangent)
endif()
if(XRT_HAVE_OPENGL
AND XRT_HAVE_OPENGL_GLX
AND XRT_HAVE_SDL2
AND (WIN32 OR VK_USE_PLATFORM_XLIB_XRANDR_EXT)
)
set(_have_opengl_test ON)
list(APPEND tests tests_comp_client_opengl)
endif()
if(XRT_BUILD_DRIVER_HANDTRACKING)
list(APPEND tests tests_levenbergmarquardt)
endif()
foreach(testname ${tests})
add_executable(${testname} ${testname}.cpp)
target_link_libraries(${testname} PRIVATE xrt-external-catch2)
target_link_libraries(${testname} PRIVATE aux_util)
add_test(NAME ${testname} COMMAND ${testname} --success --allow-running-no-tests)
endforeach()
# For tests that require more than just aux_util, link those other libs down here.
target_link_libraries(tests_cxx_wrappers PRIVATE xrt-interfaces)
target_link_libraries(tests_history_buf PRIVATE aux_math)
target_link_libraries(tests_input_transform PRIVATE st_oxr xrt-interfaces xrt-external-openxr)
target_link_libraries(tests_lowpass_float PRIVATE aux_math)
target_link_libraries(tests_lowpass_integer PRIVATE aux_math)
target_link_libraries(tests_quatexpmap PRIVATE aux_math)
target_link_libraries(tests_rational PRIVATE aux_math)
target_link_libraries(tests_relation_chain PRIVATE aux_math)
target_link_libraries(tests_pose PRIVATE aux_math)
target_link_libraries(tests_quat_change_of_basis PRIVATE aux_math)
target_link_libraries(tests_quat_swing_twist PRIVATE aux_math)
target_link_libraries(tests_vec3_angle PRIVATE aux_math)
target_include_directories(tests_quat_change_of_basis SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR})
target_include_directories(tests_quat_swing_twist SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR})
if(XRT_BUILD_DRIVER_HANDTRACKING)
target_link_libraries(
tests_levenbergmarquardt
PRIVATE
aux_math
t_ht_mercury_includes
t_ht_mercury_kine_lm_includes
t_ht_mercury
t_ht_mercury_kine_lm
)
endif()
if(XRT_HAVE_D3D11)
target_link_libraries(tests_aux_d3d_d3d11 PRIVATE aux_d3d)
target_link_libraries(tests_comp_client_d3d11 PRIVATE comp_client comp_mock)
endif()
if(XRT_HAVE_D3D12)
target_link_libraries(tests_comp_client_d3d12 PRIVATE comp_client comp_mock)
endif()
if(XRT_HAVE_VULKAN)
target_link_libraries(
tests_comp_client_vulkan PRIVATE comp_client comp_mock comp_util aux_vk
)
target_link_libraries(tests_uv_to_tangent PRIVATE comp_render)
endif()
if(_have_opengl_test)
target_link_libraries(
tests_comp_client_opengl PRIVATE comp_client comp_mock aux_ogl SDL2::SDL2
)
target_include_directories(tests_comp_client_opengl PRIVATE SDL2::SDL2)
endif()
if(XRT_HAVE_VULKAN AND XRT_HAVE_D3D11)
target_link_libraries(tests_aux_d3d_d3d11 PRIVATE comp_util aux_vk)
endif()