From b4d9e2bfdd522a7630694eb6c08d45f5762ae023 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 6 Dec 2012 10:23:04 +0100 Subject: [PATCH] Fixed: Detect and use Windows 8 SDK only under Visual C++ 2012 --- code/CMakeModules/FindWindowsSDK.cmake | 57 ++++++++++++++++++++++---- code/CMakeModules/nel.cmake | 2 +- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 25903be14..9d9b91777 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -2,47 +2,86 @@ # Find the Windows includes # # WINSDK_INCLUDE_DIR - where to find Windows.h +# WINSDK_INCLUDE_DIRS - where to find all Windows headers +# WINSDK_LIBRARY_DIR - where to find libraries # WINSDK_FOUND - True if Windows SDK found. IF(WINSDK_INCLUDE_DIR) # Already in cache, be silent - SET(WINSDK_FIND_QUIETLY TRUE) + SET(WindowsSDK_FIND_QUIETLY TRUE) ENDIF(WINSDK_INCLUDE_DIR) +# TODO: add the possibility to use a specific Windows SDK + +IF(MSVC11) + GET_FILENAME_COMPONENT(WINSDK8_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE) + GET_FILENAME_COMPONENT(WINSDK8_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;ProductVersion]" NAME) + + IF(WINSDK8_DIR) + IF(NOT WindowsSDK_FIND_QUIETLY) + MESSAGE(STATUS "Found Windows SDK ${WINSDK8_VERSION} in ${WINSDK8_DIR}") + ENDIF(NOT WindowsSDK_FIND_QUIETLY) + IF(TARGET_ARM) + SET(WINSDK8_SUFFIX "arm") + ELSEIF(TARGET_X64) + SET(WINSDK8_SUFFIX "x64") + ELSEIF(TARGET_X86) + SET(WINSDK8_SUFFIX "x86") + ENDIF(TARGET_ARM) + ENDIF(WINSDK8_DIR) +ENDIF(MSVC11) + GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE) GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME) IF(WINSDK71_DIR) - IF(NOT WINSDK_FIND_QUIETLY) + IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}") - ENDIF(NOT WINSDK_FIND_QUIETLY) + ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF(WINSDK71_DIR) GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE) GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME) IF(WINSDKCURRENT_DIR) - IF(NOT WINSDK_FIND_QUIETLY) + IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}") - ENDIF(NOT WINSDK_FIND_QUIETLY) + ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF(WINSDKCURRENT_DIR) FIND_PATH(WINSDK_INCLUDE_DIR Windows.h - PATHS + HINTS + ${WINSDK8_DIR}/Include/um ${WINSDK71_DIR}/Include ${WINSDKCURRENT_DIR}/Include ) +FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h + HINTS + ${WINSDK8_DIR}/Include/shared + ${WINSDK71_DIR}/Include + ${WINSDKCURRENT_DIR}/Include +) + +FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib + HINTS + ${WINSDK8_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} + ${WINSDK71_DIR}/Lib + ${WINSDKCURRENT_DIR}/Lib +) + FIND_PROGRAM(WINSDK_SIGNTOOL signtool - PATHS + HINTS + ${WINSDK8_DIR}/Bin/x86 ${WINSDK71_DIR}/Bin ${WINSDKCURRENT_DIR}/Bin ) IF(WINSDK_INCLUDE_DIR) SET(WINSDK_FOUND TRUE) + SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR}) ELSE(WINSDK_INCLUDE_DIR) - IF(NOT WINSDK_FIND_QUIETLY) + IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Windows SDK!") - ENDIF(NOT WINSDK_FIND_QUIETLY) + ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF(WINSDK_INCLUDE_DIR) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index e1b204690..6fba40d6d 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -1010,7 +1010,7 @@ MACRO(SETUP_EXTERNAL) FIND_PACKAGE(WindowsSDK REQUIRED) # use VC++ and Windows SDK include paths - INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) + INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIRS}) ENDIF(MSVC) ENDIF(WITH_STLPORT) ENDMACRO(SETUP_EXTERNAL)