mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 18:40:54 +00:00
Changed: Updates CMake modules
This commit is contained in:
parent
2187bc3f1e
commit
89d2034edc
9 changed files with 238 additions and 181 deletions
|
@ -15,48 +15,76 @@ IF(NOT NDK_ROOT)
|
|||
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
|
||||
ENDIF(CMAKE_HOST_WIN32)
|
||||
ENDIF(NOT NDK_ROOT)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT TARGET_CPU)
|
||||
SET(TARGET_CPU "armv7")
|
||||
ENDIF(NOT TARGET_CPU)
|
||||
ENDIF()
|
||||
|
||||
SET(ARMV7_HARD_FLOAT OFF)
|
||||
|
||||
IF(TARGET_CPU STREQUAL "armv7")
|
||||
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
|
||||
IF(ARMV7_HARD_FLOAT)
|
||||
SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard")
|
||||
ENDIF()
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
SET(TOOLCHAIN_ARCH "arm")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
|
||||
SET(MINIMUM_NDK_TARGET 4)
|
||||
ELSEIF(TARGET_CPU STREQUAL "armv5")
|
||||
SET(LIBRARY_ARCHITECTURE "armeabi")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
|
||||
SET(TOOLCHAIN_ARCH "arm")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
|
||||
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")
|
||||
SET(LIBRARY_ARCHITECTURE "x86")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
SET(TOOLCHAIN_ARCH "x86")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "x86")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "i686")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android")
|
||||
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")
|
||||
SET(LIBRARY_ARCHITECTURE "mips")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "mips")
|
||||
SET(TOOLCHAIN_ARCH "mips")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android")
|
||||
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")
|
||||
|
||||
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
|
||||
SET(ANDROID_COMPILER "clang")
|
||||
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
|
||||
SET(CLANG ON)
|
||||
ELSE()
|
||||
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
|
||||
|
@ -64,7 +92,11 @@ ENDIF()
|
|||
|
||||
IF(NOT 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)
|
||||
SET(TOOLCHAIN_HOST "windows")
|
||||
|
@ -75,7 +107,7 @@ ELSEIF(CMAKE_HOST_APPLE)
|
|||
ELSEIF(CMAKE_HOST_UNIX)
|
||||
SET(TOOLCHAIN_HOST "linux")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||
ENDIF(CMAKE_HOST_WIN32)
|
||||
ENDIF()
|
||||
|
||||
MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
||||
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
|
||||
|
@ -110,7 +142,7 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
|||
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
|
||||
IF(_TOOLCHAIN_PREFIXES)
|
||||
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
|
||||
ENDIF(_TOOLCHAIN_PREFIXES)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
@ -123,8 +155,14 @@ ENDIF()
|
|||
SEARCH_TOOLCHAIN(GCC)
|
||||
|
||||
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
|
||||
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
|
||||
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
|
||||
|
||||
IF(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}")
|
||||
ENDIF()
|
||||
|
||||
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}")
|
||||
# NDK version >= 8b
|
||||
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||
|
||||
# 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)
|
||||
ENDIF()
|
||||
|
||||
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
|
||||
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_INCLUDE ONLY)
|
||||
|
||||
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
|
||||
IF("${_BINARY}" MATCHES "clang")
|
||||
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
|
||||
ELSE()
|
||||
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
||||
ENDIF()
|
||||
ENDMACRO(SET_TOOLCHAIN_BINARY)
|
||||
MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
|
||||
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
|
||||
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
||||
ENDMACRO()
|
||||
|
||||
# Force the compilers to GCC for Android
|
||||
include (CMakeForceCompiler)
|
||||
|
||||
IF(CLANG)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
|
||||
MESSAGE(STATUS "Using clang compiler")
|
||||
|
||||
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_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()
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
|
||||
MESSAGE(STATUS "Using GCC compiler")
|
||||
|
||||
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_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()
|
||||
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
if(MAXSDK_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||
endif(MAXSDK_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
FIND_PATH(MAXSDK_DIR
|
||||
"include/maxversion.h"
|
||||
|
@ -37,9 +37,9 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
|||
|
||||
IF(TARGET_X64)
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
|
||||
ELSE(TARGET_X64)
|
||||
ELSE()
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||
ENDIF(TARGET_X64)
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
|
@ -47,7 +47,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||
HINTS
|
||||
${MAXSDK_LIBRARY_DIRS}
|
||||
)
|
||||
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
ENDMACRO()
|
||||
|
||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
||||
|
|
|
@ -45,6 +45,6 @@ IF(MFC_FOUND)
|
|||
|
||||
# Set CMake flag to use MFC DLL
|
||||
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
|
||||
|
|
|
@ -30,16 +30,16 @@ MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||
HINTS
|
||||
"${DXSDK_LIBRARY_DIR}"
|
||||
)
|
||||
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
ENDMACRO()
|
||||
|
||||
IF(DXSDK_DIR)
|
||||
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
|
||||
|
||||
IF(TARGET_X64)
|
||||
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)
|
||||
ENDIF(TARGET_X64)
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(DXSDK_LIBRARY_DIR
|
||||
dxguid.lib
|
||||
|
@ -52,7 +52,7 @@ IF(DXSDK_DIR)
|
|||
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
|
||||
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
|
||||
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
|
||||
ENDIF(DXSDK_DIR)
|
||||
ENDIF()
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
|
|
|
@ -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)
|
||||
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
|
||||
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(VC${_VERSION}_FOUND ON)
|
||||
|
@ -24,14 +24,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
|
|||
SET(_VERSION_STR ${_VERSION})
|
||||
IF(MSVC_EXPRESS)
|
||||
SET(_VERSION_STR "${_VERSION_STR} Express")
|
||||
ENDIF(MSVC_EXPRESS)
|
||||
ENDIF()
|
||||
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")
|
||||
SET(VC${_VERSION}_FOUND OFF)
|
||||
SET(VC${_VERSION}_DIR "")
|
||||
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_VC_VERSION_HELPER)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DETECT_VC_VERSION _VERSION)
|
||||
SET(VC${_VERSION}_FOUND OFF)
|
||||
|
@ -39,21 +39,21 @@ MACRO(DETECT_VC_VERSION _VERSION)
|
|||
|
||||
IF(NOT VC${_VERSION}_FOUND)
|
||||
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||
ENDIF(NOT VC${_VERSION}_FOUND)
|
||||
ENDIF()
|
||||
|
||||
IF(VC${_VERSION}_FOUND)
|
||||
SET(VC_FOUND ON)
|
||||
SET(VC_DIR "${VC${_VERSION}_DIR}")
|
||||
ENDIF(VC${_VERSION}_FOUND)
|
||||
ENDMACRO(DETECT_VC_VERSION)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
||||
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")
|
||||
SET(MSVC_EXPRESS ON)
|
||||
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_EXPRESS_VERSION)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF(MSVC12)
|
||||
DETECT_VC_VERSION("12.0")
|
||||
|
@ -62,7 +62,7 @@ IF(MSVC12)
|
|||
IF(NOT MSVC12_REDIST_DIR)
|
||||
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC12_REDIST_DIR)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC11)
|
||||
DETECT_VC_VERSION("11.0")
|
||||
SET(MSVC_TOOLSET "110")
|
||||
|
@ -70,7 +70,7 @@ ELSEIF(MSVC11)
|
|||
IF(NOT MSVC11_REDIST_DIR)
|
||||
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC11_REDIST_DIR)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC10)
|
||||
DETECT_VC_VERSION("10.0")
|
||||
SET(MSVC_TOOLSET "100")
|
||||
|
@ -78,19 +78,19 @@ ELSEIF(MSVC10)
|
|||
IF(NOT MSVC10_REDIST_DIR)
|
||||
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC10_REDIST_DIR)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC90)
|
||||
DETECT_VC_VERSION("9.0")
|
||||
SET(MSVC_TOOLSET "90")
|
||||
ELSEIF(MSVC80)
|
||||
DETECT_VC_VERSION("8.0")
|
||||
SET(MSVC_TOOLSET "80")
|
||||
ENDIF(MSVC12)
|
||||
ENDIF()
|
||||
|
||||
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
|
||||
IF(NOT VC_DIR)
|
||||
SET(VC_DIR $ENV{VC_DIR})
|
||||
ENDIF(NOT VC_DIR)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT VC_DIR)
|
||||
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
# MESSAGE("Current revision is ${Project_WC_REVISION}")
|
||||
# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project)
|
||||
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
|
||||
# ENDIF(MERCURIAL_FOUND)
|
||||
# ENDIF()
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2009 Kitware, Inc.
|
||||
|
@ -74,22 +74,22 @@ IF(Mercurial_HG_EXECUTABLE)
|
|||
|
||||
IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
||||
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)
|
||||
IF(_COUNT EQUAL 4)
|
||||
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
|
||||
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
|
||||
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
|
||||
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
|
||||
ELSE(_COUNT EQUAL 4)
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Bad output from HG")
|
||||
SET(${prefix}_WC_REVISION "unknown")
|
||||
SET(${prefix}_WC_CHANGESET "unknown")
|
||||
SET(${prefix}_WC_BRANCH "unknown")
|
||||
ENDIF(_COUNT EQUAL 4)
|
||||
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ENDMACRO(Mercurial_WC_INFO)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(Mercurial_WC_LOG dir prefix)
|
||||
# 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)
|
||||
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)
|
||||
ENDMACRO(Mercurial_WC_LOG)
|
||||
ENDIF(Mercurial_HG_EXECUTABLE)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
IF(WINSDK_FOUND)
|
||||
# If Windows SDK already found, skip it
|
||||
RETURN()
|
||||
ENDIF(WINSDK_FOUND)
|
||||
ENDIF()
|
||||
|
||||
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
|
||||
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)
|
||||
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(WINSDK${_VERSION}_DIR "")
|
||||
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_WINSDK_VERSION_HELPER)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DETECT_WINSDK_VERSION _VERSION)
|
||||
SET(WINSDK${_VERSION}_FOUND OFF)
|
||||
|
@ -34,8 +34,8 @@ MACRO(DETECT_WINSDK_VERSION _VERSION)
|
|||
|
||||
IF(NOT WINSDK${_VERSION}_FOUND)
|
||||
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||
ENDIF(NOT WINSDK${_VERSION}_FOUND)
|
||||
ENDMACRO(DETECT_WINSDK_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)
|
||||
|
@ -46,8 +46,8 @@ FOREACH(_VERSION ${WINSDK_VERSIONS})
|
|||
|
||||
IF(WINSDK${_VERSION}_FOUND)
|
||||
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
|
||||
ENDIF(WINSDK${_VERSION}_FOUND)
|
||||
ENDFOREACH(_VERSION)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
SET(WINSDK_SUFFIX)
|
||||
|
||||
|
@ -58,19 +58,19 @@ ELSEIF(TARGET_X64)
|
|||
SET(WINSDK_SUFFIX "x64")
|
||||
ELSEIF(TARGET_X86)
|
||||
SET(WINSDK8_SUFFIX "x86")
|
||||
ENDIF(TARGET_ARM)
|
||||
ENDIF()
|
||||
|
||||
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
|
||||
|
||||
IF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF()
|
||||
|
||||
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
|
||||
|
||||
IF(NOT WINSDKENV_DIR)
|
||||
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
|
||||
ENDIF(NOT WINSDKENV_DIR)
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
||||
|
@ -88,8 +88,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "8.1")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 8.0
|
||||
|
@ -97,8 +97,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "8.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 7.0
|
||||
|
@ -123,14 +123,14 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
SET(WINSDK_VERSION "7.1")
|
||||
ELSEIF(_WINSDKVER STREQUAL "0601")
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ELSE(_WINSDKVER STREQUAL "06010000")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
|
||||
ENDIF(_WINSDKVER STREQUAL "06010000")
|
||||
ELSE(_WINSDKVER_FILE)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(WINSDK_VERSION "7.0")
|
||||
ENDIF(_WINSDKVER_FILE)
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 6.0
|
||||
|
@ -138,8 +138,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "6.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.2
|
||||
|
@ -147,8 +147,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.2")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.1
|
||||
|
@ -156,8 +156,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.1")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.0
|
||||
|
@ -165,13 +165,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ELSE(_MSI_FILE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
|
||||
ENDIF(_MSI_FILE)
|
||||
ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
||||
ENDMACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(USE_CURRENT_WINSDK)
|
||||
SET(WINSDK_DIR "")
|
||||
|
@ -185,7 +185,7 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
${WINSDKENV_DIR}/Include/um
|
||||
${WINSDKENV_DIR}/Include
|
||||
)
|
||||
ENDIF(WINSDKENV_DIR)
|
||||
ENDIF()
|
||||
|
||||
# Use INCLUDE environment variable
|
||||
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})
|
||||
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
|
||||
BREAK()
|
||||
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
|
||||
ENDFOREACH(_INCLUDE)
|
||||
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
# Compare WINSDK_DIR with registered Windows SDKs
|
||||
|
@ -208,11 +208,11 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
SET(WINSDK_VERSION ${_VERSION})
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
BREAK()
|
||||
ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
|
||||
ENDFOREACH(_VERSION)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
FIND_WINSDK_VERSION_HEADERS()
|
||||
ENDIF(WINSDK_DIR)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_DIR)
|
||||
# Use Windows SDK versions installed with VC++ when possible
|
||||
|
@ -223,19 +223,19 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
ELSEIF(MSVC10)
|
||||
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC90)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "6.0A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC80)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
# TODO: fix this version
|
||||
SET(WINSDK_VERSION "5.2A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ELSE(MSVC12)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
|
||||
ENDIF(MSVC12)
|
||||
ENDIF()
|
||||
|
||||
# Use installed Windows SDK
|
||||
IF(NOT WINSDK_VERSION)
|
||||
|
@ -262,27 +262,27 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
BREAK()
|
||||
ENDIF(WINSDK_VERSION STREQUAL _VERSION)
|
||||
ENDFOREACH(_VERSION)
|
||||
ENDIF(NOT WINSDK_DIR)
|
||||
ENDMACRO(USE_CURRENT_WINSDK)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
USE_CURRENT_WINSDK()
|
||||
ELSE(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
ELSE()
|
||||
IF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
ELSE(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
ELSE()
|
||||
USE_CURRENT_WINSDK()
|
||||
ENDIF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
ENDIF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
|
||||
ELSE(WINSDK_DIR)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
|
||||
ENDIF(WINSDK_DIR)
|
||||
ENDIF()
|
||||
|
||||
# directory where Win32 headers are found
|
||||
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
|
||||
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
||||
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
||||
ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
||||
ELSE(WINSDK_INCLUDE_DIR)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDK_INCLUDE_DIR)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
|
|
@ -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)
|
||||
# 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)
|
||||
# Replace spaces by semi-columns
|
||||
|
|
|
@ -40,48 +40,67 @@ include (CMakeForceCompiler)
|
|||
CMAKE_FORCE_C_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
|
||||
if (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM "OS")
|
||||
endif (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
IF(NOT DEFINED IOS_PLATFORM)
|
||||
SET(IOS_PLATFORM "OS")
|
||||
ENDIF()
|
||||
|
||||
SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
|
||||
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
||||
# Check the platform selection and setup for developer root
|
||||
if (${IOS_PLATFORM} STREQUAL "OS")
|
||||
if(${IOS_PLATFORM} STREQUAL "OS")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
elseif(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||
elseif (${IOS_PLATFORM} STREQUAL "ALL")
|
||||
elseif(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
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")
|
||||
endif (${IOS_PLATFORM} STREQUAL "OS")
|
||||
endif()
|
||||
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
|
||||
# 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_PRE_43_ROOT "/Developer/Platforms")
|
||||
SET(XCODE_DEFAULT_ROOT "/Applications/Xcode.app/Contents")
|
||||
|
||||
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
IF(EXISTS ${XCODE_POST_43_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
|
||||
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
|
||||
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
|
||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
IF(NOT DEFINED CMAKE_XCODE_ROOT)
|
||||
IF(EXISTS ${XCODE_DEFAULT_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
IF(EXISTS ${TMP})
|
||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP})
|
||||
MESSAGE(STATUS "Use iOS developer root: ${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_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
|
||||
|
||||
|
@ -93,36 +112,36 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
|
|||
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
|
||||
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
|
||||
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
|
||||
ENDFOREACH(_CMAKE_IOS_SDK)
|
||||
ENDIF(_CMAKE_IOS_SDKS)
|
||||
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Find and use the most recent iOS sdk
|
||||
# Find and use the most recent iOS sdk
|
||||
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
# Search for a specific version of a SDK
|
||||
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} 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.")
|
||||
ENDIF(NOT IOS_VERSIONS)
|
||||
|
||||
ENDIF()
|
||||
|
||||
IF(IOS_VERSION)
|
||||
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
|
||||
IF(_INDEX EQUAL -1)
|
||||
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
|
||||
ELSE(_INDEX EQUAL -1)
|
||||
ELSE()
|
||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||
ENDIF(_INDEX EQUAL -1)
|
||||
ELSE(IOS_VERSION)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
|
||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||
ENDIF(IOS_VERSION)
|
||||
ENDIF()
|
||||
|
||||
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_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_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")
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES Xcode)
|
||||
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
ELSE(CMAKE_GENERATOR MATCHES Xcode)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(ARCHS "armv7")
|
||||
SET(ARCHS "armv7;arm64")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
# iPhone simulator targets i386
|
||||
SET(ARCHS "i386")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
SET(ARCHS "armv7;i386")
|
||||
SET(ARCHS "armv7;arm64;i386;x86_64")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
|
||||
ENDIF()
|
||||
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
|
||||
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 (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
|
||||
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_INCLUDE ONLY)
|
||||
|
||||
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
|
||||
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
|
||||
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)
|
||||
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
|
||||
include(CMakeFindBinUtils)
|
||||
|
|
Loading…
Reference in a new issue