Changed: Updates CMake modules

This commit is contained in:
kervala 2015-12-15 13:41:27 +01:00
parent 2187bc3f1e
commit 89d2034edc
9 changed files with 238 additions and 181 deletions

View file

@ -15,48 +15,76 @@ IF(NOT NDK_ROOT)
IF(CMAKE_HOST_WIN32) IF(CMAKE_HOST_WIN32)
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT) FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
ENDIF(CMAKE_HOST_WIN32) ENDIF()
ENDIF(NOT NDK_ROOT) ENDIF()
IF(NOT TARGET_CPU) IF(NOT TARGET_CPU)
SET(TARGET_CPU "armv7") SET(TARGET_CPU "armv7")
ENDIF(NOT TARGET_CPU) ENDIF()
SET(ARMV7_HARD_FLOAT OFF)
IF(TARGET_CPU STREQUAL "armv7") IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a") SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
IF(ARMV7_HARD_FLOAT)
SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard")
ENDIF()
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm") SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm") SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 4) SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5") ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi") SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5") SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm") SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm") SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 4) SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "arm64")
SET(LIBRARY_ARCHITECTURE "arm64-v8a")
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
SET(TOOLCHAIN_ARCH "arm64")
SET(GCC_TOOLCHAIN_PREFIX "aarch64-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "aarch64-linux-android")
SET(MINIMUM_NDK_TARGET 21)
ELSEIF(TARGET_CPU STREQUAL "x86") ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86") SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86") SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86") SET(TOOLCHAIN_ARCH "x86")
SET(GCC_TOOLCHAIN_PREFIX "x86") SET(GCC_TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686") SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android")
SET(MINIMUM_NDK_TARGET 9) SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "x86_64")
SET(LIBRARY_ARCHITECTURE "x86_64")
SET(CMAKE_SYSTEM_PROCESSOR "x86_64")
SET(TOOLCHAIN_ARCH "x86_64")
SET(GCC_TOOLCHAIN_PREFIX "x86_64")
SET(TOOLCHAIN_BIN_PREFIX "x86_64-linux-android")
SET(MINIMUM_NDK_TARGET 21)
ELSEIF(TARGET_CPU STREQUAL "mips") ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips") SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips") SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips") SET(TOOLCHAIN_ARCH "mips")
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android") SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel") SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android")
SET(MINIMUM_NDK_TARGET 9) SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7") ELSEIF(TARGET_CPU STREQUAL "mips64")
SET(LIBRARY_ARCHITECTURE "mips64")
SET(CMAKE_SYSTEM_PROCESSOR "mips64")
SET(TOOLCHAIN_ARCH "mips64")
SET(GCC_TOOLCHAIN_PREFIX "mips64el-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mips64el-linux-android")
SET(MINIMUM_NDK_TARGET 21)
ELSE()
MESSAGE(FATAL_ERROR "Unable to process TARGET_CPU ${TARGET_CPU}")
ENDIF()
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(ANDROID_COMPILER "GCC") SET(ANDROID_COMPILER "GCC")
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang") IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang") SET(ANDROID_COMPILER "clang")
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(CLANG ON) SET(CLANG ON)
ELSE() ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION}) SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
@ -64,7 +92,11 @@ ENDIF()
IF(NOT NDK_TARGET) IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET) ELSE()
IF(NDK_TARGET LESS MINIMUM_NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF()
ENDIF()
IF(CMAKE_HOST_WIN32) IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows") SET(TOOLCHAIN_HOST "windows")
@ -75,7 +107,7 @@ ELSEIF(CMAKE_HOST_APPLE)
ELSEIF(CMAKE_HOST_UNIX) ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux") SET(TOOLCHAIN_HOST "linux")
SET(TOOLCHAIN_BIN_SUFFIX "") SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32) ENDIF()
MACRO(SEARCH_TOOLCHAIN _COMPILER) MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS) SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
@ -110,7 +142,7 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*") FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES) IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT) LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES) ENDIF()
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
@ -123,8 +155,14 @@ ENDIF()
SEARCH_TOOLCHAIN(GCC) SEARCH_TOOLCHAIN(GCC)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}") MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
IF(CLANG_TOOLCHAIN_ROOT)
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
ENDIF()
IF(GCC_TOOLCHAIN_ROOT)
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
ENDIF()
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}") SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
@ -137,14 +175,7 @@ SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b # NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") ENDIF()
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
SET(STL_INCLUDE_DIR "${STL_DIR}/include") SET(STL_INCLUDE_DIR "${STL_DIR}/include")
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}") SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
@ -160,39 +191,45 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY) MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
IF("${_BINARY}" MATCHES "clang")
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE ) SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
ELSE() ENDMACRO()
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE) SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDIF() ENDMACRO()
ENDMACRO(SET_TOOLCHAIN_BINARY)
# Force the compilers to GCC for Android # Force the compilers to GCC for Android
include (CMakeForceCompiler) include (CMakeForceCompiler)
IF(CLANG) IF(CLANG)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang) MESSAGE(STATUS "Using clang compiler")
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang) CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang) CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
MESSAGE(STATUS "Using clang compiler") SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++)
ELSE() ELSE()
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc) MESSAGE(STATUS "Using GCC compiler")
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_CXX_COMPILER g++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU) CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU) CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
MESSAGE(STATUS "Using GCC compiler") SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld)
ENDIF() ENDIF()
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip) SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY(CMAKE_AR ar) SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld) SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY(CMAKE_NM nm) SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy) SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib)
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)

