]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Return format info for both textures and framebuffers.
[apitrace] / CMakeLists.txt
index 19eb813df10531841f93856d320d91cea5fdcf8a..77abbe527af3bc3d4c3ee9a8e0cc06b35ceaa7db 100755 (executable)
@@ -21,6 +21,8 @@ set (ENABLE_GUI "AUTO" CACHE STRING "Enable Qt GUI.")
 ##############################################################################
 # Find dependencies
 
+include (FindPkgConfig)
+
 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
 
 set (CMAKE_USE_PYTHON_VERSION 2.7 2.6)
@@ -46,6 +48,12 @@ else ()
     set (X11_GL_LIB ${OPENGL_gl_LIBRARY})
 
     include_directories (${X11_INCLUDE_DIR})
+
+    pkg_check_modules (EGL egl)
+    if (EGL_FOUND)
+        include_directories (${EGL_INCLUDE_DIR})
+        add_definitions (-DHAVE_EGL)
+    endif ()
 endif ()
 
 
@@ -179,6 +187,8 @@ endif ()
 # For glext headers
 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
 
+# For EGL headers
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/khr)
 
 ##############################################################################
 # Installation directories
@@ -191,14 +201,19 @@ else ()
     set (DOC_INSTALL_DIR share/doc/${CMAKE_PROJECT_NAME})
 endif ()
 
+set (LIB_INSTALL_DIR lib/apitrace)
+
 if (APPLE)
     # MacOSX uses fat binaries, so no need to have per-architecture wrapper
     # directories
-    set (WRAPPER_INSTALL_DIR lib/apitrace)
+    set (LIB_ARCH_INSTALL_DIR ${LIB_INSTALL_DIR})
 else ()
-    set (WRAPPER_INSTALL_DIR lib/apitrace/${CMAKE_SYSTEM_PROCESSOR})
+    set (LIB_ARCH_INSTALL_DIR ${LIB_INSTALL_DIR}/${CMAKE_SYSTEM_PROCESSOR})
 endif ()
 
+set(SCRIPTS_INSTALL_DIR ${LIB_INSTALL_DIR}/scripts)
+set(WRAPPER_INSTALL_DIR ${LIB_ARCH_INSTALL_DIR}/wrappers)
+
 # Expose the binary/install directories to source
 #
 # TODO: Use the same directory layout, for both build and install directories,
@@ -207,6 +222,7 @@ endif ()
 add_definitions(
     -DAPITRACE_BINARY_DIR="${CMAKE_BINARY_DIR}"
     -DAPITRACE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
+    -DAPITRACE_SCRIPTS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${SCRIPTS_INSTALL_DIR}"
     -DAPITRACE_WRAPPER_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${WRAPPER_INSTALL_DIR}"
 )
 
@@ -222,7 +238,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/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/glapi.py specs/gltypes.py specs/stdapi.py
 )
 
 if (WIN32)
@@ -247,6 +263,7 @@ add_library (common STATIC
     common/trace_writer_local.cpp
     common/trace_writer_model.cpp
     common/trace_loader.cpp
+    common/trace_tools_trace.cpp
     common/image.cpp
     common/image_bmp.cpp
     common/image_pnm.cpp
@@ -402,12 +419,11 @@ else ()
     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.
-    set_target_properties (glxtrace PROPERTIES
+        # Prevent symbol relocations internal to our wrapper library to be
+        # overwritten by the application.
         LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
+        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+        LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
     )
 
     target_link_libraries (glxtrace dl ${X11_X11_LIB})
@@ -416,6 +432,42 @@ else ()
 endif ()
 
 
+if (EGL_FOUND)
+    # libEGL.so/libGL.so
+    add_custom_command (
+        OUTPUT egltrace.cpp
+        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/egltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/egltrace.cpp
+        DEPENDS egltrace.py gltrace.py trace.py specs/eglapi.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/stdapi.py
+    )
+
+    add_library (egltrace SHARED
+        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
+        egltrace.cpp
+        glcaps.cpp
+        glsnapshot.cpp
+    )
+
+    set_property (
+        TARGET egltrace
+        APPEND
+        PROPERTY COMPILE_DEFINITIONS "TRACE_EGL"
+    )
+
+    set_target_properties (egltrace PROPERTIES
+        # avoid the default "lib" prefix
+        PREFIX ""
+        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)
+
+    install (TARGETS egltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+endif ()
+
 ##############################################################################
 # API retracers
 
@@ -441,6 +493,7 @@ add_executable (glretrace
     glretrace_cgl.cpp
     glretrace_glx.cpp
     glretrace_wgl.cpp
+    glretrace_egl.cpp
     glretrace_main.cpp
     glstate.cpp
     glstate_params.cpp
@@ -480,6 +533,12 @@ install (TARGETS glretrace RUNTIME DESTINATION bin)
 
 add_subdirectory(cli)
 
+##############################################################################
+# Scripts (to support the CLI)
+
+install (PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/tracediff.sh DESTINATION ${LIB_INSTALL_DIR}/scripts)
+install (PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/jsondiff.py DESTINATION ${LIB_INSTALL_DIR}/scripts)
+
 ##############################################################################
 # GUI