summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore17
-rw-r--r--CMakeLists.txt45
-rw-r--r--cmake/FindDirectX.cmake108
3 files changed, 160 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 32ddb972..47f025e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,20 +16,21 @@
*.pyo
*.so
*.zip
-CMakeFiles
CMakeCache.txt
-cmake_install.cmake
-Makefile
+CMakeFiles
MD5SUM
+Makefile
+build
+cmake_install.cmake
config.log
-ddraw.cpp
-d3d8.cpp
-d3d9.cpp
d3d10.cpp
d3d10_1.cpp
-dxsdk
+d3d8.cpp
+d3d9.cpp
+ddraw.cpp
dump
-glx.cpp
+dxsdk
glretrace
glretrace.cpp
+glx.cpp
opengl32.cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 41f896bd..26427088 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,10 +2,14 @@ cmake_minimum_required (VERSION 2.6)
project (apitrace)
+set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+
find_package (PythonInterp REQUIRED)
find_package (OpenGL REQUIRED)
find_package (ZLIB)
+find_package (DirectX)
+
find_package (GLUT)
find_library (GLEW_glew_LIBRARY GLEW
@@ -43,11 +47,13 @@ if (MSVC)
# Enable math constants defines
add_definitions (-D_USE_MATH_DEFINES)
- # Silence several MSVC pedantic warnings
+ # Adjust warnings
add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
-
add_definitions (-W4)
+ add_definitions (-wd4244) # conversion from 'type1' to 'type2', possible loss of data
+ add_definitions (-wd4505) # unreferenced local function has been removed
+ add_definitions (-wd4800) # forcing value to bool 'true' or 'false' (performance warning)
else ()
add_definitions (-Wall)
endif ()
@@ -79,6 +85,41 @@ endif (NOT ZLIB_FOUND)
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ # d3d8.dll
+ if (D3D8_FOUND)
+ include_directories (${D3D8_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d8.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8.cpp
+ DEPENDS d3d8.py d3d8types.py d3d8caps.py windows.py base.py
+ )
+ add_library (d3d8 SHARED d3d8.def d3d8.cpp log.cpp os_win32.cpp)
+ set_target_properties (d3d8 PROPERTIES PREFIX "")
+ endif (D3D8_FOUND)
+
+ # d3d9.dll
+ if (D3DX9_FOUND)
+ include_directories (${D3DX9_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d9.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9.cpp
+ DEPENDS d3d9.py d3d9types.py d3d9caps.py d3dshader.py windows.py base.py
+ )
+ add_library (d3d9 SHARED d3d9.def d3d9.cpp log.cpp os_win32.cpp)
+ set_target_properties (d3d9 PROPERTIES PREFIX "")
+ endif (D3DX9_FOUND)
+
+ # d3d10.dll
+ if (D3D10_FOUND)
+ include_directories (${D3D10_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d10.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10misc.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10.cpp
+ DEPENDS d3d10misc.py windows.py base.py
+ )
+ add_library (d3d10 SHARED d3d10.def d3d10.cpp log.cpp os_win32.cpp)
+ set_target_properties (d3d10 PROPERTIES PREFIX "")
+ endif (D3D10_FOUND)
# opengl32.dll
add_custom_command (
diff --git a/cmake/FindDirectX.cmake b/cmake/FindDirectX.cmake
new file mode 100644
index 00000000..f306bd10
--- /dev/null
+++ b/cmake/FindDirectX.cmake
@@ -0,0 +1,108 @@
+# - try to find DirectX include dirs and libraries
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ find_path (D3D8_INCLUDE_DIR d3d8.h
+ PATHS
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
+ DOC "The directory where d3d8.h resides")
+
+ find_path (D3DX8_INCLUDE_DIR d3dx8.h
+ PATHS
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
+ DOC "The directory where d3dx8.h resides")
+
+ find_library (D3D8_LIBRARY d3d8.lib
+ PATHS
+ "$ENV{DXSDK_DIR}/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
+ DOC "The directory where d3d8.lib resides")
+
+ find_library (D3DX8_LIBRARY d3dx8.lib
+ PATHS
+ "$ENV{DXSDK_DIR}/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
+ DOC "The directory where d3dx8.lib resides")
+
+ if (D3D8_INCLUDE_DIR AND D3D8_LIBRARY)
+ set (D3D8_FOUND 1)
+ if (D3DX8_INCLUDE_DIR AND D3DX8_LIBRARY)
+ set (D3DX8_FOUND 1)
+ endif (D3DX8_INCLUDE_DIR AND D3DX8_LIBRARY)
+ endif (D3D8_INCLUDE_DIR AND D3D8_LIBRARY)
+
+
+ find_path (D3D9_INCLUDE_DIR d3d9.h
+ PATHS
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
+ DOC "The directory where d3d9.h resides")
+
+ find_path (D3DX9_INCLUDE_DIR d3dx9.h
+ PATHS
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
+ DOC "The directory where d3dx9.h resides")
+
+ find_library (D3D9_LIBRARY d3d9.lib
+ PATHS
+ "$ENV{DXSDK_DIR}/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
+ DOC "The directory where d3d9.lib resides")
+
+ find_library (D3DX9_LIBRARY d3dx9.lib
+ PATHS
+ "$ENV{DXSDK_DIR}/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
+ DOC "The directory where d3dx9.lib resides")
+
+ if (D3D9_INCLUDE_DIR AND D3D9_LIBRARY)
+ set (D3D9_FOUND 1)
+ if (D3DX9_INCLUDE_DIR AND D3DX9_LIBRARY)
+ set (D3DX9_FOUND 1)
+ endif (D3DX9_INCLUDE_DIR AND D3DX9_LIBRARY)
+ endif (D3D9_INCLUDE_DIR AND D3D9_LIBRARY)
+
+
+ find_path (D3D10_INCLUDE_DIR d3d10.h
+ PATHS
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
+ DOC "The directory where d3d10.h resides")
+
+ find_path (D3DX10_INCLUDE_DIR d3dx10.h
+ PATHS
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
+ DOC "The directory where d3dx10.h resides")
+
+ find_library (D3D10_LIBRARY d3d10.lib
+ PATHS
+ "$ENV{DXSDK_DIR}/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
+ DOC "The directory where d3d10.lib resides")
+
+ find_library (D3DX10_LIBRARY d3dx10.lib
+ PATHS
+ "$ENV{DXSDK_DIR}/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
+ DOC "The directory where d3dx10.lib resides")
+
+ if (D3D10_INCLUDE_DIR AND D3D10_LIBRARY)
+ set (D3D10_FOUND 1)
+ if (D3DX10_INCLUDE_DIR AND D3DX10_LIBRARY)
+ set (D3DX10_FOUND 1)
+ endif (D3DX10_INCLUDE_DIR AND D3DX10_LIBRARY)
+ endif (D3D10_INCLUDE_DIR AND D3D10_LIBRARY)
+
+endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+
+mark_as_advanced (
+ D3D8_FOUND
+ D3DX8_FOUND
+ D3D9_FOUND
+ D3DX9_FOUND
+ D3D10_FOUND
+ D3DX10_FOUND
+)