1 ##############################################################################
6 ${CMAKE_CURRENT_SOURCE_DIR}
7 ${CMAKE_SOURCE_DIR}/helpers
8 ${CMAKE_BINARY_DIR}/dispatch
9 ${CMAKE_SOURCE_DIR}/dispatch
12 add_library (common_trace STATIC
16 set_target_properties (common_trace PROPERTIES
17 # Ensure it can be statically linked in shared libraries
18 COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
21 set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
25 # Silence warnings about @nn suffix mismatch
26 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
27 set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
31 if (DirectX_D3D_INCLUDE_DIR)
32 include_directories (BEFORE SYSTEM ${DirectX_D3D_INCLUDE_DIR})
35 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ddrawtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/ddrawtrace.cpp
40 ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
41 ${CMAKE_SOURCE_DIR}/specs/d3d.py
42 ${CMAKE_SOURCE_DIR}/specs/d3dtypes.py
43 ${CMAKE_SOURCE_DIR}/specs/d3dcaps.py
44 ${CMAKE_SOURCE_DIR}/specs/ddraw.py
45 ${CMAKE_SOURCE_DIR}/specs/winapi.py
46 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
48 add_library (ddrawtrace MODULE ddraw.def ddrawtrace.cpp)
49 target_link_libraries (ddrawtrace
55 set_target_properties (ddrawtrace PROPERTIES
59 install (TARGETS ddrawtrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
63 if (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3D9_INCLUDE_DIR)
64 include_directories (BEFORE SYSTEM ${DirectX_D3D9_INCLUDE_DIR} ${DirectX_D3D8_INCLUDE_DIR})
67 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8trace.cpp
72 ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
73 ${CMAKE_SOURCE_DIR}/specs/d3d8.py
74 ${CMAKE_SOURCE_DIR}/specs/d3d8types.py
75 ${CMAKE_SOURCE_DIR}/specs/d3d8caps.py
76 ${CMAKE_SOURCE_DIR}/specs/winapi.py
77 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
79 add_library (d3d8trace MODULE
84 target_link_libraries (d3d8trace
91 set_target_properties (d3d8trace PROPERTIES
95 install (TARGETS d3d8trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
99 if (DirectX_D3D9_INCLUDE_DIR)
100 include_directories (BEFORE SYSTEM ${DirectX_D3D9_INCLUDE_DIR})
103 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9trace.cpp
108 ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
109 ${CMAKE_SOURCE_DIR}/specs/d3d9.py
110 ${CMAKE_SOURCE_DIR}/specs/d3d9types.py
111 ${CMAKE_SOURCE_DIR}/specs/d3d9caps.py
112 ${CMAKE_SOURCE_DIR}/specs/d3d9dxva2.py
113 ${CMAKE_SOURCE_DIR}/specs/winapi.py
114 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
116 add_library (d3d9trace MODULE
121 target_link_libraries (d3d9trace
128 set_target_properties (d3d9trace PROPERTIES
132 install (TARGETS d3d9trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
135 # dxgi.dll, d3d10.dll, d3d10_1.dll, d3d11.dll
137 if (DirectX_D3D10_INCLUDE_DIR)
138 set (DXGITRACE_DEF ${CMAKE_CURRENT_BINARY_DIR}/dxgitrace.def)
139 file (WRITE ${DXGITRACE_DEF} "EXPORTS\n")
140 file (APPEND ${DXGITRACE_DEF} "CreateDXGIFactory\n")
141 file (APPEND ${DXGITRACE_DEF} "CreateDXGIFactory1\n")
142 file (APPEND ${DXGITRACE_DEF} "D3D10CreateDevice\n")
143 file (APPEND ${DXGITRACE_DEF} "D3D10CreateDeviceAndSwapChain\n")
145 include_directories (BEFORE SYSTEM ${DirectX_D3D10_INCLUDE_DIR})
146 set (DXGI_MODULES d3d10)
147 if (DirectX_D3D10_1_INCLUDE_DIR)
148 include_directories (BEFORE SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR})
149 set (DXGI_MODULES ${DXGI_MODULES} d3d10_1)
150 file (APPEND ${DXGITRACE_DEF} "D3D10CreateDevice1\n")
151 file (APPEND ${DXGITRACE_DEF} "D3D10CreateDeviceAndSwapChain1\n")
153 if (DirectX_D3D11_INCLUDE_DIR)
154 include_directories (BEFORE SYSTEM ${DirectX_D3D11_INCLUDE_DIR})
155 set (DXGI_MODULES ${DXGI_MODULES} d3d11)
156 if (DirectX_D3D11_1_INCLUDE_DIR)
157 include_directories (BEFORE SYSTEM ${DirectX_D3D11_1_INCLUDE_DIR})
158 set (DXGI_MODULES ${DXGI_MODULES} d3d11_1)
160 file (APPEND ${DXGITRACE_DEF} "D3D11CreateDevice\n")
161 file (APPEND ${DXGITRACE_DEF} "D3D11CreateDeviceAndSwapChain\n")
166 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dxgitrace.py ${DXGI_MODULES} > ${CMAKE_CURRENT_BINARY_DIR}/dxgitrace.cpp
171 ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
172 ${CMAKE_SOURCE_DIR}/specs/d3d10_1.py
173 ${CMAKE_SOURCE_DIR}/specs/d3d10.py
174 ${CMAKE_SOURCE_DIR}/specs/d3d10misc.py
175 ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
176 ${CMAKE_SOURCE_DIR}/specs/d3dcommon.py
177 ${CMAKE_SOURCE_DIR}/specs/dxgi.py
178 ${CMAKE_SOURCE_DIR}/specs/dxgitype.py
179 ${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
180 ${CMAKE_SOURCE_DIR}/specs/winapi.py
181 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
183 add_library (dxgitrace SHARED
188 target_link_libraries (dxgitrace
195 set_target_properties (dxgitrace
198 install (TARGETS dxgitrace
199 RUNTIME DESTINATION ${WRAPPER_INSTALL_DIR} COMPONENT RUNTIME
200 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR} COMPONENT RUNTIME
203 # dxgi.dll (empty stub for dxgitrace.dll)
204 add_library (dxgistubs MODULE
209 target_link_libraries (dxgistubs dxgitrace)
210 set_target_properties (dxgistubs
214 install (TARGETS dxgistubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
216 # d3d10.dll (empty stub for dxgitrace.dll)
217 add_library (d3d10stubs MODULE
221 target_link_libraries (d3d10stubs dxgitrace)
222 set_target_properties (d3d10stubs
226 install (TARGETS d3d10stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
228 # d3d10_1.dll (empty stub for dxgitrace.dll)
229 if (DirectX_D3D10_1_INCLUDE_DIR)
230 add_library (d3d10_1stubs MODULE
234 target_link_libraries (d3d10_1stubs dxgitrace)
235 set_target_properties (d3d10_1stubs
239 install (TARGETS d3d10_1stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
242 # d3d11.dll (empty stub for dxgitrace.dll)
243 if (DirectX_D3D11_INCLUDE_DIR)
244 add_library (d3d11stubs MODULE
249 target_link_libraries (d3d11stubs dxgitrace)
250 set_target_properties (d3d11stubs
254 install (TARGETS d3d11stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
258 # d2d1.dll, dwrite.dll
259 if (DirectX_D2D1_INCLUDE_DIR)
260 include_directories (BEFORE SYSTEM ${DirectX_D2D1_INCLUDE_DIR})
264 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d2d1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d2d1trace.cpp
268 ${CMAKE_SOURCE_DIR}/specs/d2d1.py
269 ${CMAKE_SOURCE_DIR}/specs/d2d1.py
270 ${CMAKE_SOURCE_DIR}/specs/d2dbasetypes.py
271 ${CMAKE_SOURCE_DIR}/specs/d2derr.py
272 ${CMAKE_SOURCE_DIR}/specs/dwrite.py
273 ${CMAKE_SOURCE_DIR}/specs/dcommon.py
274 ${CMAKE_SOURCE_DIR}/specs/dxgi.py
275 ${CMAKE_SOURCE_DIR}/specs/dxgitype.py
276 ${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
277 ${CMAKE_SOURCE_DIR}/specs/winapi.py
278 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
280 add_library (d2d1trace SHARED d2d1.def d2d1trace.cpp)
281 target_link_libraries (d2d1trace
287 set_target_properties (d2d1trace
291 # http://www.cmake.org/pipermail/cmake/2009-March/028221.html
292 install (TARGETS d2d1trace
293 RUNTIME DESTINATION ${WRAPPER_INSTALL_DIR} COMPONENT RUNTIME
294 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR} COMPONENT RUNTIME
297 # dwrite.dll is just an empty stub for d2d1.dll
298 add_library (dwritetrace MODULE dwrite.def dwritetrace.cpp)
299 target_link_libraries (dwritetrace d2d1trace)
300 set_target_properties (dwritetrace
304 install (TARGETS dwritetrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
305 endif (DirectX_D2D1_INCLUDE_DIR)
310 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/wgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/wgltrace.cpp
315 ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
316 ${CMAKE_SOURCE_DIR}/specs/wglapi.py
317 ${CMAKE_SOURCE_DIR}/specs/wglenum.py
318 ${CMAKE_SOURCE_DIR}/specs/glapi.py
319 ${CMAKE_SOURCE_DIR}/specs/glparams.py
320 ${CMAKE_SOURCE_DIR}/specs/gltypes.py
321 ${CMAKE_SOURCE_DIR}/specs/winapi.py
322 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
324 add_library (wgltrace MODULE opengl32.def
329 add_dependencies (wgltrace glproc)
330 target_link_libraries (wgltrace
337 set_target_properties (wgltrace PROPERTIES
341 install (TARGETS wgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
347 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/cgltrace.cpp
352 ${CMAKE_SOURCE_DIR}/specs/cglapi.py
353 ${CMAKE_SOURCE_DIR}/specs/glapi.py
354 ${CMAKE_SOURCE_DIR}/specs/glparams.py
355 ${CMAKE_SOURCE_DIR}/specs/gltypes.py
356 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
359 add_library (cgltrace SHARED
365 add_dependencies (cgltrace glproc)
367 set_target_properties (cgltrace PROPERTIES
368 # OpenGL framework name
369 PREFIX "" OUTPUT_NAME "OpenGL" SUFFIX ""
370 # Specificy the version and reexport GLU symbols
371 LINK_FLAGS "-compatibility_version 1 -current_version 1.0.0 -Wl,-reexport_library,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib"
374 target_link_libraries (cgltrace
380 ${CMAKE_THREAD_LIBS_INIT}
384 install (TARGETS cgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
389 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glxtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glxtrace.cpp
394 ${CMAKE_SOURCE_DIR}/specs/glxapi.py
395 ${CMAKE_SOURCE_DIR}/specs/glapi.py
396 ${CMAKE_SOURCE_DIR}/specs/glparams.py
397 ${CMAKE_SOURCE_DIR}/specs/gltypes.py
398 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
401 add_library (glxtrace SHARED
407 add_dependencies (glxtrace glproc)
409 set_target_properties (glxtrace PROPERTIES
410 # avoid the default "lib" prefix
412 # Prevent symbol relocations internal to our wrapper library to be
413 # overwritten by the application.
414 LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
417 target_link_libraries (glxtrace
423 ${CMAKE_THREAD_LIBS_INIT}
427 install (TARGETS glxtrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
431 if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
435 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/egltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/egltrace.cpp
440 ${CMAKE_SOURCE_DIR}/specs/eglapi.py
441 ${CMAKE_SOURCE_DIR}/specs/glesapi.py
442 ${CMAKE_SOURCE_DIR}/specs/glapi.py
443 ${CMAKE_SOURCE_DIR}/specs/glparams.py
444 ${CMAKE_SOURCE_DIR}/specs/gltypes.py
445 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
448 add_library (egltrace SHARED
452 ${CMAKE_SOURCE_DIR}/helpers/eglsize.cpp
455 add_dependencies (egltrace glproc)
457 set_target_properties (egltrace PROPERTIES
458 # avoid the default "lib" prefix
460 # Prevent symbol relocations internal to our wrapper library to be
461 # overwritten by the application.
462 LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
465 target_link_libraries (egltrace
471 ${CMAKE_THREAD_LIBS_INIT}
475 install (TARGETS egltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})