1 cmake_minimum_required (VERSION 2.8)
6 ##############################################################################
9 # On Mac OS X build fat binaries with i386 and x86_64 architectures by default.
10 if (APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
11 set (CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
14 # We use a cached string variable instead of the standard (boolean) OPTION
15 # command so that we can default to auto-detecting optional depencies, while
16 # still providing a mechanism to force/disable these optional dependencies, as
17 # prescribed in http://www.gentoo.org/proj/en/qa/automagic.xml
18 set (ENABLE_GUI "AUTO" CACHE STRING "Enable Qt GUI.")
20 set (ENABLE_EGL "AUTO" CACHE STRING "Enable EGL support.")
23 ##############################################################################
26 include (FindPkgConfig)
28 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
30 set (CMAKE_USE_PYTHON_VERSION 2.7 2.6)
32 find_package (PythonInterp REQUIRED)
33 find_package (OpenGL REQUIRED)
36 if (NOT (ENABLE_GUI STREQUAL "AUTO"))
37 set (REQUIRE_GUI REQUIRED)
39 find_package (Qt4 4.7 COMPONENTS QtCore QtGui QtWebKit ${REQUIRE_GUI})
40 find_package (QJSON ${REQUIRE_GUI})
43 include_directories (${OPENGL_INCLUDE_DIR})
46 find_package (DirectX)
52 include_directories (${X11_INCLUDE_DIR})
53 add_definitions (-DHAVE_X11)
57 if (NOT ENABLE_EGL STREQUAL "AUTO")
58 set (REQUIRE_EGL REQUIRED)
60 pkg_check_modules (EGL egl glesv1_cm glesv2 ${REQUIRE_EGL})
62 include_directories (${EGL_INCLUDE_DIR})
63 add_definitions (-DHAVE_EGL)
71 ##############################################################################
72 # Set global build options
74 include (CheckCXXCompilerFlag)
77 # MSVC & MinGW only define & use APIENTRY
78 add_definitions (-DGLAPIENTRY=__stdcall)
80 # http://msdn.microsoft.com/en-us/library/aa383745.aspx
81 add_definitions (-D_WIN32_WINNT=0x0500 -DWINVER=0x0500)
83 CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" CXX_COMPILER_FLAG_VISIBILITY)
84 if (CXX_COMPILER_FLAG_VISIBILITY)
85 add_definitions ("-fvisibility=hidden")
86 endif (CXX_COMPILER_FLAG_VISIBILITY)
90 # C99 includes for msvc
91 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/msvc)
93 # Enable math constants defines
94 add_definitions (-D_USE_MATH_DEFINES)
97 add_definitions (-DNOMINMAX)
100 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
101 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
102 add_definitions (-W4)
103 add_definitions (-wd4063) # not a valid value for switch of enum
104 add_definitions (-wd4127) # conditional expression is constant
105 add_definitions (-wd4244) # conversion from 'type1' to 'type2', possible loss of data
106 add_definitions (-wd4505) # unreferenced local function has been removed
107 add_definitions (-wd4800) # forcing value to bool 'true' or 'false' (performance warning)
108 # XXX: it's safer to use ssize_t everywhere instead of disabling warning
109 add_definitions (-wd4018) # signed/unsigned mismatch
112 # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
114 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
115 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
117 if (${flag_var} MATCHES "/MD")
118 string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
119 endif (${flag_var} MATCHES "/MD")
120 endforeach (flag_var)
123 add_definitions (-Wall)
124 # XXX: it's safer to use ssize_t everywhere instead of disabling warning
125 add_definitions (-Wno-sign-compare) # comparison between signed and unsigned integer expressions
129 # Avoid depending on MinGW runtime DLLs
130 check_cxx_compiler_flag (-static-libgcc HAVE_STATIC_LIBGCC_FLAG)
131 if (HAVE_STATIC_LIBGCC_FLAG)
132 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc")
133 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc")
134 set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libgcc")
136 check_cxx_compiler_flag (-static-libstdc++ HAVE_STATIC_LIBSTDCXX_FLAG)
137 if (HAVE_STATIC_LIBSTDCXX_FLAG)
138 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
139 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
140 set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libstdc++")
145 # Put all executables into the same top level build directory, regardless of
146 # which subdirectory they are declared
147 set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
150 ##############################################################################
151 # Bundled dependencies
153 # We always use the bundled zlib, libpng, and snappy sources:
154 # - on Windows to make it easy to deploy the wrappers DLLs
155 # - on unices to prevent symbol collisions when tracing applications that link
156 # against other versions of these libraries
158 set (ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib)
159 set (ZLIB_LIBRARIES z_bundled)
160 add_subdirectory (thirdparty/zlib EXCLUDE_FROM_ALL)
162 include_directories (${ZLIB_INCLUDE_DIRS})
163 link_libraries (${ZLIB_LIBRARIES})
165 set (SNAPPY_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/snappy)
166 set (SNAPPY_LIBRARIES snappy_bundled)
167 add_subdirectory (thirdparty/snappy EXCLUDE_FROM_ALL)
169 include_directories (${SNAPPY_INCLUDE_DIRS})
170 link_libraries (${SNAPPY_LIBRARIES})
172 set (PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng)
173 set (PNG_DEFINITIONS "")
174 set (PNG_LIBRARIES png_bundled)
176 add_subdirectory (thirdparty/libpng EXCLUDE_FROM_ALL)
177 include_directories (${PNG_INCLUDE_DIR})
178 add_definitions (${PNG_DEFINITIONS})
179 link_libraries (${PNG_LIBRARIES})
182 add_subdirectory (thirdparty/getopt EXCLUDE_FROM_ALL)
183 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/getopt)
184 set (GETOPT_LIBRARIES getopt_bundled)
187 # The Qt website provides binaries for Windows and MacOSX, and they are
188 # automatically found by cmake without any manual intervention. The situation
189 # for QJSON is substantially different: there are no binaries for QJSON
190 # available, and there is no standard installation directory that is detected
193 # By bundling the QJSON source, we make it much more easier to build the GUI on
194 # Windows and MacOSX. But we only use the bundled sources when ENABLE_GUI is
196 if (QT4_FOUND AND NOT QJSON_FOUND AND (ENABLE_GUI STREQUAL "AUTO"))
197 add_subdirectory (thirdparty/qjson EXCLUDE_FROM_ALL)
198 set (QJSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
199 set (QJSON_LIBRARY_DIRS)
200 set (QJSON_LIBRARIES qjson_bundled)
201 set (QJSON_FOUND TRUE)
204 # For glext headers. Needs to be before system includes as often system's GL
205 # headers bundle and include glext.h and glxext.h
206 include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glext)
209 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/khr)
211 ##############################################################################
212 # Installation directories
215 # On Windows/MacOSX, applications are usually installed on a directory of
217 set (DOC_INSTALL_DIR doc)
219 set (DOC_INSTALL_DIR share/doc/${CMAKE_PROJECT_NAME})
222 set (LIB_INSTALL_DIR lib/apitrace)
225 # MacOSX uses fat binaries, so no need to have per-architecture wrapper
227 set (LIB_ARCH_INSTALL_DIR ${LIB_INSTALL_DIR})
229 set (LIB_ARCH_INSTALL_DIR ${LIB_INSTALL_DIR}/${CMAKE_SYSTEM_PROCESSOR})
232 set(SCRIPTS_INSTALL_DIR ${LIB_INSTALL_DIR}/scripts)
233 set(WRAPPER_INSTALL_DIR ${LIB_ARCH_INSTALL_DIR}/wrappers)
235 # Expose the binary/install directories to source
237 # TODO: Use the same directory layout, for both build and install directories,
238 # so that binaries can find each other using just relative paths.
241 -DAPITRACE_BINARY_DIR="${CMAKE_BINARY_DIR}"
242 -DAPITRACE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
243 -DAPITRACE_WRAPPER_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${WRAPPER_INSTALL_DIR}"
247 ##############################################################################
248 # Common libraries / utilities
250 include_directories (
251 ${CMAKE_CURRENT_BINARY_DIR}
252 ${CMAKE_CURRENT_SOURCE_DIR}
253 ${CMAKE_CURRENT_SOURCE_DIR}/common
257 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
258 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glproc.py > ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
259 DEPENDS glproc.py dispatch.py specs/wglapi.py specs/glxapi.py specs/cglapi.py specs/eglapi.py specs/glesapi.py specs/glapi.py specs/gltypes.py specs/stdapi.py
262 # Wrap glproc.hpp as a target to prevent the command from being executed
263 # multiple times simulatenously, when the targets that depend on it are built
265 add_custom_target (glproc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
268 set (os os_win32.cpp)
269 set (glws_os glws_wgl.cpp)
271 set (os os_posix.cpp)
273 set (glws_os glws_cocoa.mm)
275 set (glws_os glws_glx.cpp)
279 add_library (common STATIC
280 common/trace_callset.cpp
281 common/trace_dump.cpp
282 common/trace_file.cpp
283 common/trace_file_read.cpp
284 common/trace_file_write.cpp
285 common/trace_file_zlib.cpp
286 common/trace_file_snappy.cpp
287 common/trace_model.cpp
288 common/trace_parser.cpp
289 common/trace_parser_flags.cpp
290 common/trace_writer.cpp
291 common/trace_writer_local.cpp
292 common/trace_writer_model.cpp
293 common/trace_loader.cpp
294 common/trace_resource.cpp
295 common/trace_tools_trace.cpp
303 set_target_properties (common PROPERTIES
304 COMPILE_DEFINITIONS APITRACE_SOURCE_DIR="${CMAKE_SOURCE_DIR}"
305 # Ensure it can be statically linked in shared libraries
306 COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
309 link_libraries (common)
312 ##############################################################################
317 # Silence warnings about @nn suffix mismatch
318 set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
322 if (DirectX_D3D_INCLUDE_DIR)
323 include_directories (SYSTEM ${DirectX_D3D_INCLUDE_DIR})
325 OUTPUT ddrawtrace.cpp
326 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ddrawtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/ddrawtrace.cpp
327 DEPENDS ddrawtrace.py trace.py specs/d3d.py specs/d3dtypes.py specs/d3dcaps.py specs/ddraw.py specs/winapi.py specs/stdapi.py
329 add_library (ddraw MODULE specs/ddraw.def ddrawtrace.cpp)
330 set_target_properties (ddraw
332 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
333 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
335 install (TARGETS ddraw LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
336 endif (DirectX_D3D_INCLUDE_DIR)
339 if (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3DX9_INCLUDE_DIR)
340 include_directories (SYSTEM ${DirectX_D3D8_INCLUDE_DIR} ${DirectX_D3DX9_INCLUDE_DIR})
343 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8trace.cpp
344 DEPENDS d3d8trace.py trace.py specs/d3d8.py specs/d3d8types.py specs/d3d8caps.py specs/winapi.py specs/stdapi.py
346 add_library (d3d8 MODULE specs/d3d8.def d3d8trace.cpp d3dshader.cpp)
347 set_target_properties (d3d8
349 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
350 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
352 install (TARGETS d3d8 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
353 endif (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3DX9_INCLUDE_DIR)
356 if (DirectX_D3DX9_INCLUDE_DIR)
357 include_directories (SYSTEM ${DirectX_D3DX9_INCLUDE_DIR})
360 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9trace.cpp
361 DEPENDS d3d9trace.py trace.py specs/d3d9.py specs/d3d9types.py specs/d3d9caps.py specs/winapi.py specs/stdapi.py
363 add_library (d3d9 MODULE specs/d3d9.def d3d9trace.cpp d3dshader.cpp)
364 set_target_properties (d3d9
366 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
367 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
369 install (TARGETS d3d9 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
370 endif (DirectX_D3DX9_INCLUDE_DIR)
373 if (DirectX_D3D10_INCLUDE_DIR)
374 include_directories (SYSTEM ${DirectX_D3D10_INCLUDE_DIR})
376 OUTPUT d3d10trace.cpp
377 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10trace.cpp
378 DEPENDS d3d10trace.py trace.py specs/d3d10misc.py specs/d3d10.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
380 add_library (d3d10 MODULE specs/d3d10.def d3d10trace.cpp)
381 set_target_properties (d3d10
383 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
384 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
386 install (TARGETS d3d10 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
387 endif (DirectX_D3D10_INCLUDE_DIR)
389 # d2d1.dll, dwrite.dll
390 if (DirectX_D2D1_INCLUDE_DIR)
391 include_directories (SYSTEM ${DirectX_D2D1_INCLUDE_DIR})
395 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d2d1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d2d1trace.cpp
396 DEPENDS d2d1trace.py trace.py specs/d2d1.py specs/d2d1.py specs/d2dbasetypes.py specs/d2derr.py specs/dwrite.py specs/dcommon.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
398 add_library (d2d1 MODULE specs/d2d1.def d2d1trace.cpp)
399 set_target_properties (d2d1
401 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
402 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
404 install (TARGETS d2d1 LIBRARY DESTINATION wrappers)
407 OUTPUT dwritetrace.cpp
408 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dwritetrace.py > ${CMAKE_CURRENT_BINARY_DIR}/dwritetrace.cpp
409 DEPENDS dwritetrace.py trace.py specs/d2d1.py specs/d2d1.py specs/d2dbasetypes.py specs/d2derr.py specs/dwrite.py specs/dcommon.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
411 add_library (dwrite MODULE specs/dwrite.def dwritetrace.cpp)
412 set_target_properties (dwrite
414 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
415 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
417 install (TARGETS dwrite LIBRARY DESTINATION wrappers)
418 endif (DirectX_D2D1_INCLUDE_DIR)
423 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/wgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/wgltrace.cpp
424 DEPENDS wgltrace.py gltrace.py trace.py specs/wglapi.py specs/wglenum.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/winapi.py specs/stdapi.py
426 add_library (wgltrace MODULE specs/opengl32.def
431 add_dependencies (wgltrace glproc)
432 set_target_properties (wgltrace PROPERTIES
435 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
436 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
438 install (TARGETS wgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
444 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/cgltrace.cpp
445 DEPENDS cgltrace.py gltrace.py trace.py specs/cglapi.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/stdapi.py
448 add_library (cgltrace SHARED
454 add_dependencies (cgltrace glproc)
456 set_target_properties (cgltrace PROPERTIES
457 # OpenGL framework name
458 PREFIX "" OUTPUT_NAME "OpenGL" SUFFIX ""
459 # Specificy the version and reexport GLU symbols
460 LINK_FLAGS "-compatibility_version 1 -current_version 1.0.0 -Wl,-reexport_library,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib"
461 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
462 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
465 target_link_libraries (cgltrace
470 install (TARGETS cgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
475 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glxtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glxtrace.cpp
476 DEPENDS glxtrace.py gltrace.py trace.py specs/glxapi.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/stdapi.py
479 add_library (glxtrace SHARED
485 add_dependencies (glxtrace glproc)
487 set_target_properties (glxtrace PROPERTIES
488 # avoid the default "lib" prefix
490 # Prevent symbol relocations internal to our wrapper library to be
491 # overwritten by the application.
492 LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
493 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
494 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
497 target_link_libraries (glxtrace
503 install (TARGETS glxtrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
511 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/egltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/egltrace.cpp
512 DEPENDS egltrace.py gltrace.py trace.py specs/eglapi.py specs/glesapi.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/stdapi.py
515 add_library (egltrace SHARED
521 add_dependencies (egltrace glproc)
526 PROPERTY COMPILE_DEFINITIONS "TRACE_EGL"
529 set_target_properties (egltrace PROPERTIES
530 # avoid the default "lib" prefix
532 LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
533 # Prevent symbol relocations internal to our wrapper library to be
534 # overwritten by the application.
535 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
536 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
539 target_link_libraries (egltrace
544 install (TARGETS egltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
547 ##############################################################################
551 OUTPUT glretrace_gl.cpp
552 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace_gl.cpp
553 DEPENDS glretrace.py retrace.py specs/glapi.py specs/gltypes.py specs/stdapi.py
557 OUTPUT glstate_params.cpp
558 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glstate.py > ${CMAKE_CURRENT_BINARY_DIR}/glstate_params.cpp
559 DEPENDS glstate.py specs/glparams.py specs/gltypes.py specs/stdapi.py
576 if (WIN32 OR APPLE OR X11_FOUND)
577 add_executable (glretrace
583 add_dependencies (glretrace glproc)
588 PROPERTY COMPILE_DEFINITIONS "RETRACE"
591 target_link_libraries (glretrace
598 target_link_libraries (glretrace
600 "-framework ApplicationServices" # CGS*
601 ${OPENGL_gl_LIBRARY} # CGL*
604 target_link_libraries (glretrace ${X11_X11_LIB})
607 target_link_libraries (glretrace
608 # gdb doesn't like when pthreads is loaded through dlopen (which happens
609 # when dlopen'ing libGL), so link pthreads to avoid this issue. See also
610 # http://stackoverflow.com/questions/2702628/gdb-cannot-find-new-threads-generic-error
615 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
616 target_link_libraries (glretrace rt)
621 install (TARGETS glretrace RUNTIME DESTINATION bin)
624 if (EGL_FOUND AND X11_FOUND AND NOT WIN32 AND NOT APPLE)
625 add_executable (eglretrace
631 add_dependencies (eglretrace glproc)
636 PROPERTY COMPILE_DEFINITIONS "RETRACE"
637 PROPERTY COMPILE_DEFINITIONS "TRACE_EGL"
640 target_link_libraries (eglretrace
647 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
648 target_link_libraries (eglretrace rt)
651 install (TARGETS eglretrace RUNTIME DESTINATION bin)
654 ##############################################################################
657 add_subdirectory(cli)
659 ##############################################################################
660 # Scripts (to support the CLI)
664 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/tracediff.sh
665 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/jsondiff.py
666 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/snapdiff.py
667 DESTINATION ${SCRIPTS_INSTALL_DIR}
670 ##############################################################################
673 if (ENABLE_GUI AND QT4_FOUND AND QJSON_FOUND)
674 add_subdirectory(gui)
678 ##############################################################################
688 DESTINATION ${DOC_INSTALL_DIR}
691 set (CPACK_PACKAGE_VERSION_MAJOR "2")
692 set (CPACK_PACKAGE_VERSION_MINOR "0")
694 # Use current date in YYYYMMDD format as patch number
696 COMMAND ${PYTHON_EXECUTABLE} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))"
697 OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH
700 # See http://www.vtk.org/Wiki/CMake:CPackPackageGenerators
702 set (CPACK_GENERATOR "ZIP")
704 set (CPACK_GENERATOR "DragNDrop")
706 set (CPACK_GENERATOR "TBZ2")