mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Added: Toolchains for Android and iOS
This commit is contained in:
parent
3988120c55
commit
f2bc8f3c8c
2 changed files with 332 additions and 0 deletions
149
code/CMakeModules/AndroidToolChain.cmake
Normal file
149
code/CMakeModules/AndroidToolChain.cmake
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
IF(DEFINED CMAKE_CROSSCOMPILING)
|
||||||
|
# subsequent toolchain loading is not really needed
|
||||||
|
RETURN()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Standard settings
|
||||||
|
SET(CMAKE_SYSTEM_NAME Linux)
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Linux version
|
||||||
|
SET(UNIX ON)
|
||||||
|
SET(LINUX ON)
|
||||||
|
SET(ANDROID ON)
|
||||||
|
|
||||||
|
IF(NOT NDK_ROOT)
|
||||||
|
SET(NDK_ROOT $ENV{NDK_ROOT})
|
||||||
|
|
||||||
|
IF(CMAKE_HOST_WIN32)
|
||||||
|
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
|
||||||
|
ENDIF(CMAKE_HOST_WIN32)
|
||||||
|
ENDIF(NOT NDK_ROOT)
|
||||||
|
|
||||||
|
IF(NOT TARGET_CPU)
|
||||||
|
SET(TARGET_CPU "armv7")
|
||||||
|
ENDIF(NOT TARGET_CPU)
|
||||||
|
|
||||||
|
IF(TARGET_CPU STREQUAL "armv7")
|
||||||
|
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
|
SET(TOOLCHAIN_ARCH "arm")
|
||||||
|
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||||
|
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
||||||
|
SET(MINIMUM_NDK_TARGET 4)
|
||||||
|
ELSEIF(TARGET_CPU STREQUAL "armv5")
|
||||||
|
SET(LIBRARY_ARCHITECTURE "armeabi")
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
|
||||||
|
SET(TOOLCHAIN_ARCH "arm")
|
||||||
|
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||||
|
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
||||||
|
SET(MINIMUM_NDK_TARGET 4)
|
||||||
|
ELSEIF(TARGET_CPU STREQUAL "x86")
|
||||||
|
SET(LIBRARY_ARCHITECTURE "x86")
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||||
|
SET(TOOLCHAIN_ARCH "x86")
|
||||||
|
SET(TOOLCHAIN_PREFIX "x86")
|
||||||
|
SET(TOOLCHAIN_BIN_PREFIX "i686")
|
||||||
|
SET(MINIMUM_NDK_TARGET 9)
|
||||||
|
ELSEIF(TARGET_CPU STREQUAL "mips")
|
||||||
|
SET(LIBRARY_ARCHITECTURE "mips")
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR "mips")
|
||||||
|
SET(TOOLCHAIN_ARCH "mips")
|
||||||
|
SET(TOOLCHAIN_PREFIX "mipsel-linux-android")
|
||||||
|
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
|
||||||
|
SET(MINIMUM_NDK_TARGET 9)
|
||||||
|
ENDIF(TARGET_CPU STREQUAL "armv7")
|
||||||
|
|
||||||
|
IF(NOT NDK_TARGET)
|
||||||
|
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
|
||||||
|
ENDIF(NOT NDK_TARGET)
|
||||||
|
|
||||||
|
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*")
|
||||||
|
IF(_TOOLCHAIN_VERSIONS)
|
||||||
|
LIST(SORT _TOOLCHAIN_VERSIONS)
|
||||||
|
LIST(REVERSE _TOOLCHAIN_VERSIONS)
|
||||||
|
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
|
||||||
|
STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
|
||||||
|
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
|
||||||
|
LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
|
||||||
|
ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
|
||||||
|
ENDFOREACH(_TOOLCHAIN_VERSION)
|
||||||
|
ENDIF(_TOOLCHAIN_VERSIONS)
|
||||||
|
|
||||||
|
IF(NOT NDK_TOOLCHAIN_VERSIONS)
|
||||||
|
MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains")
|
||||||
|
ENDIF(NOT NDK_TOOLCHAIN_VERSIONS)
|
||||||
|
|
||||||
|
IF(NDK_TOOLCHAIN_VERSION)
|
||||||
|
LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX)
|
||||||
|
IF(_INDEX EQUAL -1)
|
||||||
|
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
|
||||||
|
ENDIF(_INDEX EQUAL -1)
|
||||||
|
ELSE(NDK_TOOLCHAIN_VERSION)
|
||||||
|
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
|
||||||
|
ENDIF(NDK_TOOLCHAIN_VERSION)
|
||||||
|
|
||||||
|
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}")
|
||||||
|
|
||||||
|
IF(CMAKE_HOST_WIN32)
|
||||||
|
SET(TOOLCHAIN_HOST "windows")
|
||||||
|
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
|
||||||
|
ELSEIF(CMAKE_HOST_APPLE)
|
||||||
|
SET(TOOLCHAIN_HOST "apple")
|
||||||
|
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||||
|
ELSEIF(CMAKE_HOST_UNIX)
|
||||||
|
SET(TOOLCHAIN_HOST "linux")
|
||||||
|
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||||
|
ENDIF(CMAKE_HOST_WIN32)
|
||||||
|
|
||||||
|
SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
|
||||||
|
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
|
||||||
|
|
||||||
|
IF(NOT EXISTS "${TOOLCHAIN_ROOT}")
|
||||||
|
FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*")
|
||||||
|
IF(_TOOLCHAIN_PREFIXES)
|
||||||
|
LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT)
|
||||||
|
ENDIF(_TOOLCHAIN_PREFIXES)
|
||||||
|
ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}")
|
||||||
|
|
||||||
|
MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}")
|
||||||
|
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
|
||||||
|
|
||||||
|
# include dirs
|
||||||
|
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
|
||||||
|
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
|
||||||
|
|
||||||
|
IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
|
||||||
|
# NDK version >= 8b
|
||||||
|
SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
|
||||||
|
ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
|
||||||
|
|
||||||
|
# Determine bin prefix for toolchain
|
||||||
|
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${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 "${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_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
|
||||||
|
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
|
||||||
|
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
|
||||||
|
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
|
||||||
|
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR})
|
||||||
|
|
||||||
|
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
|
||||||
|
SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX})
|
||||||
|
ENDMACRO(SET_TOOLCHAIN_BINARY)
|
||||||
|
|
||||||
|
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
|
||||||
|
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
|
||||||
|
|
||||||
|
# Force the compilers to GCC for Android
|
||||||
|
include (CMakeForceCompiler)
|
||||||
|
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
|
||||||
|
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
|
183
code/CMakeModules/iOSToolChain.cmake
Normal file
183
code/CMakeModules/iOSToolChain.cmake
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
|
||||||
|
# files which are included with CMake 2.8.4
|
||||||
|
# It has been altered for iOS development
|
||||||
|
#
|
||||||
|
# Options:
|
||||||
|
#
|
||||||
|
# IOS_VERSION = last(default) or specific one (4.3, 5.0, 4.1)
|
||||||
|
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||||
|
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||||
|
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||||
|
#
|
||||||
|
# IOS_PLATFORM = OS (default) or SIMULATOR or ALL
|
||||||
|
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||||
|
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||||
|
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||||
|
#
|
||||||
|
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
|
||||||
|
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
|
||||||
|
# If set manually, it will override the default location and force the user of a particular Developer Platform
|
||||||
|
#
|
||||||
|
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
|
||||||
|
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
|
||||||
|
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
|
||||||
|
# If set manually, this will force the use of a specific SDK version
|
||||||
|
|
||||||
|
IF(DEFINED CMAKE_CROSSCOMPILING)
|
||||||
|
# subsequent toolchain loading is not really needed
|
||||||
|
RETURN()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Standard settings
|
||||||
|
SET(CMAKE_SYSTEM_NAME Darwin)
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Darwin version
|
||||||
|
SET(UNIX ON)
|
||||||
|
SET(APPLE ON)
|
||||||
|
SET(IOS ON)
|
||||||
|
|
||||||
|
# Force the compilers to Clang for iOS
|
||||||
|
include (CMakeForceCompiler)
|
||||||
|
CMAKE_FORCE_C_COMPILER (clang Clang)
|
||||||
|
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
|
||||||
|
|
||||||
|
# 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")
|
||||||
|
|
||||||
|
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")
|
||||||
|
# This causes the installers to properly locate the output libraries
|
||||||
|
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||||
|
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")
|
||||||
|
# This causes the installers to properly locate the output libraries
|
||||||
|
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
|
||||||
|
else (${IOS_PLATFORM} STREQUAL "OS")
|
||||||
|
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
|
||||||
|
endif (${IOS_PLATFORM} STREQUAL "OS")
|
||||||
|
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")
|
||||||
|
|
||||||
|
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)
|
||||||
|
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")
|
||||||
|
|
||||||
|
MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
|
||||||
|
FILE(GLOB _CMAKE_IOS_SDKS "${ROOT}/SDKs/iPhoneOS*")
|
||||||
|
IF(_CMAKE_IOS_SDKS)
|
||||||
|
LIST(SORT _CMAKE_IOS_SDKS)
|
||||||
|
LIST(REVERSE _CMAKE_IOS_SDKS)
|
||||||
|
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)
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
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)
|
||||||
|
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||||
|
ENDIF(_INDEX EQUAL -1)
|
||||||
|
ELSE(IOS_VERSION)
|
||||||
|
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
|
||||||
|
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||||
|
ENDIF(IOS_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_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
|
||||||
|
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||||
|
|
||||||
|
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(IOS_VERSION ${IOS_VERSION} CACHE STRING "iOS target version")
|
||||||
|
|
||||||
|
# Set the sysroot default to the most recent SDK
|
||||||
|
SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
|
||||||
|
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)
|
||||||
|
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||||
|
SET(ARCHS "armv7")
|
||||||
|
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(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
|
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
||||||
|
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
|
||||||
|
|
||||||
|
# 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")
|
||||||
|
|
||||||
|
# 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")
|
||||||
|
|
||||||
|
# default to searching for frameworks first
|
||||||
|
set (CMAKE_FIND_FRAMEWORK FIRST)
|
||||||
|
|
||||||
|
# set up the default search directories for frameworks
|
||||||
|
set (CMAKE_SYSTEM_FRAMEWORK_PATH
|
||||||
|
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
|
||||||
|
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
|
||||||
|
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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_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)
|
Loading…
Reference in a new issue