]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Move tracers to wrappers subdirectory.
[apitrace] / CMakeLists.txt
old mode 100755 (executable)
new mode 100644 (file)
index 7c42200..855d73f
@@ -298,278 +298,8 @@ endif ()
 ##############################################################################
 # API tracers
 
-if (WIN32)
-    if (MINGW)
-        # Silence warnings about @nn suffix mismatch
-        set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
-    endif ()
-
-    # ddraw.dll
-    if (DirectX_D3D_INCLUDE_DIR)
-        include_directories (SYSTEM ${DirectX_D3D_INCLUDE_DIR})
-        add_custom_command (
-            OUTPUT ddrawtrace.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ddrawtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/ddrawtrace.cpp
-            DEPENDS ddrawtrace.py trace.py specs/d3d.py specs/d3dtypes.py specs/d3dcaps.py specs/ddraw.py specs/winapi.py specs/stdapi.py
-        )
-        add_library (ddraw MODULE specs/ddraw.def ddrawtrace.cpp)
-        target_link_libraries (ddraw
-            common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
-        )
-        set_target_properties (ddraw
-            PROPERTIES PREFIX ""
-            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        )
-        install (TARGETS ddraw LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-    endif ()
-
-    # d3d8.dll
-    if (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3DX9_INCLUDE_DIR)
-        include_directories (SYSTEM ${DirectX_D3D8_INCLUDE_DIR} ${DirectX_D3DX9_INCLUDE_DIR})
-        add_custom_command (
-            OUTPUT d3d8trace.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8trace.cpp
-            DEPENDS d3d8trace.py trace.py specs/d3d8.py specs/d3d8types.py specs/d3d8caps.py specs/winapi.py specs/stdapi.py
-        )
-        add_library (d3d8 MODULE specs/d3d8.def d3d8trace.cpp d3dshader.cpp)
-        target_link_libraries (d3d8
-            common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
-        )
-        set_target_properties (d3d8
-            PROPERTIES PREFIX ""
-            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        )
-        install (TARGETS d3d8 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-    endif ()
-
-    # d3d9.dll
-    if (DirectX_D3DX9_INCLUDE_DIR)
-        include_directories (SYSTEM ${DirectX_D3DX9_INCLUDE_DIR})
-        add_custom_command (
-            OUTPUT d3d9trace.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9trace.cpp
-            DEPENDS d3d9trace.py trace.py specs/d3d9.py specs/d3d9types.py specs/d3d9caps.py specs/winapi.py specs/stdapi.py
-        )
-        add_library (d3d9 MODULE specs/d3d9.def d3d9trace.cpp d3dshader.cpp)
-        target_link_libraries (d3d9
-            common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
-        )
-        set_target_properties (d3d9
-            PROPERTIES PREFIX ""
-            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        )
-        install (TARGETS d3d9 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-    endif ()
-
-    # d3d10.dll
-    if (DirectX_D3DX10_INCLUDE_DIR)
-        include_directories (SYSTEM ${DirectX_D3DX10_INCLUDE_DIR})
-        add_custom_command (
-            OUTPUT d3d10trace.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10trace.cpp
-            DEPENDS d3d10trace.py trace.py specs/d3d10misc.py specs/d3d10.py specs/d3d10sdklayers.py specs/d3dcommon.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
-        )
-        add_library (d3d10 MODULE specs/d3d10.def d3d10trace.cpp)
-        target_link_libraries (d3d10
-            common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
-        )
-        set_target_properties (d3d10
-            PROPERTIES PREFIX ""
-            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        )
-        install (TARGETS d3d10 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-    endif ()
-
-    # d3d10_1.dll
-    if (DirectX_D3DX10_INCLUDE_DIR AND DirectX_D3D10_1_INCLUDE_DIR)
-        include_directories (SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR})
-        add_custom_command (
-            OUTPUT d3d10_1trace.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10_1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10_1trace.cpp
-            DEPENDS d3d10_1trace.py trace.py specs/d3d10_1.py specs/d3d10.py specs/d3d10sdklayers.py specs/d3dcommon.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
-        )
-        add_library (d3d10_1 MODULE specs/d3d10_1.def d3d10_1trace.cpp)
-        target_link_libraries (d3d10_1
-            common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
-        )
-        set_target_properties (d3d10_1
-            PROPERTIES PREFIX ""
-            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        )
-        install (TARGETS d3d10_1 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-    endif ()
-
-    # d3d11.dll
-    if (DirectX_D3DX11_INCLUDE_DIR)
-        include_directories (SYSTEM ${DirectX_D3DX11_INCLUDE_DIR})
-        add_custom_command (
-            OUTPUT d3d11trace.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d11trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d11trace.cpp
-            DEPENDS d3d11trace.py trace.py specs/d3d11.py specs/d3d11sdklayers.py specs/d3dcommon.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
-        )
-        add_library (d3d11 MODULE specs/d3d11.def d3d11trace.cpp)
-        target_link_libraries (d3d11
-            common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
-        )
-        set_target_properties (d3d11
-            PROPERTIES PREFIX ""
-            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        )
-        install (TARGETS d3d11 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-    endif ()
-
-    # opengl32.dll
-    add_custom_command (
-        OUTPUT wgltrace.cpp
-        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/wgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/wgltrace.cpp
-        DEPENDS wgltrace.py gltrace.py trace.py specs/wglapi.py specs/wglenum.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/winapi.py specs/stdapi.py
-    )
-    add_library (wgltrace MODULE specs/opengl32.def
-        wgltrace.cpp
-        glcaps.cpp
-        glproc_gl.cpp
-    )
-    add_dependencies (wgltrace glproc)
-    target_link_libraries (wgltrace
-        common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
-    )
-    set_target_properties (wgltrace PROPERTIES
-        PREFIX ""
-        OUTPUT_NAME opengl32
-        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-    )
-    install (TARGETS wgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-
-elseif (APPLE)
-    # OpenGL framework
-    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 specs/cglapi.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/stdapi.py
-    )
-
-    add_library (cgltrace SHARED
-        cgltrace.cpp
-        glcaps.cpp
-        glproc_gl.cpp
-    )
-
-    add_dependencies (cgltrace glproc)
-
-    set_target_properties (cgltrace PROPERTIES
-        # OpenGL framework name
-        PREFIX "" OUTPUT_NAME "OpenGL" SUFFIX ""
-        # Specificy the version and reexport GLU symbols
-        LINK_FLAGS "-compatibility_version 1 -current_version 1.0.0 -Wl,-reexport_library,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib"
-        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-        LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
-    )
-
-    target_link_libraries (cgltrace
-        common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
-        ${CMAKE_THREAD_LIBS_INIT}
-        dl
-    )
-
-    install (TARGETS cgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-elseif (X11_FOUND)
-    # libGL.so
-    add_custom_command (
-        OUTPUT glxtrace.cpp
-        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glxtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glxtrace.cpp
-        DEPENDS glxtrace.py gltrace.py trace.py specs/glxapi.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/stdapi.py
-    )
-
-    add_library (glxtrace SHARED
-        glxtrace.cpp
-        glcaps.cpp
-        glproc_gl.cpp
-    )
-
-    add_dependencies (glxtrace glproc)
-
-    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.
-        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
-        common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
-        ${X11_X11_LIB}
-        ${CMAKE_THREAD_LIBS_INIT}
-        dl
-    )
-
-    install (TARGETS glxtrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-endif ()
-
-
-if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
-    # 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/glesapi.py specs/glapi.py specs/glparams.py specs/gltypes.py specs/stdapi.py
-    )
-
-    add_library (egltrace SHARED
-        egltrace.cpp
-        glcaps.cpp
-        glproc_egl.cpp
-    )
-
-    add_dependencies (egltrace glproc)
-
-    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
-        common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
-        ${CMAKE_THREAD_LIBS_INIT}
-        dl
-    )
+add_subdirectory (wrappers)
 
-    install (TARGETS egltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-endif ()
 
 ##############################################################################
 # API retracers