From 9da0c223c659dbc90dbee82b1448db08b7b05130 Mon Sep 17 00:00:00 2001 From: halx99 Date: Wed, 11 Nov 2020 15:07:21 +0800 Subject: [PATCH] fix ci for ios [ci build] --- cmake/ios.mini.cmake | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/cmake/ios.mini.cmake b/cmake/ios.mini.cmake index df05561ce7..ea21c980df 100644 --- a/cmake/ios.mini.cmake +++ b/cmake/ios.mini.cmake @@ -1,9 +1,7 @@ -# The workaround for solve try_compile failed with code sign +# The best solution for fix try_compile failed with code sign currently # since cmake-3.18.2, not required # everyting for cmake toolchain config before project(xxx) is better - set(CMAKE_SYSTEM_NAME "iOS" CACHE STRING "The CMake system name for iOS") - set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES "CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED" "CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED") @@ -18,18 +16,37 @@ if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*armv7.*") if(NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET OR "${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_GREATER "11.0" OR "${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_EQUAL "11.0") - message(STATUS "Sets iOS minimum deployment target to 10.0 for armv7") + message(STATUS "Forcing osx minimum deployment target to 10.0 for armv7") # a. armv7 maximum deployment 10.x # b. armv7 TLS require deployment 10.x set(CMAKE_OSX_DEPLOYMENT_TARGET "10.0" CACHE STRING "Minimum OS X deployment version") endif() else() if(NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) - message(STATUS "The CMAKE_OSX_DEPLOYMENT_TARGET not defined, sets iOS minimum deployment target to 9.0") + message(STATUS "The CMAKE_OSX_DEPLOYMENT_TARGET not defined, sets iOS minimum deployment target to 9.0") set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0" CACHE STRING "Minimum OS X deployment version") endif() endif() - if(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET) set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET} CACHE STRING "Minimum iphoneos deployment version") endif() +message(STATUS "Minimum ios deployment target is ${CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET}") + +# Sets CMAKE_SYSTEM_PROCESSOR for iphoneos and iphonesimulator +message(STATUS "Before configure CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}") +if("${CMAKE_OSX_SYSROOT}" MATCHES "iphonesimulator") + if("${CMAKE_OSX_ARCHITECTURES}" MATCHES "i386") + set(CMAKE_SYSTEM_PROCESSOR i386) + elseif("${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64") + set(CMAKE_SYSTEM_PROCESSOR x86_64) + else() # Since xcode12, default arch for iphonesimulator is arm64 + if(${XCODE_VERSION} LESS "12.0.0") + set(CMAKE_SYSTEM_PROCESSOR x86_64) + else() + set(CMAKE_SYSTEM_PROCESSOR arm64) + endif() + endif() +else() + set(CMAKE_SYSTEM_PROCESSOR arm64) +endif() +message(STATUS "After configure CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")