|
|
|
@ -17,13 +17,28 @@ SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
|
|
|
|
|
MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION)
|
|
|
|
|
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};InstallationFolder]" ABSOLUTE)
|
|
|
|
|
|
|
|
|
|
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
|
|
|
|
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry" AND EXISTS "${WINSDK${_VERSION}_DIR}/Include")
|
|
|
|
|
SET(WINSDK${_VERSION}_FOUND ON)
|
|
|
|
|
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_VERSION_FULL "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};ProductVersion]" NAME)
|
|
|
|
|
IF(NOT WindowsSDK_FIND_QUIETLY)
|
|
|
|
|
MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
|
|
|
|
|
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
|
|
|
|
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
|
|
|
|
ENDIF()
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(WINSDK${_VERSION}_DIR "")
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
|
|
MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX)
|
|
|
|
|
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot${_SUFFIX}]" ABSOLUTE)
|
|
|
|
|
|
|
|
|
|
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
|
|
|
|
SET(WINSDK${_VERSION}_FOUND ON)
|
|
|
|
|
SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}")
|
|
|
|
|
IF(NOT WindowsSDK_FIND_QUIETLY)
|
|
|
|
|
MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
|
|
|
|
|
ENDIF()
|
|
|
|
|
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(WINSDK${_VERSION}_DIR "")
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDMACRO()
|
|
|
|
@ -37,9 +52,16 @@ MACRO(DETECT_WINSDK_VERSION _VERSION)
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
|
|
SET(WINSDK_VERSIONS "8.1" "8.0" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
|
|
|
|
|
SET(WINSDK_DETECTED_VERSIONS)
|
|
|
|
|
|
|
|
|
|
# Fixed versions for Windows Kits (VC++ from 2012)
|
|
|
|
|
DETECT_WINKIT_VERSION("10.0" "10")
|
|
|
|
|
DETECT_WINKIT_VERSION("8.1" "81")
|
|
|
|
|
DETECT_WINKIT_VERSION("8.0" "")
|
|
|
|
|
|
|
|
|
|
# For VC++ up to 2010
|
|
|
|
|
SET(WINSDK_VERSIONS "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
|
|
|
|
|
|
|
|
|
|
# Search all supported Windows SDKs
|
|
|
|
|
FOREACH(_VERSION ${WINSDK_VERSIONS})
|
|
|
|
|
DETECT_WINSDK_VERSION(${_VERSION})
|
|
|
|
@ -51,7 +73,9 @@ ENDFOREACH()
|
|
|
|
|
|
|
|
|
|
SET(WINSDK_SUFFIXES)
|
|
|
|
|
|
|
|
|
|
IF(TARGET_ARM)
|
|
|
|
|
IF(TARGET_ARM64)
|
|
|
|
|
SET(WINSDK8_SUFFIX "arm64")
|
|
|
|
|
ELSEIF(TARGET_ARM)
|
|
|
|
|
SET(WINSDK8_SUFFIX "arm")
|
|
|
|
|
ELSEIF(TARGET_X64)
|
|
|
|
|
SET(WINSDK8_SUFFIX "x64")
|
|
|
|
@ -216,7 +240,9 @@ MACRO(USE_CURRENT_WINSDK)
|
|
|
|
|
|
|
|
|
|
IF(NOT WINSDK_DIR)
|
|
|
|
|
# Use Windows SDK versions installed with VC++ when possible
|
|
|
|
|
IF(MSVC12)
|
|
|
|
|
IF(MSVC14)
|
|
|
|
|
SET(WINSDK_VERSION "8.1")
|
|
|
|
|
ELSEIF(MSVC12)
|
|
|
|
|
SET(WINSDK_VERSION "8.1")
|
|
|
|
|
ELSEIF(MSVC11)
|
|
|
|
|
SET(WINSDK_VERSION "8.0")
|
|
|
|
@ -267,6 +293,16 @@ MACRO(USE_CURRENT_WINSDK)
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
|
|
IF(MSVC14)
|
|
|
|
|
# Under VC++ 2015, stdio.h, stdlib.h, etc... are part of UCRT
|
|
|
|
|
SET(WINSDK_UCRT_VERSION "10.0")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
# Look for correct UCRT
|
|
|
|
|
IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND)
|
|
|
|
|
SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
|
|
|
|
USE_CURRENT_WINSDK()
|
|
|
|
|
ELSE()
|
|
|
|
@ -291,11 +327,16 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
|
|
|
|
|
${WINSDK_DIR}/Include
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# directory where WinRT headers are found
|
|
|
|
|
FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Include/winrt
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# directory where DirectX headers are found
|
|
|
|
|
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Include/shared
|
|
|
|
|
${WINSDK_DIR}/Include
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# directory where OpenGL headers are found
|
|
|
|
@ -303,12 +344,13 @@ FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Include/um/gl
|
|
|
|
|
${WINSDK_DIR}/Include/gl
|
|
|
|
|
${WINSDK_DIR}/Include
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
SET(WINSDK_LIBRARY_DIRS
|
|
|
|
|
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX})
|
|
|
|
|
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Lib/${WINSDK_SUFFIX}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_SUFFIXES)
|
|
|
|
|
FOREACH(_SUFFIX ${WINSDK_SUFFIXES})
|
|
|
|
@ -324,6 +366,22 @@ FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
|
|
|
|
|
${WINSDK_LIBRARY_DIRS}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_UCRT_DIR)
|
|
|
|
|
# directory where UCRT headers are found
|
|
|
|
|
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_UCRT_DIR}/Include/10.0.10056.0/ucrt
|
|
|
|
|
${WINSDK_UCRT_DIR}/Include/10.0.10150.0/ucrt
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# directory where UCRT libraries are found
|
|
|
|
|
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_UCRT_DIR}/Lib/10.0.10056.0/ucrt/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_UCRT_DIR}/Lib/10.0.10150.0/ucrt/${WINSDK8_SUFFIX}
|
|
|
|
|
)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
# signtool is used to sign executables
|
|
|
|
|
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
|
|
|
|
|
HINTS
|
|
|
|
@ -342,10 +400,33 @@ FIND_PROGRAM(WINSDK_MIDL midl
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_INCLUDE_DIR)
|
|
|
|
|
SET(WINSDK_FOUND ON)
|
|
|
|
|
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR} ${WINSDK_OPENGL_INCLUDE_DIR})
|
|
|
|
|
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_UCRT_INCLUDE_DIR)
|
|
|
|
|
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_UCRT_INCLUDE_DIR})
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_SHARED_INCLUDE_DIR)
|
|
|
|
|
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_SHARED_INCLUDE_DIR})
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_INCLUDE_DIR})
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_OPENGL_INCLUDE_DIR)
|
|
|
|
|
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_OPENGL_INCLUDE_DIR})
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_WINRT_INCLUDE_DIR)
|
|
|
|
|
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR})
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) # TODO: Move this after all other includes somehow...
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_UCRT_LIBRARY_DIR)
|
|
|
|
|
SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
|
|
|
|
|
|
|
|
|
# Fix for using Windows SDK 7.1 with Visual C++ 2012
|
|
|
|
|
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
|
|
|
|
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
|
|
|
|