From 9d27a54b0381610c30964880a5fdd4c27bb6e732 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 14 Apr 2012 17:22:57 +0100 Subject: [PATCH] Move retracers to their own directory. --- .gitignore | 2 - CMakeLists.txt | 140 +---------------- retrace/.gitignore | 2 + retrace/CMakeLists.txt | 146 ++++++++++++++++++ d3dretrace.hpp => retrace/d3dretrace.hpp | 0 d3dretrace.py => retrace/d3dretrace.py | 2 +- .../d3dretrace_main.cpp | 0 glretrace.hpp => retrace/glretrace.hpp | 0 glretrace.py => retrace/glretrace.py | 2 +- .../glretrace_cgl.cpp | 0 .../glretrace_egl.cpp | 0 .../glretrace_glx.cpp | 0 .../glretrace_main.cpp | 0 .../glretrace_wgl.cpp | 0 glstate.cpp => retrace/glstate.cpp | 0 glstate.hpp => retrace/glstate.hpp | 0 .../glstate_images.cpp | 0 .../glstate_internal.hpp | 0 .../glstate_params.py | 2 + .../glstate_shaders.cpp | 0 glws.cpp => retrace/glws.cpp | 0 glws.hpp => retrace/glws.hpp | 0 glws_cocoa.mm => retrace/glws_cocoa.mm | 0 .../glws_egl_xlib.cpp | 0 glws_glx.cpp => retrace/glws_glx.cpp | 0 glws_wgl.cpp => retrace/glws_wgl.cpp | 0 retrace.cpp => retrace/retrace.cpp | 0 retrace.hpp => retrace/retrace.hpp | 0 retrace.py => retrace/retrace.py | 4 + retrace_stdc.cpp => retrace/retrace_stdc.cpp | 0 30 files changed, 157 insertions(+), 143 deletions(-) create mode 100644 retrace/.gitignore create mode 100644 retrace/CMakeLists.txt rename d3dretrace.hpp => retrace/d3dretrace.hpp (100%) rename d3dretrace.py => retrace/d3dretrace.py (100%) rename d3dretrace_main.cpp => retrace/d3dretrace_main.cpp (100%) rename glretrace.hpp => retrace/glretrace.hpp (100%) rename glretrace.py => retrace/glretrace.py (100%) rename glretrace_cgl.cpp => retrace/glretrace_cgl.cpp (100%) rename glretrace_egl.cpp => retrace/glretrace_egl.cpp (100%) rename glretrace_glx.cpp => retrace/glretrace_glx.cpp (100%) rename glretrace_main.cpp => retrace/glretrace_main.cpp (100%) rename glretrace_wgl.cpp => retrace/glretrace_wgl.cpp (100%) rename glstate.cpp => retrace/glstate.cpp (100%) rename glstate.hpp => retrace/glstate.hpp (100%) rename glstate_images.cpp => retrace/glstate_images.cpp (100%) rename glstate_internal.hpp => retrace/glstate_internal.hpp (100%) rename glstate_params.py => retrace/glstate_params.py (99%) rename glstate_shaders.cpp => retrace/glstate_shaders.cpp (100%) rename glws.cpp => retrace/glws.cpp (100%) rename glws.hpp => retrace/glws.hpp (100%) rename glws_cocoa.mm => retrace/glws_cocoa.mm (100%) rename glws_egl_xlib.cpp => retrace/glws_egl_xlib.cpp (100%) rename glws_glx.cpp => retrace/glws_glx.cpp (100%) rename glws_wgl.cpp => retrace/glws_wgl.cpp (100%) rename retrace.cpp => retrace/retrace.cpp (100%) rename retrace.hpp => retrace/retrace.hpp (100%) rename retrace.py => retrace/retrace.py (99%) rename retrace_stdc.cpp => retrace/retrace_stdc.cpp (100%) diff --git a/.gitignore b/.gitignore index 25f71f6..93f029e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,8 +34,6 @@ dxsdk eglretrace glproc.hpp glretrace -glretrace_gl.cpp -glstate_params.cpp install_manifest.txt qapitrace traces diff --git a/CMakeLists.txt b/CMakeLists.txt index 855d73f..1d5c99f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,146 +304,8 @@ add_subdirectory (wrappers) ############################################################################## # API retracers -add_custom_command ( - OUTPUT glretrace_gl.cpp - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace_gl.cpp - DEPENDS glretrace.py retrace.py specs/glapi.py specs/gltypes.py specs/stdapi.py -) - -add_custom_command ( - OUTPUT glstate_params.cpp - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glstate_params.py > ${CMAKE_CURRENT_BINARY_DIR}/glstate_params.cpp - DEPENDS glstate_params.py specs/glparams.py specs/gltypes.py specs/stdapi.py -) - -add_library (retrace_common - glretrace_gl.cpp - glretrace_cgl.cpp - glretrace_glx.cpp - glretrace_wgl.cpp - glretrace_egl.cpp - glretrace_main.cpp - glstate.cpp - glstate_images.cpp - glstate_params.cpp - glstate_shaders.cpp - retrace.cpp - retrace_stdc.cpp - glws.cpp -) - -add_dependencies (retrace_common glproc) - -set_property ( - TARGET retrace_common - APPEND - PROPERTY COMPILE_DEFINITIONS "RETRACE" -) - -if (WIN32 OR APPLE OR X11_FOUND) - add_executable (glretrace - ${glws_os} - glproc_gl.cpp - ) - - add_dependencies (glretrace glproc) - - set_property ( - TARGET glretrace - APPEND - PROPERTY COMPILE_DEFINITIONS "RETRACE" - ) - - target_link_libraries (glretrace - retrace_common - common - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${SNAPPY_LIBRARIES} - ) +add_subdirectory (retrace) - if (WIN32) - else () - if (APPLE) - target_link_libraries (glretrace - "-framework Cocoa" - "-framework ApplicationServices" # CGS* - #"-framework OpenGL" # CGL* - ) - else () - target_link_libraries (glretrace ${X11_X11_LIB}) - endif () - - target_link_libraries (glretrace - # 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 - ${CMAKE_THREAD_LIBS_INIT} - dl - ) - - if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries (glretrace rt) - endif () - - endif () - - install (TARGETS glretrace RUNTIME DESTINATION bin) -endif () - -if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE) - add_executable (eglretrace - glws_egl_xlib.cpp - glproc_egl.cpp - ) - - add_dependencies (eglretrace glproc) - - set_property ( - TARGET eglretrace - APPEND - PROPERTY COMPILE_DEFINITIONS "RETRACE" - ) - - target_link_libraries (eglretrace - retrace_common - common - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${SNAPPY_LIBRARIES} - ${X11_X11_LIB} - ${CMAKE_THREAD_LIBS_INIT} - dl - ) - - if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries (eglretrace rt) - endif () - - install (TARGETS eglretrace RUNTIME DESTINATION bin) -endif () - -if (WIN32 AND DirectX_D3DX9_FOUND) - add_custom_command ( - OUTPUT d3dretrace_d3d9.cpp - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3dretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d9.cpp - DEPENDS d3dretrace.py retrace.py specs/d3d9.py specs/d3d9types.py specs/d3d9caps.py specs/winapi.py specs/stdapi.py - ) - - include_directories (SYSTEM ${DirectX_D3DX9_INCLUDE_DIR}) - add_executable (d3dretrace - retrace.cpp - retrace_stdc.cpp - d3dretrace_main.cpp - d3dretrace_d3d9.cpp - ) - target_link_libraries (d3dretrace - common - ${ZLIB_LIBRARIES} - ${SNAPPY_LIBRARIES} - ${DirectX_D3D9_LIBRARY} - ) -endif () ############################################################################## # CLI diff --git a/retrace/.gitignore b/retrace/.gitignore new file mode 100644 index 0000000..ebcad87 --- /dev/null +++ b/retrace/.gitignore @@ -0,0 +1,2 @@ +glretrace_gl.cpp +glstate_params.cpp diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt new file mode 100644 index 0000000..c45b33f --- /dev/null +++ b/retrace/CMakeLists.txt @@ -0,0 +1,146 @@ +############################################################################## +# API retracers + +include_directories (${CMAKE_CURRENT_SOURCE_DIR}) + +add_definitions (-DRETRACE) + +add_custom_command ( + OUTPUT glretrace_gl.cpp + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace_gl.cpp + DEPENDS + glretrace.py + retrace.py + ${CMAKE_SOURCE_DIR}/specs/glapi.py + ${CMAKE_SOURCE_DIR}/specs/gltypes.py + ${CMAKE_SOURCE_DIR}/specs/stdapi.py +) + +add_custom_command ( + OUTPUT glstate_params.cpp + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glstate_params.py > ${CMAKE_CURRENT_BINARY_DIR}/glstate_params.cpp + DEPENDS + glstate_params.py + ${CMAKE_SOURCE_DIR}/specs/glparams.py + ${CMAKE_SOURCE_DIR}/specs/gltypes.py + ${CMAKE_SOURCE_DIR}/specs/stdapi.py +) + +add_library (retrace_common + glretrace_gl.cpp + glretrace_cgl.cpp + glretrace_glx.cpp + glretrace_wgl.cpp + glretrace_egl.cpp + glretrace_main.cpp + glstate.cpp + glstate_images.cpp + glstate_params.cpp + glstate_shaders.cpp + retrace.cpp + retrace_stdc.cpp + glws.cpp +) + +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 + common + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${SNAPPY_LIBRARIES} + ) + + if (WIN32) + else () + if (APPLE) + target_link_libraries (glretrace + "-framework Cocoa" + "-framework ApplicationServices" # CGS* + #"-framework OpenGL" # CGL* + ) + else () + target_link_libraries (glretrace ${X11_X11_LIB}) + endif () + + target_link_libraries (glretrace + # 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 + ${CMAKE_THREAD_LIBS_INIT} + dl + ) + + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries (glretrace rt) + endif () + + endif () + + install (TARGETS glretrace RUNTIME DESTINATION bin) +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 + common + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${SNAPPY_LIBRARIES} + ${X11_X11_LIB} + ${CMAKE_THREAD_LIBS_INIT} + dl + ) + + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries (eglretrace rt) + endif () + + install (TARGETS eglretrace RUNTIME DESTINATION bin) +endif () + +if (WIN32 AND DirectX_D3DX9_FOUND) + add_custom_command ( + OUTPUT d3dretrace_d3d9.cpp + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3dretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d9.cpp + DEPENDS + d3dretrace.py + retrace.py + ${CMAKE_SOURCE_DIR}/specs/d3d9.py + ${CMAKE_SOURCE_DIR}/specs/d3d9types.py + ${CMAKE_SOURCE_DIR}/specs/d3d9caps.py + ${CMAKE_SOURCE_DIR}/specs/winapi.py + ${CMAKE_SOURCE_DIR}/specs/stdapi.py + ) + + include_directories (SYSTEM ${DirectX_D3DX9_INCLUDE_DIR}) + add_executable (d3dretrace + retrace.cpp + retrace_stdc.cpp + d3dretrace_main.cpp + d3dretrace_d3d9.cpp + ) + target_link_libraries (d3dretrace + common + ${ZLIB_LIBRARIES} + ${SNAPPY_LIBRARIES} + ${DirectX_D3D9_LIBRARY} + ) +endif () + diff --git a/d3dretrace.hpp b/retrace/d3dretrace.hpp similarity index 100% rename from d3dretrace.hpp rename to retrace/d3dretrace.hpp diff --git a/d3dretrace.py b/retrace/d3dretrace.py similarity index 100% rename from d3dretrace.py rename to retrace/d3dretrace.py index a2ea75e..f472a0a 100644 --- a/d3dretrace.py +++ b/retrace/d3dretrace.py @@ -27,9 +27,9 @@ """GL retracer generator.""" +from retrace import Retracer import specs.stdapi as stdapi from specs.d3d9 import d3d9 -from retrace import Retracer class D3DRetracer(Retracer): diff --git a/d3dretrace_main.cpp b/retrace/d3dretrace_main.cpp similarity index 100% rename from d3dretrace_main.cpp rename to retrace/d3dretrace_main.cpp diff --git a/glretrace.hpp b/retrace/glretrace.hpp similarity index 100% rename from glretrace.hpp rename to retrace/glretrace.hpp diff --git a/glretrace.py b/retrace/glretrace.py similarity index 100% rename from glretrace.py rename to retrace/glretrace.py index d91c8a2..21fc499 100644 --- a/glretrace.py +++ b/retrace/glretrace.py @@ -27,10 +27,10 @@ """GL retracer generator.""" +from retrace import Retracer import specs.stdapi as stdapi import specs.glapi as glapi import specs.glesapi as glesapi -from retrace import Retracer class GlRetracer(Retracer): diff --git a/glretrace_cgl.cpp b/retrace/glretrace_cgl.cpp similarity index 100% rename from glretrace_cgl.cpp rename to retrace/glretrace_cgl.cpp diff --git a/glretrace_egl.cpp b/retrace/glretrace_egl.cpp similarity index 100% rename from glretrace_egl.cpp rename to retrace/glretrace_egl.cpp diff --git a/glretrace_glx.cpp b/retrace/glretrace_glx.cpp similarity index 100% rename from glretrace_glx.cpp rename to retrace/glretrace_glx.cpp diff --git a/glretrace_main.cpp b/retrace/glretrace_main.cpp similarity index 100% rename from glretrace_main.cpp rename to retrace/glretrace_main.cpp diff --git a/glretrace_wgl.cpp b/retrace/glretrace_wgl.cpp similarity index 100% rename from glretrace_wgl.cpp rename to retrace/glretrace_wgl.cpp diff --git a/glstate.cpp b/retrace/glstate.cpp similarity index 100% rename from glstate.cpp rename to retrace/glstate.cpp diff --git a/glstate.hpp b/retrace/glstate.hpp similarity index 100% rename from glstate.hpp rename to retrace/glstate.hpp diff --git a/glstate_images.cpp b/retrace/glstate_images.cpp similarity index 100% rename from glstate_images.cpp rename to retrace/glstate_images.cpp diff --git a/glstate_internal.hpp b/retrace/glstate_internal.hpp similarity index 100% rename from glstate_internal.hpp rename to retrace/glstate_internal.hpp diff --git a/glstate_params.py b/retrace/glstate_params.py similarity index 99% rename from glstate_params.py rename to retrace/glstate_params.py index 7c29932..e1f90d0 100644 --- a/glstate_params.py +++ b/retrace/glstate_params.py @@ -27,6 +27,8 @@ '''Generate code to dump most GL state into JSON.''' +import retrace # to adjust sys.path + from specs.stdapi import * from specs.gltypes import * diff --git a/glstate_shaders.cpp b/retrace/glstate_shaders.cpp similarity index 100% rename from glstate_shaders.cpp rename to retrace/glstate_shaders.cpp diff --git a/glws.cpp b/retrace/glws.cpp similarity index 100% rename from glws.cpp rename to retrace/glws.cpp diff --git a/glws.hpp b/retrace/glws.hpp similarity index 100% rename from glws.hpp rename to retrace/glws.hpp diff --git a/glws_cocoa.mm b/retrace/glws_cocoa.mm similarity index 100% rename from glws_cocoa.mm rename to retrace/glws_cocoa.mm diff --git a/glws_egl_xlib.cpp b/retrace/glws_egl_xlib.cpp similarity index 100% rename from glws_egl_xlib.cpp rename to retrace/glws_egl_xlib.cpp diff --git a/glws_glx.cpp b/retrace/glws_glx.cpp similarity index 100% rename from glws_glx.cpp rename to retrace/glws_glx.cpp diff --git a/glws_wgl.cpp b/retrace/glws_wgl.cpp similarity index 100% rename from glws_wgl.cpp rename to retrace/glws_wgl.cpp diff --git a/retrace.cpp b/retrace/retrace.cpp similarity index 100% rename from retrace.cpp rename to retrace/retrace.cpp diff --git a/retrace.hpp b/retrace/retrace.hpp similarity index 100% rename from retrace.hpp rename to retrace/retrace.hpp diff --git a/retrace.py b/retrace/retrace.py similarity index 99% rename from retrace.py rename to retrace/retrace.py index 9e9af20..369c13b 100644 --- a/retrace.py +++ b/retrace/retrace.py @@ -27,7 +27,11 @@ """Generic retracing code generator.""" +# Adjust path +import os.path import sys +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) + import specs.stdapi as stdapi import specs.glapi as glapi diff --git a/retrace_stdc.cpp b/retrace/retrace_stdc.cpp similarity index 100% rename from retrace_stdc.cpp rename to retrace/retrace_stdc.cpp -- 2.43.0