Move dispatch to its own subdirectory.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 14 Apr 2012 17:13:25 +0000 (18:13 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 14 Apr 2012 17:13:25 +0000 (18:13 +0100)
.gitignore
CMakeLists.txt
dispatch/.gitignore [new file with mode: 0644]
dispatch/CMakeLists.txt [new file with mode: 0644]
dispatch/__init__.py [new file with mode: 0644]
dispatch/dispatch.py [moved from dispatch.py with 97% similarity]
dispatch/glproc.py [moved from glproc.py with 100% similarity]
dispatch/glproc_egl.cpp [moved from glproc_egl.cpp with 100% similarity]
dispatch/glproc_gl.cpp [moved from glproc_gl.cpp with 100% similarity]
retrace/CMakeLists.txt
wrappers/CMakeLists.txt

index 93f029e..1e6d570 100644 (file)
@@ -32,7 +32,6 @@ apitrace
 build
 dxsdk
 eglretrace
-glproc.hpp
 glretrace
 install_manifest.txt
 qapitrace
index 1d5c99f..f817701 100644 (file)
@@ -237,17 +237,6 @@ include_directories (
     ${CMAKE_CURRENT_SOURCE_DIR}/common
 )
 
-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/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)
@@ -296,14 +285,10 @@ endif ()
 
 
 ##############################################################################
-# API tracers
+# Sub-directories
 
+add_subdirectory (dispatch)
 add_subdirectory (wrappers)
-
-
-##############################################################################
-# API retracers
-
 add_subdirectory (retrace)
 
 
diff --git a/dispatch/.gitignore b/dispatch/.gitignore
new file mode 100644 (file)
index 0000000..213c471
--- /dev/null
@@ -0,0 +1 @@
+glproc.hpp
diff --git a/dispatch/CMakeLists.txt b/dispatch/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0dad67f
--- /dev/null
@@ -0,0 +1,55 @@
+##############################################################################
+# Dispatch
+
+include_directories (
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+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
+        ${CMAKE_SOURCE_DIR}/specs/wglapi.py
+        ${CMAKE_SOURCE_DIR}/specs/glxapi.py
+        ${CMAKE_SOURCE_DIR}/specs/cglapi.py
+        ${CMAKE_SOURCE_DIR}/specs/eglapi.py
+        ${CMAKE_SOURCE_DIR}/specs/glesapi.py
+        ${CMAKE_SOURCE_DIR}/specs/glapi.py
+        ${CMAKE_SOURCE_DIR}/specs/gltypes.py
+        ${CMAKE_SOURCE_DIR}/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)
+
+
+add_library (glproc_gl STATIC EXCLUDE_FROM_ALL
+    glproc_gl.cpp
+)
+
+add_dependencies (glproc_gl glproc)
+
+set_target_properties (glproc_gl PROPERTIES
+    # Ensure it can be statically linked in shared libraries
+    COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
+)
+
+if (ENABLE_EGL)
+    add_library (glproc_egl STATIC EXCLUDE_FROM_ALL
+        glproc_egl.cpp
+    )
+
+    add_dependencies (glproc_egl glproc)
+
+    set_target_properties (glproc_egl PROPERTIES
+        # Ensure it can be statically linked in shared libraries
+        COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
+    )
+endif ()
+
diff --git a/dispatch/__init__.py b/dispatch/__init__.py
new file mode 100644 (file)
index 0000000..b872135
--- /dev/null
@@ -0,0 +1 @@
+from dispatch import *
similarity index 97%
rename from dispatch.py
rename to dispatch/dispatch.py
index 95bc36d..491db91 100644 (file)
 """ 
 
 
+# Adjust path
+import os.path
+import sys
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
+
+
 import specs.stdapi as stdapi
 
 
similarity index 100%
rename from glproc.py
rename to dispatch/glproc.py
index b54f713..35ccf61 100644 (file)
--- a/glproc.py
@@ -29,8 +29,8 @@ covers all the functions we support.
 """ 
 
 
-import specs.stdapi as stdapi
 from dispatch import Dispatcher
+import specs.stdapi as stdapi
 from specs.glapi import glapi
 from specs.glxapi import glxapi
 from specs.wglapi import wglapi
similarity index 100%
rename from glproc_egl.cpp
rename to dispatch/glproc_egl.cpp
similarity index 100%
rename from glproc_gl.cpp
rename to dispatch/glproc_gl.cpp
index 358361e..644fe98 100644 (file)
@@ -1,7 +1,10 @@
 ##############################################################################
 # API retracers
 
-include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+include_directories (
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_BINARY_DIR}/dispatch
+)
 
 add_definitions (-DRETRACE)
 
