summaryrefslogtreecommitdiff
path: root/contrib/SDL-3.2.8/src/hidapi/windows/test/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/SDL-3.2.8/src/hidapi/windows/test/CMakeLists.txt')
-rw-r--r--contrib/SDL-3.2.8/src/hidapi/windows/test/CMakeLists.txt76
1 files changed, 76 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/hidapi/windows/test/CMakeLists.txt b/contrib/SDL-3.2.8/src/hidapi/windows/test/CMakeLists.txt
new file mode 100644
index 0000000..eae3217
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/hidapi/windows/test/CMakeLists.txt
@@ -0,0 +1,76 @@
1add_executable(hid_report_reconstructor_test hid_report_reconstructor_test.c)
2set_target_properties(hid_report_reconstructor_test
3 PROPERTIES
4 C_STANDARD 11
5 C_STANDARD_REQUIRED TRUE
6)
7
8target_link_libraries(hid_report_reconstructor_test
9 PRIVATE hidapi_include hidapi_winapi
10)
11
12# Each test case requires 2 files:
13# <name>.pp_data - textual representation of HIDP_PREPARSED_DATA;
14# <name>_expected.rpt_desc - reconstructed HID Report Descriptor out of .pp_data file;
15#
16# (Non-required by test):
17# <name>_real.dpt_desc - the original report rescriptor used to create a test case;
18set(HID_DESCRIPTOR_RECONSTRUCT_TEST_CASES
19 046D_C52F_0001_000C
20 046D_C52F_0001_FF00
21 046D_C52F_0002_0001
22 046D_C52F_0002_FF00
23 17CC_1130_0000_FF01
24 046D_0A37_0001_000C
25 046A_0011_0006_0001
26 046D_C077_0002_0001
27 046D_C283_0004_0001
28 046D_B010_0006_0001
29 046D_B010_0002_FF00
30 046D_B010_0002_0001
31 046D_B010_0001_FF00
32 046D_B010_0001_000C
33 046D_C534_0001_000C
34 046D_C534_0001_FF00
35 046D_C534_0002_0001
36 046D_C534_0002_FF00
37 046D_C534_0006_0001
38 046D_C534_0080_0001
39 047F_C056_0001_000C
40 047F_C056_0003_FFA0
41 047F_C056_0005_000B
42 045E_02FF_0005_0001
43)
44
45set(CMAKE_VERSION_SUPPORTS_ENVIRONMENT_MODIFICATION "3.22")
46
47if(HIDAPI_ENABLE_ASAN AND MSVC)
48 if(CMAKE_VERSION VERSION_LESS CMAKE_VERSION_SUPPORTS_ENVIRONMENT_MODIFICATION)
49 message("CTest/ASAN: Make sure to run ctest from MSVC Command Prompt")
50 endif()
51endif()
52
53foreach(TEST_CASE ${HID_DESCRIPTOR_RECONSTRUCT_TEST_CASES})
54 set(TEST_PP_DATA "${CMAKE_CURRENT_LIST_DIR}/data/${TEST_CASE}.pp_data")
55 if(NOT EXISTS "${TEST_PP_DATA}")
56 message(FATAL_ERROR "Missing '${TEST_PP_DATA}' file for '${TEST_CASE}' test case")
57 endif()
58 set(TEST_EXPECTED_DESCRIPTOR "${CMAKE_CURRENT_LIST_DIR}/data/${TEST_CASE}_expected.rpt_desc")
59 if(NOT EXISTS "${TEST_EXPECTED_DESCRIPTOR}")
60 message(FATAL_ERROR "Missing '${TEST_EXPECTED_DESCRIPTOR}' file for '${TEST_CASE}' test case")
61 endif()
62
63 add_test(NAME "WinHidReportReconstructTest_${TEST_CASE}"
64 COMMAND hid_report_reconstructor_test "${TEST_PP_DATA}" "${TEST_EXPECTED_DESCRIPTOR}"
65 WORKING_DIRECTORY "$<TARGET_FILE_DIR:hidapi_winapi>"
66 )
67 if(HIDAPI_ENABLE_ASAN)
68 if(MSVC)
69 if(NOT CMAKE_VERSION VERSION_LESS CMAKE_VERSION_SUPPORTS_ENVIRONMENT_MODIFICATION)
70 get_filename_component(MSVC_BUILD_TOOLS_DIR "${CMAKE_LINKER}" DIRECTORY)
71 set_property(TEST "WinHidReportReconstructTest_${TEST_CASE}" PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_append:${MSVC_BUILD_TOOLS_DIR}")
72 endif()
73 endif()
74 set_property(TEST "WinHidReportReconstructTest_${TEST_CASE}" PROPERTY ENVIRONMENT "ASAN_SAVE_DUMPS=AsanDump_${TEST_CASE}.dmp")
75 endif()
76endforeach()