View file

@ -9,7 +9,7 @@
if(MAXSDK_INCLUDE_DIR) if(MAXSDK_INCLUDE_DIR)
# Already in cache, be silent # Already in cache, be silent
SET(MAXSDK_FIND_QUIETLY TRUE) SET(MAXSDK_FIND_QUIETLY TRUE)
endif(MAXSDK_INCLUDE_DIR) endif()
FIND_PATH(MAXSDK_DIR FIND_PATH(MAXSDK_DIR
"include/maxversion.h" "include/maxversion.h"
@ -37,9 +37,9 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
IF(TARGET_X64) IF(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib) SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
ELSE(TARGET_X64) ELSE()
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib) SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
ENDIF(TARGET_X64) ENDIF()
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY} FIND_LIBRARY(${MYLIBRARY}
@ -47,7 +47,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
HINTS HINTS
${MAXSDK_LIBRARY_DIRS} ${MAXSDK_LIBRARY_DIRS}
) )
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) ENDMACRO()
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core) FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom) FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)

View file

@ -45,6 +45,6 @@ IF(MFC_FOUND)
# Set CMake flag to use MFC DLL # Set CMake flag to use MFC DLL
SET(CMAKE_MFC_FLAG 2) SET(CMAKE_MFC_FLAG 2)
ENDIF(MFC_FOUND) ENDIF()
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project # TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project

View file

@ -30,16 +30,16 @@ MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
HINTS HINTS
"${DXSDK_LIBRARY_DIR}" "${DXSDK_LIBRARY_DIR}"
) )
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) ENDMACRO()
IF(DXSDK_DIR) IF(DXSDK_DIR)
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include") SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
IF(TARGET_X64) IF(TARGET_X64)
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64) SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64)
ELSE(TARGET_X64) ELSE()
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib) SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib)
ENDIF(TARGET_X64) ENDIF()
FIND_PATH(DXSDK_LIBRARY_DIR FIND_PATH(DXSDK_LIBRARY_DIR
dxguid.lib dxguid.lib
@ -52,7 +52,7 @@ IF(DXSDK_DIR)
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio) FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9) FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9) FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
ENDIF(DXSDK_DIR) ENDIF()
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if # Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
# all listed variables are TRUE. # all listed variables are TRUE.

View file

