]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Show the size of binary data uploaded in a frame.
[apitrace] / CMakeLists.txt
index a157889e3092e81457fb6aabc030c192b8c4a04b..fdf0f53eb5f2fea087180b2e03203b535118d959 100755 (executable)
@@ -1,5 +1,7 @@
 cmake_minimum_required (VERSION 2.8)
 
+include (CheckCXXCompilerFlag)
+
 project (apitrace)
 
 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
@@ -16,7 +18,7 @@ set (CMAKE_USE_PYTHON_VERSION 2.6)
 
 find_package (PythonInterp REQUIRED)
 find_package (OpenGL REQUIRED)
-find_package (Qt4 COMPONENTS QtCore QtGui QtWebKit)
+find_package (Qt4 4.7 COMPONENTS QtCore QtGui QtWebKit)
 find_package (QJSON)
 
 if (NOT WIN32)
@@ -25,6 +27,12 @@ if (NOT WIN32)
     find_package (ZLIB)
     find_package (PNG)
     find_package (X11 REQUIRED)
+
+    # We use GLX on MacOSX, which is in a separate library
+    if (APPLE)
+        find_library (X11_GL_LIB GL ${X11_LIB_SEARCH_PATH})
+        set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_GL_LIB})
+    endif (APPLE)
 else (NOT WIN32)
     find_package (DirectX)
 endif (NOT WIN32)
@@ -32,6 +40,11 @@ endif (NOT WIN32)
 if (WIN32)
     # MSVC & MinGW only define & use APIENTRY
     add_definitions (-DGLAPIENTRY=__stdcall)
+else (WIN32)
+    CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" CXX_COMPILER_FLAG_VISIBILITY)
+    if (CXX_COMPILER_FLAG_VISIBILITY)
+        add_definitions ("-fvisibility=hidden")
+    endif (CXX_COMPILER_FLAG_VISIBILITY)
 endif (WIN32)
 
 if (MSVC)
@@ -71,6 +84,10 @@ else ()
     add_definitions (-Wno-sign-compare) # comparison between signed and unsigned integer expressions
 endif ()
 
+# Put all executables into the same top level build directory, regardless of
+# which subdirectory they are declared
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+
 # Use bundled ZLIB if system one can't be found
 if (ZLIB_FOUND)
     include_directories (${ZLIB_INCLUDE_DIRS})
@@ -190,15 +207,24 @@ else ()
     add_custom_command (
         OUTPUT glxtrace.cpp
         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glxtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glxtrace.cpp
-        DEPENDS glxtrace.py gltrace.py trace.py glxapi.py glapi.py glenum.py stdapi.py
+        DEPENDS glxtrace.py gltrace.py trace.py glxapi.py glapi.py glstate.py glenum.py stdapi.py
     )
 
     add_library (glxtrace SHARED glxtrace.cpp trace_write.cpp os_posix.cpp ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
 
     set_target_properties (glxtrace PROPERTIES
+        # avoid the default "lib" prefix
         PREFIX ""
     )
 
+    # Prevent symbol relocations internal to our wrapper library to be
+    # overwritten by the application.
+    if (NOT APPLE)
+        set_target_properties (glxtrace PROPERTIES
+            LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
+        )
+    endif (NOT APPLE)
+
     target_link_libraries (glxtrace dl)
 endif ()
 
@@ -251,8 +277,6 @@ set_property (
 target_link_libraries (glretrace
     trace
     ${OPENGL_gl_LIBRARY}
-    ${OPENGL_glu_LIBRARY}
-    ${X11_LIBRARIES}
 )
 
 if (NOT WIN32)