]> git.cworth.org Git - apitrace-tests/blob - CMakeLists.txt
More flexible image comparison.
[apitrace-tests] / CMakeLists.txt
1 cmake_minimum_required (VERSION 2.8)
2
3 project (apitrace-tests)
4
5 include (FindPkgConfig)
6
7 # Set default built type
8 if (NOT CMAKE_BUILD_TYPE)
9    set (CMAKE_BUILD_TYPE Debug
10        CACHE
11        STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
12        FORCE)
13 endif (NOT CMAKE_BUILD_TYPE)
14
15 include (CMakeParseArguments)
16
17 find_package (OpenGL REQUIRED)
18 find_package (GLUT)
19
20 find_path (GLEW_INCLUDE_DIR GL/glew.h /usr/include/GL)
21 find_library (GLEW_glew_LIBRARY GLEW /usr/lib)
22
23 if (NOT WIN32)
24         pkg_check_modules (EGL egl)
25         pkg_check_modules (GLESV1 glesv1_cm)
26         pkg_check_modules (GLESV2 glesv2)
27 endif ()
28
29 if (UNIX)
30         link_libraries(m)
31 endif (UNIX)
32
33 if (WIN32)
34         # Nobody likes to include windows.h:
35         # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
36         # - GLEW temporarily defines the necessary defines but undefines them later
37         # - certain GLUT distributions don't include it;
38         # - most of our programs are meant to be portable so don't include it.
39         #
40         # We could try to replicate the windows.h definitions required by
41         # GL/gl.h, but the build time savings don't compensate the constant
42         # headaches that brings, so instead we force windows.h to be included
43         # on every file.
44         if (MSVC)
45                 add_definitions (-FIwindows.h)
46         else (MSVC)
47                 add_definitions (--include windows.h)
48         endif (MSVC)
49
50         # Don't define min/max macros
51         add_definitions (-DNOMINMAX)
52
53         # MSVC & MinGW only define & use APIENTRY
54         add_definitions (-DGLAPIENTRY=__stdcall)
55 endif ()
56
57 if (MSVC)
58         # Enable math constants defines
59         add_definitions (-D_USE_MATH_DEFINES)
60
61         # Silence several MSVC pedantic warnings
62         add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
63         add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
64         add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
65 endif ()
66
67 if (NOT APITRACE_BINARY_DIR) 
68     set (APITRACE_BINARY_DIR "${CMAKE_BINARY_DIR}/.." CACHE PATH "apitrace build directory")
69 endif ()
70 if (NOT EXISTS ${APITRACE_BINARY_DIR})
71     message (SEND_ERROR "Invalid APITRACE_BINARY_DIR")
72 endif ()
73
74 enable_testing()
75
76 add_subdirectory (apps)
77 add_subdirectory (traces)
78