1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
##############################################################################
# API tracers
include_directories (
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/helpers
${CMAKE_BINARY_DIR}/dispatch
${CMAKE_SOURCE_DIR}/dispatch
)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if (WIN32)
if (MINGW)
# Silence warnings about @nn suffix mismatch
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
endif ()
# ddraw.dll
if (DirectX_D3D_INCLUDE_FOUND)
include_directories (BEFORE 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
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
${CMAKE_SOURCE_DIR}/specs/ddraw.py
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (ddrawtrace MODULE ddraw.def ddrawtrace.cpp)
target_link_libraries (ddrawtrace
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
)
set_target_properties (ddrawtrace PROPERTIES
PREFIX ""
OUTPUT_NAME ddraw
)
install (TARGETS ddrawtrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
install_pdb (ddrawtrace DESTINATION ${WRAPPER_INSTALL_DIR})
endif ()
# d3d8.dll
if (DirectX_D3D8_INCLUDE_FOUND AND DirectX_D3D9_INCLUDE_FOUND)
include_directories (BEFORE SYSTEM ${DirectX_D3D9_INCLUDE_DIR} ${DirectX_D3D8_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
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
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (d3d8trace MODULE
d3d8.def
d3d8trace.cpp
d3d9shader.cpp
)
target_link_libraries (d3d8trace
d3dhelpers
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
)
set_target_properties (d3d8trace PROPERTIES
PREFIX ""
OUTPUT_NAME d3d8
)
install (TARGETS d3d8trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
install_pdb (d3d8trace DESTINATION ${WRAPPER_INSTALL_DIR})
endif ()
# d3d9.dll
if (DirectX_D3D9_INCLUDE_FOUND)
include_directories (BEFORE SYSTEM ${DirectX_D3D9_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
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
${CMAKE_SOURCE_DIR}/specs/d3d9dxva2.py
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (d3d9trace MODULE
d3d9.def
d3d9trace.cpp
d3d9shader.cpp
)
target_link_libraries (d3d9trace
d3dhelpers
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
)
set_target_properties (d3d9trace PROPERTIES
PREFIX ""
OUTPUT_NAME d3d9
)
install (TARGETS d3d9trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
install_pdb (d3d9trace DESTINATION ${WRAPPER_INSTALL_DIR})
endif ()
# dxgi.dll, d3d10.dll, d3d10_1.dll, d3d11.dll
if (DirectX_D3D11_2_INCLUDE_FOUND)
include_directories (BEFORE SYSTEM ${DirectX_D3D11_2_INCLUDE_DIR})
add_custom_command (
OUTPUT dxgitrace.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dxgitrace.py > ${CMAKE_CURRENT_BINARY_DIR}/dxgitrace.cpp
DEPENDS
dxgitrace.py
dlltrace.py
trace.py
${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
${CMAKE_SOURCE_DIR}/specs/d3d11_1.py
${CMAKE_SOURCE_DIR}/specs/d3d11.py
${CMAKE_SOURCE_DIR}/specs/d3d11sdklayers.py
${CMAKE_SOURCE_DIR}/specs/d3d10_1.py
${CMAKE_SOURCE_DIR}/specs/d3d10.py
${CMAKE_SOURCE_DIR}/specs/d3d10misc.py
${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
${CMAKE_SOURCE_DIR}/specs/d3dcommon.py
${CMAKE_SOURCE_DIR}/specs/dxgi.py
${CMAKE_SOURCE_DIR}/specs/dxgitype.py
${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (dxgitrace MODULE
dxgitrace.def
dxgitrace.cpp
d3dcommonshader.cpp
)
target_link_libraries (dxgitrace
d3dhelpers
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
)
set_target_properties (dxgitrace
PROPERTIES PREFIX ""
)
install (TARGETS dxgitrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
install_pdb (dxgitrace DESTINATION ${WRAPPER_INSTALL_DIR})
endif ()
# d2d1.dll, dwrite.dll
if (DirectX_D2D1_INCLUDE_FOUND)
include_directories (BEFORE SYSTEM ${DirectX_D2D1_INCLUDE_DIR})
add_custom_command (
OUTPUT d2d1trace.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d2d1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d2d1trace.cpp
DEPENDS
d2d1trace.py
trace.py
${CMAKE_SOURCE_DIR}/specs/d2d1.py
${CMAKE_SOURCE_DIR}/specs/d2d1.py
${CMAKE_SOURCE_DIR}/specs/d2dbasetypes.py
${CMAKE_SOURCE_DIR}/specs/d2derr.py
${CMAKE_SOURCE_DIR}/specs/dwrite.py
${CMAKE_SOURCE_DIR}/specs/dcommon.py
${CMAKE_SOURCE_DIR}/specs/dxgi.py
${CMAKE_SOURCE_DIR}/specs/dxgitype.py
${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (d2d1trace MODULE d2d1trace.def d2d1trace.cpp)
target_link_libraries (d2d1trace
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
)
set_target_properties (d2d1trace
PROPERTIES PREFIX ""
)
install (TARGETS d2d1trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
install_pdb (d2d1trace DESTINATION ${WRAPPER_INSTALL_DIR})
endif (DirectX_D2D1_INCLUDE_FOUND)
# 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
${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
${CMAKE_SOURCE_DIR}/specs/wglapi.py
${CMAKE_SOURCE_DIR}/specs/wglenum.py
${CMAKE_SOURCE_DIR}/specs/glapi.py
${CMAKE_SOURCE_DIR}/specs/glparams.py
${CMAKE_SOURCE_DIR}/specs/gltypes.py
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (wgltrace MODULE opengl32.def
wgltrace.cpp
glcaps.cpp
config.cpp
gltrace_state.cpp
)
add_dependencies (wgltrace glproc)
target_link_libraries (wgltrace
glhelpers
glproc_gl
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
)
set_target_properties (wgltrace PROPERTIES
PREFIX ""
OUTPUT_NAME opengl32
)
install (TARGETS wgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
install_pdb (wgltrace 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
${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
${CMAKE_SOURCE_DIR}/specs/cglapi.py
${CMAKE_SOURCE_DIR}/specs/glapi.py
${CMAKE_SOURCE_DIR}/specs/glparams.py
${CMAKE_SOURCE_DIR}/specs/gltypes.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (cgltrace SHARED
cgltrace.cpp
glcaps.cpp
config.cpp
gltrace_state.cpp
)
add_dependencies (cgltrace glproc)
set_target_properties (cgltrace PROPERTIES
# OpenGL framework name
OUTPUT_NAME "OpenGL"
# Mac framework
FRAMEWORK true
# 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"
)
target_link_libraries (cgltrace
glhelpers
glproc_gl
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
dl
)
install (TARGETS cgltrace FRAMEWORK 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
${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
${CMAKE_SOURCE_DIR}/specs/glxapi.py
${CMAKE_SOURCE_DIR}/specs/glapi.py
${CMAKE_SOURCE_DIR}/specs/glparams.py
${CMAKE_SOURCE_DIR}/specs/gltypes.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (glxtrace SHARED
glxtrace.cpp
glcaps.cpp
config.cpp
gltrace_state.cpp
dlsym.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. And fail if there are missing
# symbols.
LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,defs"
)
target_link_libraries (glxtrace
glhelpers
glproc_gl
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
${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
${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
${CMAKE_SOURCE_DIR}/specs/eglapi.py
${CMAKE_SOURCE_DIR}/specs/eglenum.py
${CMAKE_SOURCE_DIR}/specs/glapi.py
${CMAKE_SOURCE_DIR}/specs/glparams.py
${CMAKE_SOURCE_DIR}/specs/gltypes.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
add_library (egltrace SHARED
egltrace.cpp
glcaps.cpp
config.cpp
gltrace_state.cpp
dlsym.cpp
)
add_dependencies (egltrace glproc)
set_target_properties (egltrace PROPERTIES
# avoid the default "lib" prefix
PREFIX ""
# Prevent symbol relocations internal to our wrapper library to be
# overwritten by the application. And fail if there are missing
# symbols.
LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,defs"
)
target_link_libraries (egltrace
glhelpers
glproc_egl
common
${ZLIB_LIBRARIES}
${SNAPPY_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
dl
)
install (TARGETS egltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
endif ()
|