From 8aa1aed3bdc9ef3d7102c877f0214c58b4754644 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 23 Nov 2021 20:06:16 +0200 Subject: [PATCH] Use Windows SDK if DirectX SDK not installed --- CMakeModules/FindWindowsSDK.cmake | 11 +++++++++++ CMakeModules/nel.cmake | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeModules/FindWindowsSDK.cmake b/CMakeModules/FindWindowsSDK.cmake index 1b02dffb3..20787aa79 100644 --- a/CMakeModules/FindWindowsSDK.cmake +++ b/CMakeModules/FindWindowsSDK.cmake @@ -501,6 +501,17 @@ IF(WINSDK_INCLUDE_DIR) IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14)) ADD_DEFINITIONS(-D_USING_V110_SDK71_) ENDIF() + + IF(NOT DXSDK_DIR) + MESSAGE("Using DirectX from Windows SDK (${WINSDK_LIBRARY_DIRS})") + SET(DXSDK_DIR ${WINSDK_DIR}) + FIND_LIBRARY(DXSDK_GUID_LIBRARY dxguid ${WINSDK_LIBRARY_DIRS}) + FIND_LIBRARY(DXSDK_DINPUT_LIBRARY dinput8 ${WINSDK_LIBRARY_DIRS}) + FIND_LIBRARY(DXSDK_DSOUND_LIBRARY dsound ${WINSDK_LIBRARY_DIRS}) + FIND_LIBRARY(DXSDK_XAUDIO_LIBRARY xaudio2 ${WINSDK_LIBRARY_DIRS}) + # TODO: FIND_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9) + FIND_LIBRARY(DXSDK_D3D9_LIBRARY d3d9 ${WINSDK_LIBRARY_DIRS}) + ENDIF() ELSE() IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Windows SDK!") diff --git a/CMakeModules/nel.cmake b/CMakeModules/nel.cmake index 9e6aff63a..3f6a6436c 100644 --- a/CMakeModules/nel.cmake +++ b/CMakeModules/nel.cmake @@ -1279,7 +1279,7 @@ MACRO(SETUP_EXTERNAL) IF(WIN32) # Must include DXSDK before WINSDK - FIND_PACKAGE(DirectXSDK REQUIRED) + FIND_PACKAGE(DirectXSDK) # IF(DXSDK_INCLUDE_DIR) # INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) # ENDIF() @@ -1288,5 +1288,8 @@ MACRO(SETUP_EXTERNAL) IF(MSVC) FIND_PACKAGE(MSVC REQUIRED) FIND_PACKAGE(WindowsSDK REQUIRED) + IF(NOT DXSDK_DIR) + MESSAGE(FATAL_ERROR "DirectX SDK or DirectX files from Windows SDK not found.") + ENDIF() ENDIF() ENDMACRO()