]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Silence warnings due to unused variables.
[apitrace] / CMakeLists.txt
index 7dbd30749392de4a42fc852a840a647f3b224fb7..2f0a83a46ff2ac836ce77c1218271114cfc9a21f 100755 (executable)
@@ -8,14 +8,6 @@ project (apitrace)
 
 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
 
-# Set default built type
-if (NOT CMAKE_BUILD_TYPE)
-    set (CMAKE_BUILD_TYPE Debug
-        CACHE
-        STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
-        FORCE)
-endif (NOT CMAKE_BUILD_TYPE)
-
 set (CMAKE_USE_PYTHON_VERSION 2.6)
 
 find_package (PythonInterp REQUIRED)
@@ -158,7 +150,7 @@ endif (PNG_FOUND)
 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 wglapi.py glxapi.py glapi.py gltypes.py stdapi.py
+    DEPENDS glproc.py dispatch.py wglapi.py glxapi.py cglapi.py glapi.py gltypes.py stdapi.py
 )
 
 if (WIN32)
@@ -186,9 +178,9 @@ if (WIN32)
         add_custom_command (
             OUTPUT d3d8.cpp
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8.cpp
-            DEPENDS d3d8.py trace.py d3d8types.py d3d8caps.py d3dshader.py winapi.py stdapi.py
+            DEPENDS d3d8.py trace.py d3d8types.py d3d8caps.py winapi.py stdapi.py
         )
-        add_library (d3d8 SHARED d3d8.def d3d8.cpp trace_write.cpp os_win32.cpp)
+        add_library (d3d8 SHARED d3d8.def d3d8.cpp d3dshader.cpp trace_write.cpp os_win32.cpp)
         set_target_properties (d3d8
             PROPERTIES PREFIX ""
             RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
@@ -203,9 +195,9 @@ if (WIN32)
         add_custom_command (
             OUTPUT d3d9.cpp
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9.cpp
-            DEPENDS d3d9.py trace.py d3d9types.py d3d9caps.py d3dshader.py winapi.py stdapi.py
+            DEPENDS d3d9.py trace.py d3d9types.py d3d9caps.py winapi.py stdapi.py
         )
-        add_library (d3d9 SHARED d3d9.def d3d9.cpp trace_write.cpp os_win32.cpp)
+        add_library (d3d9 SHARED d3d9.def d3d9.cpp d3dshader.cpp trace_write.cpp os_win32.cpp)
         set_target_properties (d3d9
             PROPERTIES PREFIX ""
             RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
@@ -245,6 +237,36 @@ if (WIN32)
     endif (MINGW)
     install (TARGETS wgltrace RUNTIME DESTINATION wrappers)
 
+elseif (APPLE)
+    include_directories (${X11_INCLUDE_DIR})
+
+    # libGL.dylib
+    add_custom_command (
+        OUTPUT cgltrace.cpp
+        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/cgltrace.cpp
+        DEPENDS cgltrace.py gltrace.py trace.py glxapi.py glapi.py glparams.py gltypes.py stdapi.py
+    )
+
+    add_library (cgltrace SHARED cgltrace.cpp trace_write.cpp os_posix.cpp ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
+
+    set_target_properties (cgltrace PROPERTIES
+        # libGL.dylib
+        OUTPUT_NAME GL
+        # match the version
+        LINK_FLAGS "-compatibility_version 1 -current_version 1.0.0"
+        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+        LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+    )
+
+    target_link_libraries (cgltrace dl)
+
+    # Symbolic link from system's libGL.dylib
+    add_custom_command (
+        TARGET cgltrace
+        COMMAND ln -sf /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib ${PROJECT_BINARY_DIR}/wrappers/libGL.system.dylib
+    )
+
+    install (TARGETS cgltrace LIBRARY DESTINATION lib)
 else ()
     include_directories (${X11_INCLUDE_DIR})
 
@@ -264,11 +286,9 @@ else ()
 
     # Prevent symbol relocations internal to our wrapper library to be
     # overwritten by the application.
-    if (NOT APPLE)
-        set_target_properties (glxtrace PROPERTIES
-            LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
-        )
-    endif (NOT APPLE)
+    set_target_properties (glxtrace PROPERTIES
+        LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
+    )
 
     target_link_libraries (glxtrace dl)
     
@@ -286,8 +306,8 @@ add_custom_command (
 )
 
 add_custom_command (
-    OUTPUT glretrace_state.cpp
-    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glstate.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace_state.cpp
+    OUTPUT glstate_params.cpp
+    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glstate.py > ${CMAKE_CURRENT_BINARY_DIR}/glstate_params.cpp
     DEPENDS glstate.py glparams.py gltypes.py stdapi.py
 )
 
@@ -298,10 +318,12 @@ include_directories (
 
 add_executable (glretrace
     glretrace_gl.cpp
+    glretrace_cgl.cpp
     glretrace_glx.cpp
     glretrace_wgl.cpp
     glretrace_main.cpp
-    glretrace_state.cpp
+    glstate.cpp
+    glstate_params.cpp
     retrace.cpp
     ${glws}
     image.cpp 
@@ -325,7 +347,8 @@ if (NOT WIN32)
     # We use GLX on MacOSX, which is in a separate library
     if (APPLE)
         find_library (X11_GL_LIB GL ${X11_LIB_SEARCH_PATH})
-        target_link_libraries (glretrace ${X11_GL_LIB})
+        find_library (APPLICATIONSERVICES ApplicationServices)
+        target_link_libraries (glretrace ${X11_GL_LIB} ${APPLICATIONSERVICES})
     endif (APPLE)
 endif (NOT WIN32)
 
@@ -343,6 +366,8 @@ endif (QT4_FOUND AND QJSON_FOUND)
 ##############################################################################
 # Packaging
 
+install (FILES LICENSE README TODO DESTINATION doc)
+
 set (CPACK_PACKAGE_VERSION_MAJOR "1")
 set (CPACK_PACKAGE_VERSION_MINOR "0")