X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=CMakeLists.txt;h=67507e2255e0c67c43553027e65e00c325c915c7;hb=46d058aee0bbd5934ebd882fba556fdeb8de383d;hp=710c626ec7dbc465c626e137c2aac754038fc478;hpb=d31700077ae75f450b12ad7d9276c08cbad57d1b;p=apitrace diff --git a/CMakeLists.txt b/CMakeLists.txt index 710c626..67507e2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -378,8 +384,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 @@ -400,9 +406,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 "" @@ -424,12 +431,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 "" @@ -455,12 +463,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 @@ -497,11 +506,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 @@ -514,7 +518,6 @@ set (retrace_sources retrace.cpp retrace_stdc.cpp glws.cpp - ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp ) add_executable (glretrace @@ -523,6 +526,8 @@ add_executable (glretrace glproc_gl.cpp ) +add_dependencies (glretrace glproc) + set_property ( TARGET glretrace APPEND @@ -534,14 +539,21 @@ target_link_libraries (glretrace ) if (WIN32) -elseif (APPLE) - target_link_libraries (glretrace - "-framework Cocoa" - "-framework ApplicationServices" # CGS* - ${OPENGL_gl_LIBRARY} # CGL* - ) else () - target_link_libraries (glretrace ${X11_X11_LIB}) + if (APPLE) + target_link_libraries (glretrace + "-framework Cocoa" + "-framework ApplicationServices" # CGS* + ${OPENGL_gl_LIBRARY} # CGL* + ) + else () + target_link_libraries (glretrace ${X11_X11_LIB}) + endif () + + # 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 + target_link_libraries (glretrace pthread) endif () install (TARGETS glretrace RUNTIME DESTINATION bin) @@ -553,6 +565,8 @@ if (EGL_FOUND AND NOT WIN32 AND NOT APPLE) glproc_egl.cpp ) + add_dependencies (eglretrace glproc) + set_property ( TARGET eglretrace APPEND @@ -562,10 +576,8 @@ if (EGL_FOUND AND NOT WIN32 AND NOT APPLE) target_link_libraries (eglretrace common - ) - - target_link_libraries (eglretrace ${X11_X11_LIB} + pthread ) install (TARGETS eglretrace RUNTIME DESTINATION bin)