1 cmake_minimum_required (VERSION 2.8)
3 project (apitrace-tests)
5 include (FindPkgConfig)
7 # Set default built type
8 if (NOT CMAKE_BUILD_TYPE)
9 set (CMAKE_BUILD_TYPE Debug
11 STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
13 endif (NOT CMAKE_BUILD_TYPE)
15 include (CMakeParseArguments)
17 find_package (OpenGL REQUIRED)
20 find_path (GLEW_INCLUDE_DIR GL/glew.h /usr/include/GL)
21 find_library (GLEW_glew_LIBRARY GLEW /usr/lib)
24 pkg_check_modules (EGL egl)
25 pkg_check_modules (GLESV1 glesv1_cm)
26 pkg_check_modules (GLESV2 glesv2)
27 pkg_check_modules (VG vg)
35 # Nobody likes to include windows.h:
36 # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
37 # - GLEW temporarily defines the necessary defines but undefines them later
38 # - certain GLUT distributions don't include it;
39 # - most of our programs are meant to be portable so don't include it.
41 # We could try to replicate the windows.h definitions required by
42 # GL/gl.h, but the build time savings don't compensate the constant
43 # headaches that brings, so instead we force windows.h to be included
46 add_definitions (-FIwindows.h)
48 add_definitions (--include windows.h)
51 # Don't define min/max macros
52 add_definitions (-DNOMINMAX)
54 # MSVC & MinGW only define & use APIENTRY
55 add_definitions (-DGLAPIENTRY=__stdcall)
59 # Enable math constants defines
60 add_definitions (-D_USE_MATH_DEFINES)
62 # Silence several MSVC pedantic warnings
63 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
64 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
65 add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
68 if (NOT APITRACE_BINARY_DIR)
69 set (APITRACE_BINARY_DIR "${CMAKE_BINARY_DIR}/.." CACHE PATH "apitrace build directory")
71 if (NOT EXISTS ${APITRACE_BINARY_DIR})
72 message (SEND_ERROR "Invalid APITRACE_BINARY_DIR")
77 add_subdirectory (apps)