From 5d2c2b2558d08db184a25db0d8208df352ecdb48 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 30 Sep 2022 12:07:55 -0400 Subject: Tests: Update RunCMake.XcodeProject iOS cases for Xcode 14.0 Issue: #24011 --- Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 45 ++++++++++++---------- .../XcodeIOSInstallCombined-install-check.cmake | 11 +++++- .../XcodeProject/XcodeIOSInstallCombined.cmake | 10 ++++- ...OSInstallCombinedSingleArch-install-check.cmake | 6 ++- .../XcodeIOSInstallCombinedSingleArch.cmake | 10 +++-- 5 files changed, 53 insertions(+), 29 deletions(-) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index d20f5a6..128a9dc 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -290,30 +290,33 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6) unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedPrune - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_IOS_INSTALL_COMBINED=YES" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + # FIXME(#24011): Xcode 14 removed support for older architectures the test needs. + if(XCODE_VERSION VERSION_LESS 14) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(XcodeIOSInstallCombinedPrune) - run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) - if(XCODE_VERSION VERSION_LESS 12) - run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + run_cmake(XcodeIOSInstallCombinedPrune) + run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) endif() - # --build defaults to Debug, --install defaults to Release, so we have to - # specify the configuration explicitly - run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall - ${CMAKE_COMMAND} --install . --config Debug - ) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedSingleArch set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake index 53b885d..60bc0d8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake @@ -9,11 +9,18 @@ function(verify_architectures file) return() endif() - string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures ${otool_out}) + string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures "${otool_out}") string(REPLACE "\narchitecture " "" actual "${architectures}") list(SORT actual) - set(expected arm64 armv7 i386 x86_64) + if(XCODE_VERSION VERSION_LESS 14) + set(maybe_armv7 armv7) + set(maybe_i386 i386) + else() + set(maybe_armv7 "") + set(maybe_i386 "") + endif() + set(expected arm64 ${maybe_armv7} ${maybe_i386} x86_64) if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index 19f8e2f..8426148 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -2,7 +2,13 @@ cmake_minimum_required(VERSION 3.3) project(IOSInstallCombined CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(maybe_armv7 armv7) +set(maybe_i386 i386) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(maybe_armv7 "") + set(maybe_i386 "") +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -16,7 +22,7 @@ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") -set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64") +set(CMAKE_OSX_ARCHITECTURES ${maybe_armv7} arm64 ${maybe_i386} x86_64) add_executable(foo_app MACOSX_BUNDLE main.cpp) install(TARGETS foo_app BUNDLE DESTINATION bin) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake index 3c11ae0..db8f869 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake @@ -12,7 +12,11 @@ function(verify_architecture file) string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}") string(REGEX REPLACE "is architecture: " "" actual "${architecture}") - set(expected armv7) + if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(expected arm64) + else() + set(expected armv7) + endif() if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 974ae47..5177ec2 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedSingleArch CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(iphoneos_arch armv7) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(iphoneos_arch arm64) +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -17,8 +21,8 @@ install(TARGETS foo DESTINATION lib) set_target_properties( foo PROPERTIES - XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 - XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] ${iphoneos_arch} + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] ${iphoneos_arch} XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "" XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "" ) -- cgit v0.12