|
|
|
@ -35,7 +35,7 @@ MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX)
|
|
|
|
|
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}")
|
|
|
|
|
MESSAGE(STATUS "Found Windows Kit ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
|
|
|
|
|
ENDIF()
|
|
|
|
|
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
|
|
|
|
|
ELSE()
|
|
|
|
@ -240,7 +240,11 @@ MACRO(USE_CURRENT_WINSDK)
|
|
|
|
|
|
|
|
|
|
IF(NOT WINSDK_DIR)
|
|
|
|
|
# Use Windows SDK versions installed with VC++ when possible
|
|
|
|
|
IF(MSVC14)
|
|
|
|
|
IF(MSVC1411 OR MSVC1410)
|
|
|
|
|
# Special case, use Kits for SDK
|
|
|
|
|
SET(WINSDK_VERSION "10.0")
|
|
|
|
|
SET(WINSDK_DIR ${WINSDK_UCRT_DIR})
|
|
|
|
|
ELSEIF(MSVC14)
|
|
|
|
|
SET(WINSDK_VERSION "8.1")
|
|
|
|
|
ELSEIF(MSVC12)
|
|
|
|
|
SET(WINSDK_VERSION "8.1")
|
|
|
|
@ -305,7 +309,7 @@ MACRO(USE_CURRENT_WINSDK)
|
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
|
|
IF(MSVC14)
|
|
|
|
|
# Under VC++ 2015, stdio.h, stdlib.h, etc... are part of UCRT
|
|
|
|
|
# Under VC++ 2015 and 2017, stdio.h, stdlib.h, etc... are part of UCRT
|
|
|
|
|
SET(WINSDK_UCRT_VERSION "10.0")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
@ -314,6 +318,40 @@ IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND)
|
|
|
|
|
SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_UCRT_DIR)
|
|
|
|
|
# determine exact UCRT version
|
|
|
|
|
SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include)
|
|
|
|
|
SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib)
|
|
|
|
|
|
|
|
|
|
FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*)
|
|
|
|
|
SET(UCRT_VERSION)
|
|
|
|
|
|
|
|
|
|
FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS})
|
|
|
|
|
IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION)
|
|
|
|
|
SET(UCRT_VERSION ${UCRT_SUBDIR})
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDFOREACH()
|
|
|
|
|
|
|
|
|
|
IF(UCRT_VERSION)
|
|
|
|
|
MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}")
|
|
|
|
|
|
|
|
|
|
SET(WINSDK10_INCLUDE_DIR ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION})
|
|
|
|
|
SET(WINSDK10_LIBRARY_DIR ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION})
|
|
|
|
|
|
|
|
|
|
# directory where UCRT headers are found
|
|
|
|
|
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK10_INCLUDE_DIR}/ucrt
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# directory where UCRT libraries are found
|
|
|
|
|
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK10_LIBRARY_DIR}/ucrt/${WINSDK8_SUFFIX}
|
|
|
|
|
)
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
|
|
|
|
USE_CURRENT_WINSDK()
|
|
|
|
|
ELSE()
|
|
|
|
@ -334,93 +372,87 @@ ENDIF()
|
|
|
|
|
# directory where Win32 headers are found
|
|
|
|
|
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Include/${UCRT_VERSION}/um
|
|
|
|
|
${WINSDK_DIR}/Include/um
|
|
|
|
|
${WINSDK_DIR}/Include
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}")
|
|
|
|
|
|
|
|
|
|
# directory where WinRT headers are found
|
|
|
|
|
FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Include/${UCRT_VERSION}/winrt
|
|
|
|
|
${WINSDK_DIR}/Include/winrt
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Found winstring.h in ${WINSDK_WINRT_INCLUDE_DIR}")
|
|
|
|
|
|
|
|
|
|
# directory where DirectX headers are found
|
|
|
|
|
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Include/${UCRT_VERSION}/shared
|
|
|
|
|
${WINSDK_DIR}/Include/shared
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}")
|
|
|
|
|
|
|
|
|
|
# directory where OpenGL headers are found
|
|
|
|
|
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_INCLUDE_DIR}/gl
|
|
|
|
|
${WINSDK_DIR}/Include/um/gl
|
|
|
|
|
${WINSDK_DIR}/Include/gl
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}")
|
|
|
|
|
|
|
|
|
|
SET(WINSDK_LIBRARY_DIRS
|
|
|
|
|
${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_SUFFIXES)
|
|
|
|
|
FOREACH(_SUFFIX ${WINSDK_SUFFIXES})
|
|
|
|
|
SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib/${_SUFFIX})
|
|
|
|
|
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib/${_SUFFIX})
|
|
|
|
|
ENDFOREACH()
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib)
|
|
|
|
|
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
# directory where all libraries are found
|
|
|
|
|
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_LIBRARY_DIRS}
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_UCRT_DIR)
|
|
|
|
|
# determine exact UCRT version
|
|
|
|
|
SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include)
|
|
|
|
|
SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib)
|
|
|
|
|
|
|
|
|
|
FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*)
|
|
|
|
|
SET(UCRT_VERSION)
|
|
|
|
|
|
|
|
|
|
FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS})
|
|
|
|
|
IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION)
|
|
|
|
|
SET(UCRT_VERSION ${UCRT_SUBDIR})
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDFOREACH()
|
|
|
|
|
|
|
|
|
|
IF(UCRT_VERSION)
|
|
|
|
|
MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}")
|
|
|
|
|
|
|
|
|
|
# directory where UCRT headers are found
|
|
|
|
|
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION}/ucrt
|
|
|
|
|
)
|
|
|
|
|
MESSAGE(STATUS "Found ComCtl32.lib in ${WINSDK_LIBRARY_DIR}")
|
|
|
|
|
|
|
|
|
|
# directory where UCRT libraries are found
|
|
|
|
|
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION}/ucrt/${WINSDK8_SUFFIX}
|
|
|
|
|
)
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
SET(WINSDK_BINARY_DIRS
|
|
|
|
|
${WINSDK_DIR}/Bin/${UCRT_VERSION}/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Bin/x86
|
|
|
|
|
${WINSDK_DIR}/Bin
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# signtool is used to sign executables
|
|
|
|
|
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Bin/x86
|
|
|
|
|
${WINSDK_DIR}/Bin
|
|
|
|
|
${WINSDK_BINARY_DIRS}
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# midl is used to generate IDL interfaces
|
|
|
|
|
FIND_PROGRAM(WINSDK_MIDL midl
|
|
|
|
|
HINTS
|
|
|
|
|
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
|
|
|
|
|
${WINSDK_DIR}/Bin/x86
|
|
|
|
|
${WINSDK_DIR}/Bin
|
|
|
|
|
${WINSDK_BINARY_DIRS}
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_INCLUDE_DIR)
|
|
|
|
@ -444,7 +476,7 @@ IF(WINSDK_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...
|
|
|
|
|
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
|
|
IF(WINSDK_UCRT_LIBRARY_DIR)
|
|
|
|
|
SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
|
|
|
|