tests/gl_basic_test: undo overzealous clang-format changes
[mesa-waffle.git] / tests / functional / CMakeLists.txt
blobaf8ace133289e513cd72c150838ee71c1308b127
1 set(gl_basic_test_sources
2     gl_basic_test.c
3     )
5 if(waffle_on_mac)
6     list(APPEND gl_basic_test_sources
7         gl_basic_cocoa.m
8         )
9 endif()
11 if(NOT MSVC)
12     set_source_files_properties(
13         ${gl_basic_test_sources}
14         PROPERTIES
15             COMPILE_FLAGS "-Wno-initializer-overrides"
16     )
17 endif()
19 # CMake will pass to the C compiler only C sources. CMake does not recognize the
20 # .m extension and ignores any such files in the source lists. To coerce CMake
21 # to pass .m files to the compiler, we must lie and claim that they are
22 # C sources.
23 set_source_files_properties(
24     ${gl_basic_test_sources}
25     PROPERTIES LANGUAGE C
26     )
28 add_executable(gl_basic_test
29     ${gl_basic_test_sources}
30     )
32 target_link_libraries(gl_basic_test
33     ${waffle_libname}
34     cmocka
35     ${GETOPT_LIBRARIES}
36     )
38 # ----------------------------------------------------------------------------
39 # Per platform functionality tests
40 # ----------------------------------------------------------------------------
42 function(add_functest platform_name)
43     add_custom_target(gl_basic_test_${platform_name}_run
44         COMMAND gl_basic_test --platform ${platform_name}
45     )
46     add_dependencies(check-func gl_basic_test_${platform_name}_run)
48     if(VALGRIND_EXECUTABLE)
49         add_custom_target(valgrind_gl_basic_test_${platform_name}_run
50             DEPENDS gl_basic_test
51             COMMAND ${VALGRIND_EXECUTABLE} $<TARGET_FILE:gl_basic_test> --platform ${platform_name}
52         )
54         add_dependencies(valgrind-check-func valgrind_gl_basic_test_${platform_name}_run)
55     endif()
56 endfunction()
58 if(waffle_on_mac)
59     add_functest(cgl)
60 endif()
62 if(waffle_on_linux)
63     if(waffle_has_glx)
64         add_functest(glx)
65     endif()
67     if(waffle_has_wayland)
68         add_functest(wayland)
69     endif()
71     if(waffle_has_x11_egl)
72         add_functest(x11_egl)
73     endif()
75     if(waffle_has_gbm)
76         add_functest(gbm)
77     endif()
79     if(waffle_has_surfaceless)
80         add_functest(surfaceless_egl)
81     endif()
82 endif()
84 if(waffle_on_windows)
85     add_functest(wgl)
86 endif()