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