Changed: Updated CMake toolchains modules

--HG--
branch : develop
This commit is contained in:
kervala 2016-06-11 16:55:54 +02:00
parent 9609ac7de2
commit aa5f3b8499
2 changed files with 31 additions and 14 deletions

View file

@ -22,13 +22,8 @@ IF(NOT TARGET_CPU)
SET(TARGET_CPU "armv7") SET(TARGET_CPU "armv7")
ENDIF() 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")
@ -123,6 +118,12 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
# try prefixes without version
SET(_TOOLCHAIN_WITHOUT_VERSION "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}")
IF(EXISTS ${_TOOLCHAIN_WITHOUT_VERSION})
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS "default")
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS) IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains") MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF() ENDIF()
@ -136,7 +137,15 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION) LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF() ENDIF()
MESSAGE(STATUS "TOOLCHAIN_PREFIX = ${${_COMPILER}_TOOLCHAIN_VERSION}")
IF("${${_COMPILER}_TOOLCHAIN_VERSION}" STREQUAL "default")
MESSAGE(STATUS "default")
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}")
ELSE()
MESSAGE(STATUS "not default")
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}") SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
ENDIF()
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}") IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*") FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
@ -214,6 +223,14 @@ IF(CLANG)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as) SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar) SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++) SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++)
IF(NOT EXISTS "${CMAKE_ASM_COMPILER}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
ENDIF()
IF(NOT EXISTS "${CMAKE_AR}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
ENDIF()
ELSE() ELSE()
MESSAGE(STATUS "Using GCC compiler") MESSAGE(STATUS "Using GCC compiler")

View file

@ -177,26 +177,26 @@ 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
IF(ARCHS) IF(ARCHS)
SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS") SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE STRING "Build architecture for iOS")
ENDIF() 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} ${CMAKE_SOURCE_DIR}/external $ENV{EXTERNAL_IOS_PATH} CACHE STRING "iOS find search path root")
# default to searching for frameworks first # default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST) SET(CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks # set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH SET(CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks ${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks ${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
) )
# 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 BOTH) 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)
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH # determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
include(CMakeFindBinUtils) include(CMakeFindBinUtils)