@@ -47,13 +50,13 @@ add_dependencies (retrace_common glproc)
 if (WIN32 OR APPLE OR X11_FOUND)
     add_executable (glretrace
         ${glws_os}
-        ${CMAKE_SOURCE_DIR}/glproc_gl.cpp
     )
 
     add_dependencies (glretrace glproc)
 
     target_link_libraries (glretrace
         retrace_common
+        glproc_gl
         common
         ${PNG_LIBRARIES}
         ${ZLIB_LIBRARIES}
@@ -92,13 +95,13 @@ endif ()
 if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE)
     add_executable (eglretrace
         glws_egl_xlib.cpp
-        ${CMAKE_SOURCE_DIR}/glproc_egl.cpp
     )
 
     add_dependencies (eglretrace glproc)
 
     target_link_libraries (eglretrace
         retrace_common
+        glproc_egl
         common
         ${PNG_LIBRARIES}
         ${ZLIB_LIBRARIES}
@@ -121,7 +124,9 @@ if (WIN32 AND DirectX_D3DX9_INCLUDE_DIR)
         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3dretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d9.cpp
         DEPENDS
                 d3dretrace.py
+                dllretrace.py
                 retrace.py
+                ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d9.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d9types.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d9caps.py
index d47dc6d..2e8a095 100644 (file)
@@ -2,7 +2,10 @@
 # API tracers
 
 
-include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+include_directories (
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_BINARY_DIR}/dispatch
+)
 
 
 if (WIN32)
@@ -19,7 +22,9 @@ if (WIN32)
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ddrawtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/ddrawtrace.cpp
             DEPENDS
                 ddrawtrace.py
+                dlltrace.py
                 trace.py
+                ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d.py
                 ${CMAKE_SOURCE_DIR}/specs/d3dtypes.py
                 ${CMAKE_SOURCE_DIR}/specs/d3dcaps.py
@@ -47,7 +52,9 @@ if (WIN32)
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8trace.cpp
             DEPENDS
                 d3d8trace.py
+                dlltrace.py
                 trace.py
+                ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d8.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d8types.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d8caps.py
@@ -74,7 +81,9 @@ if (WIN32)
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9trace.cpp
             DEPENDS
                 d3d9trace.py
+                dlltrace.py
                 trace.py
+                ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d9.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d9types.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d9caps.py
@@ -101,7 +110,9 @@ if (WIN32)
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10trace.cpp
             DEPENDS
                 d3d10trace.py
+                dlltrace.py
                 trace.py
+                ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10misc.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
@@ -132,7 +143,9 @@ if (WIN32)
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10_1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10_1trace.cpp
             DEPENDS
                 d3d10_1trace.py
+                dlltrace.py
                 trace.py
+                ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10_1.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
@@ -163,6 +176,7 @@ if (WIN32)
             COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d11trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d11trace.cpp
             DEPENDS
                 d3d11trace.py
+                dlltrace.py
                 trace.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d11.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d11sdklayers.py
@@ -193,6 +207,7 @@ if (WIN32)
                 wgltrace.py
                 gltrace.py
                 trace.py
+                ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
                 ${CMAKE_SOURCE_DIR}/specs/wglapi.py
                 ${CMAKE_SOURCE_DIR}/specs/wglenum.py
                 ${CMAKE_SOURCE_DIR}/specs/glapi.py
@@ -204,10 +219,10 @@ if (WIN32)
     add_library (wgltrace MODULE opengl32.def
         wgltrace.cpp
         glcaps.cpp
-        ${CMAKE_SOURCE_DIR}/glproc_gl.cpp
     )
     add_dependencies (wgltrace glproc)
     target_link_libraries (wgltrace
+        glproc_gl
         common
         ${ZLIB_LIBRARIES}
         ${SNAPPY_LIBRARIES}
@@ -237,7 +252,6 @@ elseif (APPLE)
     add_library (cgltrace SHARED
         cgltrace.cpp
         glcaps.cpp
-        ${CMAKE_SOURCE_DIR}/glproc_gl.cpp
     )
 
     add_dependencies (cgltrace glproc)
@@ -250,6 +264,7 @@ elseif (APPLE)
     )
 
     target_link_libraries (cgltrace
+        glproc_gl
         common
         ${ZLIB_LIBRARIES}
         ${SNAPPY_LIBRARIES}
@@ -277,7 +292,6 @@ elseif (X11_FOUND)
     add_library (glxtrace SHARED
         glxtrace.cpp
         glcaps.cpp
-        ${CMAKE_SOURCE_DIR}/glproc_gl.cpp
     )
 
     add_dependencies (glxtrace glproc)
@@ -291,6 +305,7 @@ elseif (X11_FOUND)
     )
 
     target_link_libraries (glxtrace
+        glproc_gl
         common
         ${ZLIB_LIBRARIES}
         ${SNAPPY_LIBRARIES}
@@ -323,7 +338,6 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
     add_library (egltrace SHARED
         egltrace.cpp
         glcaps.cpp
-        ${CMAKE_SOURCE_DIR}/glproc_egl.cpp
     )
 
     add_dependencies (egltrace glproc)
@@ -337,6 +351,7 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
     )
 
     target_link_libraries (egltrace
+        glproc_egl
         common
         ${ZLIB_LIBRARIES}
         ${SNAPPY_LIBRARIES}