]> git.cworth.org Git - apitrace-tests/blob - CMakeLists.txt
cli: Use python differ. Fix failures.
[apitrace-tests] / CMakeLists.txt
1 cmake_minimum_required (VERSION 2.8)
2
3
4 # Use clang on MacOSX. gcc doesn't support __thread key, and Apple has
5 # abandoned it for clang.  This must be done before the project is defined.
6 if (APPLE)
7     set (CMAKE_C_COMPILER "clang")
8     set (CMAKE_CXX_COMPILER "clang++")
9 endif ()
10
11
12 project (apitrace-tests)
13
14 find_path (APITRACE_SOURCE_DIR NAMES cmake/FindDirectX.cmake PATHS .. ../.. DOC "apitrace source tree" NO_DEFAULT_PATH)
15 if (NOT EXISTS ${APITRACE_SOURCE_DIR})
16     message (WARNING "Please specify path to apitrace source tree via APITRACE_SOURCE_DIR")
17 endif ()
18
19 find_program (APITRACE_EXECUTABLE NAMES apitrace PATHS ${APITRACE_SOURCE_DIR} DOC "apitrace executable")
20 if (NOT EXISTS ${APITRACE_EXECUTABLE})
21     message (WARNING "Please specify path to apitrace executable via APITRACE_EXECUTABLE")
22 endif ()
23
24 include (FindPkgConfig)
25
26 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
27
28 # Set default built type
29 if (NOT CMAKE_BUILD_TYPE)
30    set (CMAKE_BUILD_TYPE Debug
31        CACHE
32        STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
33        FORCE)
34 endif (NOT CMAKE_BUILD_TYPE)
35
36 include (CMakeParseArguments)
37
38 find_package (OpenGL)
39 find_package (GLUT)
40 find_package (GLEW)
41
42 if (WIN32)
43     find_package (DirectX)
44 elseif (PKG_CONFIG_FOUND)
45         pkg_check_modules (EGL egl)
46         pkg_check_modules (GLESV1 glesv1_cm)
47         pkg_check_modules (GLESV2 glesv2)
48 endif ()
49
50 if (UNIX)
51         link_libraries(m)
52 endif (UNIX)
53
54 if (WIN32)
55         # Nobody likes to include windows.h:
56         # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
57         # - GLEW temporarily defines the necessary defines but undefines them later
58         # - certain GLUT distributions don't include it;
59         # - most of our programs are meant to be portable so don't include it.
60         #
61         # We could try to replicate the windows.h definitions required by
62         # GL/gl.h, but the build time savings don't compensate the constant
63         # headaches that brings, so instead we force windows.h to be included
64         # on every file.
65         if (MSVC)
66                 add_definitions (-FIwindows.h)
67         else (MSVC)
68                 add_definitions (--include windows.h)
69         endif (MSVC)
70
71         # Don't define min/max macros
72         add_definitions (-DNOMINMAX)
73
74         # MSVC & MinGW only define & use APIENTRY
75         add_definitions (-DGLAPIENTRY=__stdcall)
76 endif ()
77
78 if (MSVC)
79         # Enable math constants defines
80         add_definitions (-D_USE_MATH_DEFINES)
81
82         # Silence several MSVC pedantic warnings
83         add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
84         add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
85         add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
86 endif ()
87
88 enable_testing()
89
90 add_subdirectory (apps)
91 add_subdirectory (traces)
92
93 # FIXME: The tests in the cli directory are intended to be high-level
94 # tests of the apitrace command-line interface which would ideally be
95 # portable across all platforms. However, these tests all rely on
96 # doing image comparisons and the current implementation of the
97 # "apitrace dump-images" command relies on direct invocation of the
98 # glretrace command.
99 #
100 # Someday, we should have more unified commands for replaying traces,
101 # dumping images, etc. At that point these cli tests should be usable
102 # with all targets so that we can drop the "if (OPENGL_FOUND)"
103 # condition here.
104 if (OPENGL_FOUND)
105     add_subdirectory (cli)
106     add_subdirectory (trim_stress)
107 endif ()