1 cmake_minimum_required (VERSION 2.8)
3 project (apitrace-tests)
5 find_path (APITRACE_SOURCE_DIR NAMES cmake/FindDirectX.cmake PATHS .. ../.. DOC "apitrace source tree" NO_DEFAULT_PATH)
6 if (NOT EXISTS ${APITRACE_SOURCE_DIR})
7 message (SEND_ERROR "Please specify path to apitrace source tree via APITRACE_SOURCE_DIR")
10 find_program (APITRACE_EXECUTABLE NAMES apitrace PATHS ${APITRACE_SOURCE_DIR} DOC "apitrace executable")
11 if (NOT EXISTS ${APITRACE_EXECUTABLE})
12 message (SEND_ERROR "Please specify path to apitrace executable via APITRACE_EXECUTABLE")
15 include (FindPkgConfig)
17 if (APITRACE_SOURCE_DIR)
18 set (CMAKE_MODULE_PATH ${APITRACE_SOURCE_DIR}/cmake)
19 find_package (DirectX)
22 # Set default built type
23 if (NOT CMAKE_BUILD_TYPE)
24 set (CMAKE_BUILD_TYPE Debug
26 STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
28 endif (NOT CMAKE_BUILD_TYPE)
30 include (CMakeParseArguments)
32 find_package (OpenGL REQUIRED)
35 find_path (GLEW_INCLUDE_DIR GL/glew.h /usr/include/GL)
36 find_library (GLEW_glew_LIBRARY GLEW /usr/lib)
39 pkg_check_modules (EGL egl)
40 pkg_check_modules (GLESV1 glesv1_cm)
41 pkg_check_modules (GLESV2 glesv2)
49 # Nobody likes to include windows.h:
50 # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
51 # - GLEW temporarily defines the necessary defines but undefines them later
52 # - certain GLUT distributions don't include it;
53 # - most of our programs are meant to be portable so don't include it.
55 # We could try to replicate the windows.h definitions required by
56 # GL/gl.h, but the build time savings don't compensate the constant
57 # headaches that brings, so instead we force windows.h to be included
60 add_definitions (-FIwindows.h)
62 add_definitions (--include windows.h)
65 # Don't define min/max macros
66 add_definitions (-DNOMINMAX)
68 # MSVC & MinGW only define & use APIENTRY
69 add_definitions (-DGLAPIENTRY=__stdcall)
73 # Enable math constants defines
74 add_definitions (-D_USE_MATH_DEFINES)
76 # Silence several MSVC pedantic warnings
77 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
78 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
79 add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
84 add_subdirectory (apps)
85 add_subdirectory (traces)