]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Add "apitrace diff-images" command
[apitrace] / CMakeLists.txt
index 7f74914fccb64ae4c36002ec418c116794c79341..8dd547dbf1928c009bd3c4b0ecfcf81e9896fabe 100755 (executable)
@@ -17,6 +17,8 @@ endif ()
 # prescribed in http://www.gentoo.org/proj/en/qa/automagic.xml
 set (ENABLE_GUI "AUTO" CACHE STRING "Enable Qt GUI.")
 
+set (ENABLE_EGL "AUTO" CACHE STRING "Enable EGL support.")
+
 
 ##############################################################################
 # Find dependencies
@@ -49,10 +51,17 @@ else ()
 
     include_directories (${X11_INCLUDE_DIR})
 
-    pkg_check_modules (EGL egl)
-    if (EGL_FOUND)
-        include_directories (${EGL_INCLUDE_DIR})
-        add_definitions (-DHAVE_EGL)
+    if (ENABLE_EGL)
+        if (NOT ENABLE_EGL STREQUAL "AUTO")
+            set (REQUIRE_EGL REQUIRED)
+        endif ()
+        pkg_check_modules (EGL egl ${REQUIRE_EGL})
+        if (EGL_FOUND)
+            include_directories (${EGL_INCLUDE_DIR})
+            add_definitions (-DHAVE_EGL)
+        endif ()
+    else ()
+        set (EGL_FOUND 0)
     endif ()
 endif ()
 
@@ -238,7 +247,7 @@ include_directories (
 add_custom_command (
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glproc.py > ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
-    DEPENDS glproc.py dispatch.py specs/wglapi.py specs/glxapi.py specs/cglapi.py specs/eglapi.py specs/glapi.py specs/gltypes.py specs/stdapi.py
+    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
 )
 
 if (WIN32)
@@ -456,12 +465,11 @@ if (EGL_FOUND)
     set_target_properties (egltrace PROPERTIES
         # avoid the default "lib" prefix
         PREFIX ""
-    )
-
-    # Prevent symbol relocations internal to our wrapper library to be
-    # overwritten by the application.
-    set_target_properties (egltrace PROPERTIES
         LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
+        # Prevent symbol relocations internal to our wrapper library to be
+        # overwritten by the application.
+        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+        LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
     )
 
     target_link_libraries (egltrace dl)
@@ -489,7 +497,7 @@ include_directories (
     ${OPENGL_INCLUDE_PATH}
 )
 
-add_executable (glretrace
+set (retrace_sources
     glretrace_gl.cpp
     glretrace_cgl.cpp
     glretrace_glx.cpp
@@ -501,10 +509,14 @@ add_executable (glretrace
     retrace.cpp
     retrace_stdc.cpp
     glws.cpp
-    ${glws_os}
     ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
 )
 
+add_executable (glretrace
+    ${retrace_sources}
+    ${glws_os}
+)
+
 set_property (
     TARGET glretrace
     APPEND
@@ -529,6 +541,32 @@ endif ()
 
 install (TARGETS glretrace RUNTIME DESTINATION bin) 
 
+if (EGL_FOUND AND NOT WIN32 AND NOT APPLE)
+    add_executable (eglretrace
+        ${retrace_sources}
+        glws_egl_xlib.cpp
+    )
+
+    set_property (
+        TARGET eglretrace
+        APPEND
+        PROPERTY COMPILE_DEFINITIONS "RETRACE"
+        PROPERTY COMPILE_DEFINITIONS "TRACE_EGL"
+    )
+
+    target_link_libraries (eglretrace
+        common
+    )
+
+    target_link_libraries (eglretrace
+        ${EGL_LIBRARIES}
+        ${OPENGL_gl_LIBRARY}
+        ${X11_X11_LIB}
+    )
+
+    install (TARGETS eglretrace RUNTIME DESTINATION bin) 
+endif ()
+
 ##############################################################################
 # CLI