1 cmake_minimum_required (VERSION 2.8)
3 project (apitrace-tests)
5 # Set default built type
6 if (NOT CMAKE_BUILD_TYPE)
7 set (CMAKE_BUILD_TYPE Debug
9 STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
11 endif (NOT CMAKE_BUILD_TYPE)
13 include (CMakeParseArguments)
15 find_package (OpenGL REQUIRED)
18 find_library (GLEW_glew_LIBRARY GLEW
22 find_path (GLEW_INCLUDE_DIR GL/glew.h
31 # Nobody likes to include windows.h:
32 # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
33 # - GLEW temporarily defines the necessary defines but undefines them later
34 # - certain GLUT distributions don't include it;
35 # - most of our programs are meant to be portable so don't include it.
37 # We could try to replicate the windows.h definitions required by
38 # GL/gl.h, but the build time savings don't compensate the constant
39 # headaches that brings, so instead we force windows.h to be included
42 add_definitions (-FIwindows.h)
44 add_definitions (--include windows.h)
47 # Don't define min/max macros
48 add_definitions (-DNOMINMAX)
50 # MSVC & MinGW only define & use APIENTRY
51 add_definitions (-DGLAPIENTRY=__stdcall)
55 # Enable math constants defines
56 add_definitions (-D_USE_MATH_DEFINES)
58 # Silence several MSVC pedantic warnings
59 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
60 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
61 add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
64 if (NOT APITRACE_BINARY_DIR)
65 set (APITRACE_BINARY_DIR "${CMAKE_BINARY_DIR}/.." CACHE PATH "apitrace build directory")
67 if (NOT EXISTS ${APITRACE_BINARY_DIR})
68 message (SEND_ERROR "Invalid APITRACE_BINARY_DIR")
73 add_subdirectory (apps)