@ -14,8 +14,8 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/") SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") ENDIF()
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") ENDIF()
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND ON) SET(VC${_VERSION}_FOUND ON)
@ -24,14 +24,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
SET(_VERSION_STR ${_VERSION}) SET(_VERSION_STR ${_VERSION})
IF(MSVC_EXPRESS) IF(MSVC_EXPRESS)
SET(_VERSION_STR "${_VERSION_STR} Express") SET(_VERSION_STR "${_VERSION_STR} Express")
ENDIF(MSVC_EXPRESS) ENDIF()
MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}") MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}")
ENDIF(NOT MSVC_FIND_QUIETLY) ENDIF()
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND OFF) SET(VC${_VERSION}_FOUND OFF)
SET(VC${_VERSION}_DIR "") SET(VC${_VERSION}_DIR "")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") ENDIF()
ENDMACRO(DETECT_VC_VERSION_HELPER) ENDMACRO()
MACRO(DETECT_VC_VERSION _VERSION) MACRO(DETECT_VC_VERSION _VERSION)
SET(VC${_VERSION}_FOUND OFF) SET(VC${_VERSION}_FOUND OFF)
@ -39,21 +39,21 @@ MACRO(DETECT_VC_VERSION _VERSION)
IF(NOT VC${_VERSION}_FOUND) IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT VC${_VERSION}_FOUND) ENDIF()
IF(VC${_VERSION}_FOUND) IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON) SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}") SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF(VC${_VERSION}_FOUND) ENDIF()
ENDMACRO(DETECT_VC_VERSION) ENDMACRO()
MACRO(DETECT_EXPRESS_VERSION _VERSION) MACRO(DETECT_EXPRESS_VERSION _VERSION)
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE) GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
SET(MSVC_EXPRESS ON) SET(MSVC_EXPRESS ON)
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") ENDIF()
ENDMACRO(DETECT_EXPRESS_VERSION) ENDMACRO()
IF(MSVC12) IF(MSVC12)
DETECT_VC_VERSION("12.0") DETECT_VC_VERSION("12.0")
@ -62,7 +62,7 @@ IF(MSVC12)
IF(NOT MSVC12_REDIST_DIR) IF(NOT MSVC12_REDIST_DIR)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC12_REDIST_DIR) ENDIF()
ELSEIF(MSVC11) ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0") DETECT_VC_VERSION("11.0")
SET(MSVC_TOOLSET "110") SET(MSVC_TOOLSET "110")
@ -70,7 +70,7 @@ ELSEIF(MSVC11)
IF(NOT MSVC11_REDIST_DIR) IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist") SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR) ENDIF()
ELSEIF(MSVC10) ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0") DETECT_VC_VERSION("10.0")
SET(MSVC_TOOLSET "100") SET(MSVC_TOOLSET "100")
@ -78,19 +78,19 @@ ELSEIF(MSVC10)
IF(NOT MSVC10_REDIST_DIR) IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR) ENDIF()
ELSEIF(MSVC90) ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0") DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90") SET(MSVC_TOOLSET "90")
ELSEIF(MSVC80) ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0") DETECT_VC_VERSION("8.0")
SET(MSVC_TOOLSET "80") SET(MSVC_TOOLSET "80")
ENDIF(MSVC12) ENDIF()
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable # If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
IF(NOT VC_DIR) IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR}) SET(VC_DIR $ENV{VC_DIR})
ENDIF(NOT VC_DIR) ENDIF()
IF(NOT VC_DIR) IF(NOT VC_DIR)
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER}) STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})

View file

@ -31,7 +31,7 @@
# MESSAGE("Current revision is ${Project_WC_REVISION}") # MESSAGE("Current revision is ${Project_WC_REVISION}")
# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project) # Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}") # MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
# ENDIF(MERCURIAL_FOUND) # ENDIF()
#============================================================================= #=============================================================================
# Copyright 2006-2009 Kitware, Inc. # Copyright 2006-2009 Kitware, Inc.
@ -74,22 +74,22 @@ IF(Mercurial_HG_EXECUTABLE)
IF(NOT ${Mercurial_hg_info_result} EQUAL 0) IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}") MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}")
ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0) ELSE()
LIST(LENGTH ${prefix}_WC_INFO _COUNT) LIST(LENGTH ${prefix}_WC_INFO _COUNT)
IF(_COUNT EQUAL 4) IF(_COUNT EQUAL 4)
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION) LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET) LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH) LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR) LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
ELSE(_COUNT EQUAL 4) ELSE()
MESSAGE(STATUS "Bad output from HG") MESSAGE(STATUS "Bad output from HG")
SET(${prefix}_WC_REVISION "unknown") SET(${prefix}_WC_REVISION "unknown")
SET(${prefix}_WC_CHANGESET "unknown") SET(${prefix}_WC_CHANGESET "unknown")
SET(${prefix}_WC_BRANCH "unknown") SET(${prefix}_WC_BRANCH "unknown")
ENDIF(_COUNT EQUAL 4) ENDIF()
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0) ENDIF()
ENDMACRO(Mercurial_WC_INFO) ENDMACRO()
MACRO(Mercurial_WC_LOG dir prefix) MACRO(Mercurial_WC_LOG dir prefix)
# This macro can block if the certificate is not signed: # This macro can block if the certificate is not signed:
@ -105,9 +105,9 @@ IF(Mercurial_HG_EXECUTABLE)
IF(NOT ${Mercurial_hg_log_result} EQUAL 0) IF(NOT ${Mercurial_hg_log_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}") MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}")
ENDIF(NOT ${Mercurial_hg_log_result} EQUAL 0) ENDIF()
ENDMACRO(Mercurial_WC_LOG) ENDMACRO()
ENDIF(Mercurial_HG_EXECUTABLE) ENDIF()
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)

