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