summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-08-10 14:13:05 +0100
committerJose Fonseca <jfonseca@vmware.com>2015-08-10 14:13:05 +0100
commit38d9d4d5415be903cfa744b912f05710cc8efeb1 (patch)
tree6364982d5a2105858bcc51bc494f00e7865817dd /cmake
parent1eb9029d752b12c3bacb6399bd78c2c63dfdda3c (diff)
cmake: Use Windows 10 SDK.
In preparation for D3D11.3 support.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindDirectX.cmake3
-rw-r--r--cmake/Windows10SDK.cmake53
2 files changed, 56 insertions, 0 deletions
diff --git a/cmake/FindDirectX.cmake b/cmake/FindDirectX.cmake
index 53d86e1f..4ca12922 100644
--- a/cmake/FindDirectX.cmake
+++ b/cmake/FindDirectX.cmake
@@ -182,6 +182,7 @@ if (WIN32)
find_winsdk_header (DXGI dxgi.h)
find_winsdk_header (DXGI1_2 dxgi1_2.h)
find_winsdk_header (DXGI1_3 dxgi1_3.h)
+ find_winsdk_header (DXGI1_4 dxgi1_4.h)
find_winsdk_library (DXGI dxgi)
find_winsdk_header (D3D10 d3d10.h)
@@ -203,6 +204,8 @@ if (WIN32)
find_combined (D3D11_1 D3D11_1 D3D11)
find_winsdk_header (D3D11_2 d3d11_2.h)
find_combined (D3D11_2 D3D11_2 D3D11)
+ find_winsdk_header (D3D11_3 d3d11_3.h)
+ find_combined (D3D11_3 D3D11_3 D3D11)
find_dxsdk_header (D3DX11 d3dx11.h)
find_dxsdk_library (D3DX11 d3dx11)
diff --git a/cmake/Windows10SDK.cmake b/cmake/Windows10SDK.cmake
new file mode 100644
index 00000000..df189d5e
--- /dev/null
+++ b/cmake/Windows10SDK.cmake
@@ -0,0 +1,53 @@
+# - try to find and use Windows 10 SDK on VS 2013
+#
+# VS 2013 will never pick Windows 10 SDK -- one must manually set the include and library directories.
+#
+# See also:
+# - https://github.com/walbourn/directx-sdk-samples/commit/68575c40984f2581e3931157bd7e9f831ba70d69
+# - http://stackoverflow.com/a/28922582
+# - http://blogs.msdn.com/b/vcblog/archive/2012/11/23/using-the-windows-8-sdk-with-visual-studio-2010-configuring-multiple-projects.aspx
+
+if (MSVC AND ${MSVC_VERSION} LESS 1900 AND NOT CMAKE_GENERATOR_TOOLSET MATCHES "_xp$")
+
+ include (FindPackageMessage)
+
+ # Can't use "$ENV{ProgramFiles(x86)}" to avoid violating CMP0053. See
+ # http://public.kitware.com/pipermail/cmake-developers/2014-October/023190.html
+ set (ProgramFiles_x86 "ProgramFiles(x86)")
+ if ("$ENV{${ProgramFiles_x86}}")
+ set (ProgramFiles "$ENV{${ProgramFiles_x86}}")
+ else ()
+ set (ProgramFiles "$ENV{ProgramFiles}")
+ endif ()
+
+ set (WIN10_SDK_VER "10.0.10240.0")
+
+ find_path (WIN10_SDK_ROOT_DIR
+ SDKManifest.xml
+ PATHS
+ "${ProgramFiles}/Windows Kits/10"
+ DOC "Windows 10 SDK root directory"
+ )
+
+ if (CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set (WIN10_SDK_ARCH x86)
+ else ()
+ set (WIN10_SDK_ARCH x64)
+ endif ()
+
+ if (WIN10_SDK_ROOT_DIR)
+ find_package_message (WIN10_SDK "Windows 10 SDK - found: ${WIN10_SDK_ROOT_DIR}" "[${WIN10_SDK_ROOT_DIR}]")
+ set (WIN10_SDK_INC_DIRS
+ "${WIN10_SDK_ROOT_DIR}/Include/${WIN10_SDK_VER}/um"
+ "${WIN10_SDK_ROOT_DIR}/Include/${WIN10_SDK_VER}/shared"
+ "${WIN10_SDK_ROOT_DIR}/Include/${WIN10_SDK_VER}/winrt"
+ )
+ include_directories (BEFORE ${WIN10_SDK_INC_DIRS})
+ list (APPEND CMAKE_REQUIRED_INCLUDES ${WIN10_SDK_INC_DIRS})
+ link_directories (
+ ${WIN10_SDK_ROOT_DIR}/Lib/${WIN10_SDK_VER}/${WIN10_SDK_ARCH}
+ )
+ else ()
+ find_package_message (WIN10_SDK "Windows 10 SDK - not found" "[]")
+ endif ()
+endif ()