]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Move trace dumping to a separate module. Add option to not dump arg names.
[apitrace] / CMakeLists.txt
index 7090a34a21c4fde86b63aae73b03abd84d23f11c..177c82b8a83b7abd24ddd4bc3ae2d62ef933bf64 100755 (executable)
@@ -238,6 +238,7 @@ add_definitions(
 # Common libraries / utilities
 
 include_directories (
+    ${CMAKE_CURRENT_BINARY_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}/common
 )
@@ -248,6 +249,11 @@ add_custom_command (
     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
 )
 
+# Wrap glproc.hpp as a target to prevent the command from being executed
+# multiple times simulatenously, when the targets that depend on it are built
+# in parallel.
+add_custom_target (glproc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
+
 if (WIN32)
     set (os os_win32.cpp)
     set (glws_os glws_wgl.cpp)
@@ -261,6 +267,7 @@ else ()
 endif ()
 
 add_library (common STATIC
+    common/trace_dump.cpp
     common/trace_file.cpp
     common/trace_file_read.cpp
     common/trace_file_write.cpp
@@ -268,6 +275,7 @@ add_library (common STATIC
     common/trace_file_snappy.cpp
     common/trace_model.cpp
     common/trace_parser.cpp
+    common/trace_parser_flags.cpp
     common/trace_writer.cpp
     common/trace_writer_local.cpp
     common/trace_writer_model.cpp
@@ -377,8 +385,8 @@ if (WIN32)
         wgltrace.cpp
         glcaps.cpp
         glproc_gl.cpp
-        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
     )
+    add_dependencies (wgltrace glproc)
     set_target_properties (wgltrace PROPERTIES
         PREFIX ""
         OUTPUT_NAME opengl32
@@ -399,9 +407,10 @@ elseif (APPLE)
         cgltrace.cpp
         glcaps.cpp
         glproc_gl.cpp
-        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
     )
 
+    add_dependencies (cgltrace glproc)
+
     set_target_properties (cgltrace PROPERTIES
         # OpenGL framework name
         PREFIX "" OUTPUT_NAME "OpenGL" SUFFIX ""
@@ -423,12 +432,13 @@ else ()
     )
 
     add_library (glxtrace SHARED
-        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
         glxtrace.cpp
         glcaps.cpp
         glproc_gl.cpp
     )
 
+    add_dependencies (glxtrace glproc)
+
     set_target_properties (glxtrace PROPERTIES
         # avoid the default "lib" prefix
         PREFIX ""
@@ -454,12 +464,13 @@ if (EGL_FOUND)
     )
 
     add_library (egltrace SHARED
-        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
         egltrace.cpp
         glcaps.cpp
         glproc_egl.cpp
     )
 
+    add_dependencies (egltrace glproc)
+
     set_property (
         TARGET egltrace
         APPEND
@@ -496,11 +507,6 @@ add_custom_command (
     DEPENDS glstate.py specs/glparams.py specs/gltypes.py specs/stdapi.py
 )
 
-include_directories (
-    ${CMAKE_CURRENT_BINARY_DIR}
-    ${OPENGL_INCLUDE_PATH}
-)
-
 set (retrace_sources
     glretrace_gl.cpp
     glretrace_cgl.cpp
@@ -513,7 +519,6 @@ set (retrace_sources
     retrace.cpp
     retrace_stdc.cpp
     glws.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
 )
 
 add_executable (glretrace
@@ -522,6 +527,8 @@ add_executable (glretrace
     glproc_gl.cpp
 )
 
+add_dependencies (glretrace glproc)
+
 set_property (
     TARGET glretrace
     APPEND
@@ -533,14 +540,24 @@ target_link_libraries (glretrace
 )
 
 if (WIN32)
-elseif (APPLE)
+else ()
+    if (APPLE)
+        target_link_libraries (glretrace
+            "-framework Cocoa"
+            "-framework ApplicationServices" # CGS*
+            ${OPENGL_gl_LIBRARY} # CGL*
+        )
+    else ()
+        target_link_libraries (glretrace ${X11_X11_LIB})
+    endif ()
+
     target_link_libraries (glretrace
-        "-framework Cocoa"
-        "-framework ApplicationServices" # CGS*
-        ${OPENGL_gl_LIBRARY} # CGL*
+        # gdb doesn't like when pthreads is loaded through dlopen (which happens
+        # when dlopen'ing libGL), so link pthreads to avoid this issue.  See also
+        # http://stackoverflow.com/questions/2702628/gdb-cannot-find-new-threads-generic-error
+        pthread
+        dl
     )
-else ()
-    target_link_libraries (glretrace ${X11_X11_LIB})
 endif ()
 
 install (TARGETS glretrace RUNTIME DESTINATION bin) 
@@ -552,6 +569,8 @@ if (EGL_FOUND AND NOT WIN32 AND NOT APPLE)
         glproc_egl.cpp
     )
 
+    add_dependencies (eglretrace glproc)
+
     set_property (
         TARGET eglretrace
         APPEND
@@ -561,10 +580,9 @@ if (EGL_FOUND AND NOT WIN32 AND NOT APPLE)
 
     target_link_libraries (eglretrace
         common
-    )
-
-    target_link_libraries (eglretrace
         ${X11_X11_LIB}
+        pthread
+        dl
     )
 
     install (TARGETS eglretrace RUNTIME DESTINATION bin)