Commit 43b5d5b9 authored by Gregor Jasny's avatar Gregor Jasny

Xcode: port tests to new SDK handling

Issue: #17870
parent 928bcc96
......@@ -3,28 +3,21 @@ project(DeploymentTarget C)
# using Xcode 7.1 SDK versions for deployment targets
if(SDK MATCHES iphone)
set(CMAKE_OSX_SYSROOT ${SDK})
set(CMAKE_OSX_ARCHITECTURES "armv7;x86_64")
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "9.1")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
elseif(SDK MATCHES watch)
set(CMAKE_OSX_SYSROOT ${SDK})
set(CMAKE_OSX_ARCHITECTURES "armv7k;i386")
elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
elseif(SDK MATCHES appletv)
set(CMAKE_OSX_SYSROOT ${SDK})
elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0")
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
else()
set(CMAKE_OSX_SYSROOT ${SDK})
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11")
endif()
......
include(RunCMake)
if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(IOS_DEPLOYMENT_TARGET "-DCMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET=10")
endif()
run_cmake(ExplicitCMakeLists)
run_cmake(XcodeFileType)
......@@ -31,8 +27,8 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeInstallIOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install"
"${IOS_DEPLOYMENT_TARGET}")
"-DCMAKE_SYSTEM_NAME=iOS"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
......@@ -47,7 +43,7 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesOSX-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DTEST_IOS=OFF"
"-DCMAKE_SYSTEM_NAME=Darwin"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
......@@ -64,9 +60,8 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesIOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DTEST_IOS=ON"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
"${IOS_DEPLOYMENT_TARGET}")
"-DCMAKE_SYSTEM_NAME=iOS"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
......@@ -84,7 +79,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesWatchOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DTEST_WATCHOS=ON"
"-DCMAKE_SYSTEM_NAME=watchOS"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
......@@ -103,7 +98,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7.1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesTvOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DTEST_TVOS=ON"
"-DCMAKE_SYSTEM_NAME=tvOS"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
......@@ -129,9 +124,9 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
"-DCMAKE_SYSTEM_NAME=iOS"
"-DCMAKE_IOS_INSTALL_COMBINED=YES"
"${IOS_DEPLOYMENT_TARGET}")
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
......@@ -148,9 +143,9 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
"-DCMAKE_SYSTEM_NAME=iOS"
"-DCMAKE_IOS_INSTALL_COMBINED=YES"
"${IOS_DEPLOYMENT_TARGET}")
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
......@@ -167,9 +162,9 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
"-DCMAKE_SYSTEM_NAME=iOS"
"-DCMAKE_IOS_INSTALL_COMBINED=YES"
"${IOS_DEPLOYMENT_TARGET}")
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
......@@ -223,10 +218,10 @@ if(NOT XCODE_VERSION VERSION_LESS 7)
endif()
if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
function(deploymeny_target_test SDK)
function(deployment_target_test SystemName SDK)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DSDK=${SDK}")
set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=${SystemName}" "-DCMAKE_OSX_SYSROOT=${SDK}")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
......@@ -235,9 +230,13 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
run_cmake_command(DeploymentTarget-${SDK} ${CMAKE_COMMAND} --build .)
endfunction()
foreach(SDK macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator)
deploymeny_target_test(${SDK})
endforeach()
deployment_target_test(Darwin macosx)
deployment_target_test(iOS iphoneos)
deployment_target_test(iOS iphonesimulator)
deployment_target_test(tvOS appletvos)
deployment_target_test(tvOS appletvsimulator)
deployment_target_test(watchOS watchos)
deployment_target_test(watchOS watchsimulator)
endif()
function(XcodeDependOnZeroCheck)
......
......@@ -3,27 +3,12 @@
cmake_minimum_required(VERSION 3.3)
enable_language(C)
# due to lack of toolchain file it might point to running macOS version
unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
if(TEST_IOS)
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_OSX_ARCHITECTURES "armv7")
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
endif(TEST_IOS)
if(TEST_WATCHOS)
set(CMAKE_OSX_SYSROOT watchos)
set(CMAKE_OSX_ARCHITECTURES "armv7k")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
endif()
if(TEST_TVOS)
set(CMAKE_OSX_SYSROOT appletvos)
set(CMAKE_OSX_ARCHITECTURES "arm64")
if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
......@@ -41,7 +26,7 @@ add_dependencies(AppBundleTest AppBundle)
# with custom extension
if (NOT TEST_IOS AND NOT TEST_WATCHOS AND NOT TEST_TVOS)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_executable(AppBundleExt MACOSX_BUNDLE main.m)
set_target_properties(AppBundleExt PROPERTIES BUNDLE_EXTENSION "foo")
install(TARGETS AppBundleExt BUNDLE DESTINATION FooExtension)
......@@ -55,7 +40,7 @@ endif()
# Shared Framework (not supported for iOS on Xcode < 6)
if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" OR NOT XCODE_VERSION VERSION_LESS 6)
add_library(SharedFramework SHARED main.c)
set_target_properties(SharedFramework PROPERTIES FRAMEWORK TRUE)
......
......@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.3)
project(IOSInstallCombined CXX)
# due to lack of toolchain file it might point to running macOS version
unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
......
......@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.3)
project(XcodeIOSInstallCombinedPrune CXX)
# due to lack of toolchain file it might point to running macOS version
unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
......
......@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.3)
project(XcodeIOSInstallCombinedSingleArch CXX)
# due to lack of toolchain file it might point to running macOS version
unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
......
......@@ -2,11 +2,8 @@ cmake_minimum_required(VERSION 2.8.5)
project(XcodeInstallIOS)
set(CMAKE_OSX_SYSROOT iphoneos)
set(XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
set(CMAKE_OSX_ARCHITECTURES "armv7;i386")
add_library(foo STATIC foo.cpp)
install(TARGETS foo ARCHIVE DESTINATION lib)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment