# Common libraries / utilities
include_directories (
+ ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/common
)
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)
endif ()
add_library (common STATIC
+ common/trace_dump.cpp
common/trace_file.cpp
common/trace_file_read.cpp
common/trace_file_write.cpp
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
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 ""
)
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 ""
)
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
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
retrace.cpp
retrace_stdc.cpp
glws.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
)
add_executable (glretrace
glproc_gl.cpp
)
+add_dependencies (glretrace glproc)
+
set_property (
TARGET glretrace
APPEND
)
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)
glproc_egl.cpp
)
+ add_dependencies (eglretrace glproc)
+
set_property (
TARGET eglretrace
APPEND
target_link_libraries (eglretrace
common
- )
-
- target_link_libraries (eglretrace
${X11_X11_LIB}
+ pthread
+ dl
)
install (TARGETS eglretrace RUNTIME DESTINATION bin)