View file

@ -9,7 +9,7 @@
IF(WINSDK_FOUND) IF(WINSDK_FOUND)
# If Windows SDK already found, skip it # If Windows SDK already found, skip it
RETURN() RETURN()
ENDIF(WINSDK_FOUND) ENDIF()
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc... # Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer") SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
@ -25,8 +25,8 @@ MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION)
ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF(NOT WindowsSDK_FIND_QUIETLY)
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
SET(WINSDK${_VERSION}_DIR "") SET(WINSDK${_VERSION}_DIR "")
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") ENDIF()
ENDMACRO(DETECT_WINSDK_VERSION_HELPER) ENDMACRO()
MACRO(DETECT_WINSDK_VERSION _VERSION) MACRO(DETECT_WINSDK_VERSION _VERSION)
SET(WINSDK${_VERSION}_FOUND OFF) SET(WINSDK${_VERSION}_FOUND OFF)
@ -34,8 +34,8 @@ MACRO(DETECT_WINSDK_VERSION _VERSION)
IF(NOT WINSDK${_VERSION}_FOUND) IF(NOT WINSDK${_VERSION}_FOUND)
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT WINSDK${_VERSION}_FOUND) ENDIF()
ENDMACRO(DETECT_WINSDK_VERSION) ENDMACRO()
SET(WINSDK_VERSIONS "8.1" "8.0" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A") 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) SET(WINSDK_DETECTED_VERSIONS)
@ -46,8 +46,8 @@ FOREACH(_VERSION ${WINSDK_VERSIONS})
IF(WINSDK${_VERSION}_FOUND) IF(WINSDK${_VERSION}_FOUND)
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ENDIF(WINSDK${_VERSION}_FOUND) ENDIF()
ENDFOREACH(_VERSION) ENDFOREACH()
SET(WINSDK_SUFFIX) SET(WINSDK_SUFFIX)
@ -58,19 +58,19 @@ ELSEIF(TARGET_X64)
SET(WINSDK_SUFFIX "x64") SET(WINSDK_SUFFIX "x64")
ELSEIF(TARGET_X86) ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86") SET(WINSDK8_SUFFIX "x86")
ENDIF(TARGET_ARM) ENDIF()
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE}) SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
IF(WINSDKCURRENT_VERSION_INCLUDE) IF(WINSDKCURRENT_VERSION_INCLUDE)
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE) FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
ENDIF(WINSDKCURRENT_VERSION_INCLUDE) ENDIF()
SET(WINSDKENV_DIR $ENV{WINSDK_DIR}) SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
IF(NOT WINSDKENV_DIR) IF(NOT WINSDKENV_DIR)
SET(WINSDKENV_DIR $ENV{WindowsSDKDir}) SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
ENDIF(NOT WINSDKENV_DIR) ENDIF()
MACRO(FIND_WINSDK_VERSION_HEADERS) MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION) IF(WINSDK_DIR AND NOT WINSDK_VERSION)
@ -88,8 +88,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT) IF(_CONTENT)
SET(WINSDK_VERSION "8.1") SET(WINSDK_VERSION "8.1")
ENDIF(_CONTENT) ENDIF()
ENDIF(NOT WINSDK_VERSION) ENDIF()
IF(NOT WINSDK_VERSION) IF(NOT WINSDK_VERSION)
# Look for Windows SDK 8.0 # Look for Windows SDK 8.0
@ -97,8 +97,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT) IF(_CONTENT)
SET(WINSDK_VERSION "8.0") SET(WINSDK_VERSION "8.0")
ENDIF(_CONTENT) ENDIF()
ENDIF(NOT WINSDK_VERSION) ENDIF()
IF(NOT WINSDK_VERSION) IF(NOT WINSDK_VERSION)
# Look for Windows SDK 7.0 # Look for Windows SDK 7.0
@ -123,14 +123,14 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
SET(WINSDK_VERSION "7.1") SET(WINSDK_VERSION "7.1")
ELSEIF(_WINSDKVER STREQUAL "0601") ELSEIF(_WINSDKVER STREQUAL "0601")
SET(WINSDK_VERSION "7.0A") SET(WINSDK_VERSION "7.0A")
ELSE(_WINSDKVER STREQUAL "06010000") ELSE()
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}") MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
ENDIF(_WINSDKVER STREQUAL "06010000") ENDIF()
ELSE(_WINSDKVER_FILE) ELSE()
SET(WINSDK_VERSION "7.0") SET(WINSDK_VERSION "7.0")
ENDIF(_WINSDKVER_FILE) ENDIF()
ENDIF(_CONTENT) ENDIF()
ENDIF(NOT WINSDK_VERSION) ENDIF()
IF(NOT WINSDK_VERSION) IF(NOT WINSDK_VERSION)
# Look for Windows SDK 6.0 # Look for Windows SDK 6.0
@ -138,8 +138,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT) IF(_CONTENT)
SET(WINSDK_VERSION "6.0") SET(WINSDK_VERSION "6.0")
ENDIF(_CONTENT) ENDIF()
ENDIF(NOT WINSDK_VERSION) ENDIF()
IF(NOT WINSDK_VERSION) IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.2 # Look for Windows SDK 5.2
@ -147,8 +147,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT) IF(_CONTENT)
SET(WINSDK_VERSION "5.2") SET(WINSDK_VERSION "5.2")
ENDIF(_CONTENT) ENDIF()
ENDIF(NOT WINSDK_VERSION) ENDIF()
IF(NOT WINSDK_VERSION) IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.1 # Look for Windows SDK 5.1
@ -156,8 +156,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT) IF(_CONTENT)
SET(WINSDK_VERSION "5.1") SET(WINSDK_VERSION "5.1")
ENDIF(_CONTENT) ENDIF()
ENDIF(NOT WINSDK_VERSION) ENDIF()
IF(NOT WINSDK_VERSION) IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.0 # Look for Windows SDK 5.0
@ -165,13 +165,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT) IF(_CONTENT)
SET(WINSDK_VERSION "5.0") SET(WINSDK_VERSION "5.0")
ENDIF(_CONTENT) ENDIF()
ENDIF(NOT WINSDK_VERSION) ENDIF()
ELSE(_MSI_FILE) ELSE()
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}") MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
ENDIF(_MSI_FILE) ENDIF()
ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION) ENDIF()
ENDMACRO(FIND_WINSDK_VERSION_HEADERS) ENDMACRO()
MACRO(USE_CURRENT_WINSDK) MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_DIR "") SET(WINSDK_DIR "")
@ -185,7 +185,7 @@ MACRO(USE_CURRENT_WINSDK)
${WINSDKENV_DIR}/Include/um ${WINSDKENV_DIR}/Include/um
${WINSDKENV_DIR}/Include ${WINSDKENV_DIR}/Include
) )
ENDIF(WINSDKENV_DIR) ENDIF()
# Use INCLUDE environment variable # Use INCLUDE environment variable
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
@ -197,9 +197,9 @@ MACRO(USE_CURRENT_WINSDK)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE}) STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}") MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
BREAK() BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h) ENDIF()
ENDFOREACH(_INCLUDE) ENDFOREACH()
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) ENDIF()
IF(WINSDK_DIR) IF(WINSDK_DIR)
# Compare WINSDK_DIR with registered Windows SDKs # Compare WINSDK_DIR with registered Windows SDKs
@ -208,11 +208,11 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION ${_VERSION}) SET(WINSDK_VERSION ${_VERSION})
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
BREAK() BREAK()
ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}") ENDIF()
ENDFOREACH(_VERSION) ENDFOREACH()
FIND_WINSDK_VERSION_HEADERS() FIND_WINSDK_VERSION_HEADERS()
ENDIF(WINSDK_DIR) ENDIF()
IF(NOT WINSDK_DIR) IF(NOT WINSDK_DIR)
# Use Windows SDK versions installed with VC++ when possible # Use Windows SDK versions installed with VC++ when possible
@ -223,19 +223,19 @@ MACRO(USE_CURRENT_WINSDK)
ELSEIF(MSVC10) ELSEIF(MSVC10)
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "7.0A") SET(WINSDK_VERSION "7.0A")
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) ENDIF()
ELSEIF(MSVC90) ELSEIF(MSVC90)
IF(NOT MSVC_EXPRESS) IF(NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "6.0A") SET(WINSDK_VERSION "6.0A")
ENDIF(NOT MSVC_EXPRESS) ENDIF()
ELSEIF(MSVC80) ELSEIF(MSVC80)
IF(NOT MSVC_EXPRESS) IF(NOT MSVC_EXPRESS)
# TODO: fix this version # TODO: fix this version
SET(WINSDK_VERSION "5.2A") SET(WINSDK_VERSION "5.2A")
ENDIF(NOT MSVC_EXPRESS) ENDIF()
ELSE(MSVC12) ELSE()
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.") MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
ENDIF(MSVC12) ENDIF()
# Use installed Windows SDK # Use installed Windows SDK
IF(NOT WINSDK_VERSION) IF(NOT WINSDK_VERSION)
@ -262,27 +262,27 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
BREAK() BREAK()
ENDIF(WINSDK_VERSION STREQUAL _VERSION) ENDIF()
ENDFOREACH(_VERSION) ENDFOREACH()
ENDIF(NOT WINSDK_DIR) ENDIF()
ENDMACRO(USE_CURRENT_WINSDK) ENDMACRO()
IF(WINSDK_VERSION STREQUAL "CURRENT") IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK() USE_CURRENT_WINSDK()
ELSE(WINSDK_VERSION STREQUAL "CURRENT") ELSE()
IF(WINSDK${WINSDK_VERSION}_FOUND) IF(WINSDK${WINSDK_VERSION}_FOUND)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
ELSE(WINSDK${WINSDK_VERSION}_FOUND) ELSE()
USE_CURRENT_WINSDK() USE_CURRENT_WINSDK()
ENDIF(WINSDK${WINSDK_VERSION}_FOUND) ENDIF()
ENDIF(WINSDK_VERSION STREQUAL "CURRENT") ENDIF()
IF(WINSDK_DIR) IF(WINSDK_DIR)
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}") MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
ELSE(WINSDK_DIR) ELSE()
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!") MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
ENDIF(WINSDK_DIR) ENDIF()
# directory where Win32 headers are found # directory where Win32 headers are found
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
@ -339,9 +339,9 @@ IF(WINSDK_INCLUDE_DIR)
# Fix for using Windows SDK 7.1 with Visual C++ 2012 # Fix for using Windows SDK 7.1 with Visual C++ 2012
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
ADD_DEFINITIONS(-D_USING_V110_SDK71_) ADD_DEFINITIONS(-D_USING_V110_SDK71_)
ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) ENDIF()
ELSE(WINSDK_INCLUDE_DIR) ELSE()
IF(NOT WindowsSDK_FIND_QUIETLY) IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Windows SDK!") MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF()
ENDIF(WINSDK_INCLUDE_DIR) ENDIF()

