]> git.cworth.org Git - apitrace-tests/blob - CMakeLists.txt
Start compiling apps for regression testing.
[apitrace-tests] / CMakeLists.txt
1 cmake_minimum_required (VERSION 2.8)
2
3 project (apitrace-tests)
4
5 find_package (OpenGL REQUIRED)
6 find_package (GLUT)
7
8 find_library (GLEW_glew_LIBRARY GLEW
9         /usr/lib
10 )
11
12 find_path (GLEW_INCLUDE_DIR GL/glew.h
13       /usr/include/GL
14 )
15
16 if (UNIX)
17         link_libraries(m)
18 endif (UNIX)
19
20 if (WIN32)
21         # Nobody likes to include windows.h:
22         # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
23         # - GLEW temporarily defines the necessary defines but undefines them later
24         # - certain GLUT distributions don't include it;
25         # - most of our programs are meant to be portable so don't include it.
26         #
27         # We could try to replicate the windows.h definitions required by
28         # GL/gl.h, but the build time savings don't compensate the constant
29         # headaches that brings, so instead we force windows.h to be included
30         # on every file.
31         if (MSVC)
32                 add_definitions (-FIwindows.h)
33         else (MSVC)
34                 add_definitions (--include windows.h)
35         endif (MSVC)
36
37         # Don't define min/max macros
38         add_definitions (-DNOMINMAX)
39
40         # MSVC & MinGW only define & use APIENTRY
41         add_definitions (-DGLAPIENTRY=__stdcall)
42 endif ()
43
44 if (MSVC)
45         # Enable math constants defines
46         add_definitions (-D_USE_MATH_DEFINES)
47
48         # Silence several MSVC pedantic warnings
49         add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
50         add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
51         add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
52 endif ()
53
54 add_subdirectory (apps)
55