Skip to content

Commit

Permalink
Fix iOS CI: enable code signing override during cmake config; improve…
Browse files Browse the repository at this point in the history
… error messages
  • Loading branch information
SRSaunders committed Sep 25, 2024
1 parent 4b01435 commit fa92f8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,6 @@ jobs:
- name: build_ios
run: |
source ~/VulkanSDK/setup-env.sh
cmake -H"." -B"build/ios" -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0
source ~/VulkanSDK/iOS/setup-env.sh
cmake -H"." -B"build/ios" -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
cmake --build "build/ios" --target vulkan_samples --config ${{ matrix.build_type }} -- -sdk iphoneos -allowProvisioningUpdates
20 changes: 13 additions & 7 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,31 @@ endif()
if(IOS)
set(CMAKE_MACOSX_BUNDLE YES)
if(NOT DEFINED MACOSX_BUNDLE_GUI_IDENTIFIER)
if(NOT ${CMAKE_OSX_SYSROOT} STREQUAL "iphonesimulator" AND DEFINED CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
message(FATAL_ERROR "BUILDING for iOS device with a specified development team requires setting the MACOSX_BUNDLE_GUI_IDENTIFIER")
if(${CMAKE_OSX_SYSROOT} STREQUAL "iphoneos" AND DEFINED CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
message(FATAL_ERROR "Building for iOS device with a specified development team requires setting MACOSX_BUNDLE_GUI_IDENTIFIER")
else()
set(MACOSX_BUNDLE_GUI_IDENTIFIER com.khronos.vulkansamples)
endif()
endif()
if(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
if(NOT ${CMAKE_OSX_SYSROOT} STREQUAL "iphonesimulator")
message(FATAL_ERROR "BUILDING for iOS device requires setting the CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM;
note that it is safe to build for iOS Simulator without code signing")
if(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED)
if(${CMAKE_OSX_SYSROOT} STREQUAL "iphoneos")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "YES")
else()
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
endif()
endif()
if(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED)
message(FATAL_ERROR "Building for iOS with code signing requires setting CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM; note it is safe to build for iOS Simulator without code signing")
else()
message(STATUS "Building for iOS Simulator without a code signing identity; this is allowed, turning off code signing")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
message(STATUS "Building for iOS device or iOS Simulator without a code signing identity; turning off code signing")
set_target_properties(${PROJECT_NAME} PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY "NO"
)
endif ()
else()
message(STATUS "Building for iOS device or iOS Simulator with a code signing identity; turning on code signing")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "YES")
set_target_properties(${PROJECT_NAME} PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "YES"
Expand Down

0 comments on commit fa92f8e

Please sign in to comment.