1 cmake_minimum_required (VERSION 2.8)
4 # Use clang on MacOSX. gcc doesn't support __thread key, and Apple has
5 # abandoned it for clang. This must be done before the project is defined.
7 set (CMAKE_C_COMPILER "clang")
8 set (CMAKE_CXX_COMPILER "clang++")
12 project (apitrace-tests)
14 find_path (APITRACE_SOURCE_DIR NAMES cmake/FindDirectX.cmake PATHS .. ../.. DOC "apitrace source tree" NO_DEFAULT_PATH)
15 if (NOT EXISTS ${APITRACE_SOURCE_DIR})
16 message (WARNING "Please specify path to apitrace source tree via APITRACE_SOURCE_DIR")
19 find_program (APITRACE_EXECUTABLE NAMES apitrace PATHS ${APITRACE_SOURCE_DIR} DOC "apitrace executable")
20 if (NOT EXISTS ${APITRACE_EXECUTABLE})
21 message (WARNING "Please specify path to apitrace executable via APITRACE_EXECUTABLE")
24 include (FindPkgConfig)
26 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
28 # Set default built type
29 if (NOT CMAKE_BUILD_TYPE)
30 set (CMAKE_BUILD_TYPE Debug
32 STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
34 endif (NOT CMAKE_BUILD_TYPE)
36 include (CMakeParseArguments)
43 find_package (DirectX)
44 elseif (PKG_CONFIG_FOUND)
45 pkg_check_modules (EGL egl)
46 pkg_check_modules (GLESV1 glesv1_cm)
47 pkg_check_modules (GLESV2 glesv2)
55 # Nobody likes to include windows.h:
56 # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
57 # - GLEW temporarily defines the necessary defines but undefines them later
58 # - certain GLUT distributions don't include it;
59 # - most of our programs are meant to be portable so don't include it.
61 # We could try to replicate the windows.h definitions required by
62 # GL/gl.h, but the build time savings don't compensate the constant
63 # headaches that brings, so instead we force windows.h to be included
66 add_definitions (-FIwindows.h)
68 add_definitions (--include windows.h)
71 # Don't define min/max macros
72 add_definitions (-DNOMINMAX)
74 # MSVC & MinGW only define & use APIENTRY
75 add_definitions (-DGLAPIENTRY=__stdcall)
79 # Enable math constants defines
80 add_definitions (-D_USE_MATH_DEFINES)
82 # Silence several MSVC pedantic warnings
83 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
84 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
85 add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
90 add_subdirectory (apps)
91 add_subdirectory (traces)