summaryrefslogtreecommitdiff
path: root/cmake/FindDirectX.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/FindDirectX.cmake')
-rw-r--r--cmake/FindDirectX.cmake141
1 files changed, 74 insertions, 67 deletions
diff --git a/cmake/FindDirectX.cmake b/cmake/FindDirectX.cmake
index 2d923c16..e0094c18 100644
--- a/cmake/FindDirectX.cmake
+++ b/cmake/FindDirectX.cmake
@@ -1,56 +1,83 @@
# - try to find DirectX include dirs and libraries
+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+
+
+ if (CMAKE_CL_64)
+ set (DirectX_ARCHITECTURE x64)
+ else ()
+ set (DirectX_ARCHITECTURE x86)
+ endif ()
+
+
+ # DirectX SDK
find_path (DirectX_ROOT_DIR
Include/d3d9.h
PATHS
"$ENV{DXSDK_DIR}"
"$ENV{ProgramFiles}/Microsoft DirectX SDK (June 2010)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK (February 2010)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK (March 2009)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK (August 2008)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK (June 2008)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK (March 2008)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK (November 2007)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK (August 2007)"
- "$ENV{ProgramFiles}/Microsoft DirectX SDK"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (June 2010)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK (February 2010)"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (February 2010)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK (March 2009)"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (March 2009)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK (August 2008)"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (August 2008)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK (June 2008)"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (June 2008)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK (March 2008)"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (March 2008)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK (November 2007)"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (November 2007)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK (August 2007)"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK (August 2007)"
+ "$ENV{ProgramFiles}/Microsoft DirectX SDK"
"$ENV{ProgramFiles(x86)}/Microsoft DirectX SDK"
- DOC "DirectX SDK root directory")
+ DOC "DirectX SDK root directory"
+ )
+ if (DirectX_ROOT_DIR)
+ set (DirectX_INC_SEARCH_PATH "${DirectX_ROOT_DIR}/Include")
+ set (DirectX_LIB_SEARCH_PATH "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}")
+ endif ()
- if (CMAKE_CL_64)
- set (DirectX_ARCHITECTURE x64)
- else ()
- set (DirectX_ARCHITECTURE x86)
+ # With VS 2011 and Windows 8 SDK, the DirectX SDK is included as part of
+ # the Windows SDK.
+ #
+ # See also:
+ # - http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx
+ # TODO: Allow using DirectX SDK with VS 2011
+ if (DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700)
+ find_path (WIN8_SDK_ROOT_DIR
+ Include/um/windows.h
+ PATHS
+ "$ENV{ProgramFiles}/Windows Kits/8.0"
+ "$ENV{ProgramFiles(x86)}/Windows Kits/8.0"
+ DOC "Windows 8 SDK root directory"
+ )
+
+ if (WIN8_SDK_ROOT_DIR)
+ set (DirectX_INC_SEARCH_PATH "${WIN8_SDK_ROOT_DIR}/Include/um" "${WIN8_SDK_ROOT_DIR}/Include/shared")
+ set (DirectX_LIB_SEARCH_PATH "${WIN8_SDK_ROOT_DIR}/Lib/Win8/um/${DirectX_ARCHITECTURE}")
+ endif ()
endif ()
find_path (DirectX_D3D_INCLUDE_DIR d3d.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3d.h resides")
find_path (DirectX_D3DX_INCLUDE_DIR d3dx.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3dx.h resides")
find_library (DirectX_DDRAW_LIBRARY ddraw
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where ddraw resides")
find_library (DirectX_D3DX_LIBRARY d3dx
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3dx resides")
if (DirectX_D3D_INCLUDE_DIR AND DirectX_DDRAW_LIBRARY)
@@ -62,23 +89,19 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_path (DirectX_D3D8_INCLUDE_DIR d3d8.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3d8.h resides")
find_path (DirectX_D3DX8_INCLUDE_DIR d3dx8.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3dx8.h resides")
find_library (DirectX_D3D8_LIBRARY d3d8
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3d8 resides")
find_library (DirectX_D3DX8_LIBRARY d3dx8
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3dx8 resides")
if (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3D8_LIBRARY)
@@ -90,23 +113,19 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_path (DirectX_D3D9_INCLUDE_DIR d3d9.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3d9.h resides")
find_path (DirectX_D3DX9_INCLUDE_DIR d3dx9.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3dx9.h resides")
find_library (DirectX_D3D9_LIBRARY d3d9
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3d9 resides")
find_library (DirectX_D3DX9_LIBRARY d3dx9
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3dx9 resides")
if (DirectX_D3D9_INCLUDE_DIR AND DirectX_D3D9_LIBRARY)
@@ -118,23 +137,19 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_path (DirectX_D3D10_INCLUDE_DIR d3d10.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3d10.h resides")
find_path (DirectX_D3DX10_INCLUDE_DIR d3dx10.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3dx10.h resides")
find_library (DirectX_D3D10_LIBRARY d3d10
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3d10 resides")
find_library (DirectX_D3DX10_LIBRARY d3dx10
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3dx10 resides")
if (DirectX_D3D10_INCLUDE_DIR AND DirectX_D3D10_LIBRARY)
@@ -146,13 +161,11 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_path (DirectX_D3D10_1_INCLUDE_DIR d3d10_1.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3d10_1.h resides")
find_library (DirectX_D3D10_1_LIBRARY d3d10_1
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3d10_1 resides")
if (DirectX_D3D10_1_INCLUDE_DIR AND DirectX_D3D10_1_LIBRARY)
@@ -161,23 +174,19 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_path (DirectX_D3D11_INCLUDE_DIR d3d11.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3d11.h resides")
find_path (DirectX_D3DX11_INCLUDE_DIR d3dx11.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3dx11.h resides")
find_library (DirectX_D3D11_LIBRARY d3d11
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3d11 resides")
find_library (DirectX_D3DX11_LIBRARY d3dx11
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
+ PATHS ${DirectX_LIB_SEARCH_PATH}
DOC "The directory where d3dx11 resides")
if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
@@ -189,21 +198,15 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_path (DirectX_D3D11_1_INCLUDE_DIR d3d11_1.h
- PATHS
- "${DirectX_ROOT_DIR}/Include"
+ PATHS ${DirectX_INC_SEARCH_PATH}
DOC "The directory where d3d11_1.h resides")
- find_library (DirectX_D3D11_1_LIBRARY d3d11_1
- PATHS
- "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}"
- DOC "The directory where d3d11_1 resides")
-
- if (DirectX_D3D11_1_INCLUDE_DIR AND DirectX_D3D11_1_LIBRARY)
+ if (DirectX_D3D11_1_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
set (DirectX_D3D11_1_FOUND 1)
endif ()
- mark_as_advanced(
+ mark_as_advanced (
DirectX_D3D_INCLUDE_DIR
DirectX_D3D_INCLUDE_DIR
DirectX_DDRAW_LIBRARY
@@ -235,11 +238,12 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
DirectX_D3DX11_INCLUDE_DIR
DirectX_D3DX11_LIBRARY
DirectX_D3D11_1_INCLUDE_DIR
- DirectX_D3D11_1_LIBRARY
)
+
endif ()
+
mark_as_advanced (
DirectX_D3D_FOUND
DirectX_D3DX_FOUND
@@ -254,3 +258,6 @@ mark_as_advanced (
DirectX_D3DX11_FOUND
DirectX_D3D11_1_FOUND
)
+
+
+# vim:set sw=4 ts=4 noet: