1 cmake_minimum_required (VERSION 2.8)
2 INCLUDE (FindPythonInterp)
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 (FindPythonInterp)
25 include (FindPkgConfig)
27 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
29 # Set default built type
30 if (NOT CMAKE_BUILD_TYPE)
31 set (CMAKE_BUILD_TYPE Debug
33 STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
35 endif (NOT CMAKE_BUILD_TYPE)
37 include (CMakeParseArguments)
44 find_package (DirectX)
45 elseif (PKG_CONFIG_FOUND)
46 pkg_check_modules (EGL egl)
47 pkg_check_modules (GLESV1 glesv1_cm)
48 pkg_check_modules (GLESV2 glesv2)
51 # Check for the presence of several python packages, which are needed to build
54 COMMAND ${PYTHON_EXECUTABLE} -c "import PIL"
57 RESULT_VARIABLE IMPORT_PIL_RESULT)
58 if (IMPORT_PIL_RESULT EQUAL 0)
61 message (STATUS "python PIL module not found")
69 # Nobody likes to include windows.h:
70 # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
71 # - GLEW temporarily defines the necessary defines but undefines them later
72 # - certain GLUT distributions don't include it;
73 # - most of our programs are meant to be portable so don't include it.
75 # We could try to replicate the windows.h definitions required by
76 # GL/gl.h, but the build time savings don't compensate the constant
77 # headaches that brings, so instead we force windows.h to be included
80 add_definitions (-FIwindows.h)
82 add_definitions (--include windows.h)
85 # Don't define min/max macros
86 add_definitions (-DNOMINMAX)
88 # MSVC & MinGW only define & use APIENTRY
89 add_definitions (-DGLAPIENTRY=__stdcall)
93 # Enable math constants defines
94 add_definitions (-D_USE_MATH_DEFINES)
96 # Silence several MSVC pedantic warnings
97 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
98 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
99 add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
104 add_subdirectory (apps)
105 add_subdirectory (traces)
107 # FIXME: The tests in the cli directory are intended to be high-level
108 # tests of the apitrace command-line interface which would ideally be
109 # portable across all platforms. However, these tests all rely on
110 # doing image comparisons and the current implementation of the
111 # "apitrace dump-images" command relies on direct invocation of the
114 # Someday, we should have more unified commands for replaying traces,
115 # dumping images, etc. At that point these cli tests should be usable
116 # with all targets so that we can drop the "if (OPENGL_FOUND)"
118 if (OPENGL_FOUND AND PIL_FOUND)
119 add_subdirectory (cli)
120 add_subdirectory (trim_stress)