View file

@ -2,6 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3)
# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) # ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory)
# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) # SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt)
# BINARY_DIR should be set to root of your build directory
IF(SOURCE_DIR) IF(SOURCE_DIR)
# Replace spaces by semi-columns # Replace spaces by semi-columns

View file

@ -40,11 +40,24 @@ include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (clang Clang) CMAKE_FORCE_C_COMPILER (clang Clang)
CMAKE_FORCE_CXX_COMPILER (clang++ Clang) CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
IF(CMAKE_CXX_COMPILER)
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CLANG_VERSION_RAW
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE "Apple LLVM version ([\\.0-9]+).*"
"\\1" CMAKE_CXX_COMPILER_VERSION "${CLANG_VERSION_RAW}")
SET(CMAKE_C_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
SET(CMAKE_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
ENDIF()
# Setup iOS platform # Setup iOS platform
if (NOT DEFINED IOS_PLATFORM) IF(NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS") SET(IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM) ENDIF()
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform") SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform") SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
@ -59,29 +72,35 @@ elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
elseif(${IOS_PLATFORM} STREQUAL "ALL") elseif(${IOS_PLATFORM} STREQUAL "ALL")
# This causes the installers to properly locate the output libraries # This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos") set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
else (${IOS_PLATFORM} STREQUAL "OS") else()
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR") message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS") endif()
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform") set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT # Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available # Note Xcode 4.3 changed the installation location, choose the most recent one available
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms") SET(XCODE_DEFAULT_ROOT "/Applications/Xcode.app/Contents")
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(EXISTS ${XCODE_POST_43_ROOT}) IF(NOT DEFINED CMAKE_XCODE_ROOT)
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT}) IF(EXISTS ${XCODE_DEFAULT_ROOT})
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT}) SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root")
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT}) ELSE()
ENDIF(EXISTS ${XCODE_POST_43_ROOT}) MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist")
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) ENDIF()
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) ENDIF()
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) IF(EXISTS ${TMP})
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP})
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) MESSAGE(STATUS "Use iOS developer root: ${CMAKE_IOS_DEVELOPER_ROOT}")
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) ENDIF()
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${TMP})
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${TMP})
MESSAGE(STATUS "Use iOS simulator developer root: ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}")
ENDIF()
ENDIF()
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform") SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
@ -93,9 +112,9 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS}) FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}") STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
LIST(APPEND ${VERSIONS} ${_IOS_SDK}) LIST(APPEND ${VERSIONS} ${_IOS_SDK})
ENDFOREACH(_CMAKE_IOS_SDK) ENDFOREACH()
ENDIF(_CMAKE_IOS_SDKS) ENDIF()
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS) ENDMACRO()
# Find and use the most recent iOS sdk # Find and use the most recent iOS sdk
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT) IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
@ -104,25 +123,25 @@ IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
IF(NOT IOS_VERSIONS) IF(NOT IOS_VERSIONS)
MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
ENDIF(NOT IOS_VERSIONS) ENDIF()
IF(IOS_VERSION) IF(IOS_VERSION)
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX) LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
IF(_INDEX EQUAL -1) IF(_INDEX EQUAL -1)
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION) LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
ELSE(_INDEX EQUAL -1) ELSE()
SET(IOS_SDK_VERSION ${IOS_VERSION}) SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(_INDEX EQUAL -1) ENDIF()
ELSE(IOS_VERSION) ELSE()
LIST(GET IOS_VERSIONS 0 IOS_VERSION) LIST(GET IOS_VERSIONS 0 IOS_VERSION)
SET(IOS_SDK_VERSION ${IOS_VERSION}) SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(IOS_VERSION) ENDIF()
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}") MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk) SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk)
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk) SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT) endif()
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK") SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
@ -134,31 +153,32 @@ SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS sup
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support") SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
IF(CMAKE_GENERATOR MATCHES Xcode) IF(CMAKE_GENERATOR MATCHES Xcode)
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
IF(${IOS_PLATFORM} STREQUAL "OS") IF(${IOS_PLATFORM} STREQUAL "OS")
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
SET(CMAKE_SYSTEM_PROCESSOR "x86") SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS") ENDIF()
ELSE(CMAKE_GENERATOR MATCHES Xcode) ELSE()
IF(${IOS_PLATFORM} STREQUAL "OS") IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7") SET(ARCHS "armv7;arm64")
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386 # iPhone simulator targets i386
SET(ARCHS "i386") SET(ARCHS "i386")
SET(CMAKE_SYSTEM_PROCESSOR "x86") SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;i386") SET(ARCHS "armv7;arm64;i386;x86_64")
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS") ENDIF()
ENDIF(CMAKE_GENERATOR MATCHES Xcode) ENDIF()
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard. # set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only # The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS") IF(ARCHS)
SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
ENDIF()
# Set the find root to the iOS developer roots and to user defined paths # Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root") set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
@ -174,10 +194,9 @@ set (CMAKE_SYSTEM_FRAMEWORK_PATH
) )
# only search the iOS sdks, not the remainder of the host filesystem # only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include) # determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib) include(CMakeFindBinUtils)
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)