]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Show the size of binary data uploaded in a frame.
[apitrace] / CMakeLists.txt
old mode 100644 (file)
new mode 100755 (executable)
index fefd349..fdf0f53
@@ -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)
@@ -41,6 +54,9 @@ if (MSVC)
     # Enable math constants defines
     add_definitions (-D_USE_MATH_DEFINES)
 
+    # No min/max macros
+    add_definitions (-DNOMINMAX)
+
     # Adjust warnings
     add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
     add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
@@ -68,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})
@@ -187,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 ()
 
@@ -207,7 +236,7 @@ else (WIN32)
     set (glws glws_glx.cpp)
 endif (WIN32)
 
-add_library (trace trace_model.cpp trace_parser.cpp ${os})
+add_library (trace trace_model.cpp trace_parser.cpp trace_write.cpp ${os})
 
 add_executable (tracedump tracedump.cpp)
 target_link_libraries (tracedump trace)
@@ -248,8 +277,6 @@ set_property (
 target_link_libraries (glretrace
     trace
     ${OPENGL_gl_LIBRARY}
-    ${OPENGL_glu_LIBRARY}
-    ${X11_LIBRARIES}
 )
 
 if (NOT WIN32)