From c12203eab5d5e1ed5fbd783ac687f4fae9564c7b Mon Sep 17 00:00:00 2001 From: Oliver Epper Date: Tue, 16 Jul 2024 09:54:25 +0200 Subject: [PATCH 1/3] Added platform option MAC_CATALYST_UNIVERSAL --- README.md | 1 + ios.toolchain.cmake | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1e3e18d..affeffa 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ A CMake toolchain file for iOS (+ Catalyst), watchOS, tvOS and macOS development * _MAC_UNIVERSAL_ - to build for macOS on x86_64 and Apple Silicon (arm64) combined * _MAC_CATALYST_ - to build iOS for Mac (Catalyst, x86_64) * _MAC_CATALYST_ARM64_ - to build iOS for Mac on Apple Silicon (Catalyst, arm64) +* _MAC_CATALYST_UNIVERSAL - to build iOS for Mac on x86_64 and Mac on arm64 combined # Example usage diff --git a/ios.toolchain.cmake b/ios.toolchain.cmake index db2a327..bcda290 100644 --- a/ios.toolchain.cmake +++ b/ios.toolchain.cmake @@ -81,6 +81,7 @@ # Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS # MAC_CATALYST_ARM64 = Build for Apple Silicon macOS with Catalyst support (iOS toolchain on macOS). # Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS +# MAC_CATALYST_UNIVERSAL = OE_FIXME # # CMAKE_OSX_SYSROOT: Path to the SDK to use. By default this is # automatically determined from PLATFORM and xcodebuild, but @@ -123,6 +124,7 @@ # MAC_UNIVERSAL = x86_64 arm64 # MAC_CATALYST = x86_64 # MAC_CATALYST_ARM64 = arm64 +# MAC_CATALYST_UNIVERSAL = x86_64 arm64 # # NOTE: When manually specifying ARCHS, put a semi-colon between the entries. E.g., -DARCHS="armv7;arm64" # @@ -166,7 +168,7 @@ list(APPEND _supported_platforms "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" "SIMULATORARM64_WATCHOS" "MAC" "MAC_ARM64" "MAC_UNIVERSAL" "VISIONOS" "SIMULATOR_VISIONOS" "VISIONOSCOMBINED" - "MAC_CATALYST" "MAC_CATALYST_ARM64") + "MAC_CATALYST" "MAC_CATALYST_ARM64" "MAC_CATALYST_UNIVERSAL") # Cache what generator is used set(USED_CMAKE_GENERATOR "${CMAKE_GENERATOR}") @@ -230,7 +232,7 @@ if("${contains_PLATFORM}" EQUAL "-1") endif() # Check if Apple Silicon is supported -if(PLATFORM MATCHES "^(MAC_ARM64)$|^(MAC_CATALYST_ARM64)$|^(MAC_UNIVERSAL)$" AND ${CMAKE_VERSION} VERSION_LESS "3.19.5") +if(PLATFORM MATCHES "^(MAC_ARM64)$|^(MAC_CATALYST_ARM64)$|^(MAC_UNIVERSAL)$|^(MAC_CATALYST_UNIVERSAL)$" AND ${CMAKE_VERSION} VERSION_LESS "3.19.5") message(FATAL_ERROR "Apple Silicon builds requires a minimum of CMake 3.19.5") endif() @@ -275,7 +277,7 @@ if(NOT DEFINED DEPLOYMENT_TARGET) elseif(PLATFORM STREQUAL "MAC_UNIVERSAL") # Unless specified, SDK version 11.0 (Big Sur) is used by default as minimum target version for universal builds. set(DEPLOYMENT_TARGET "11.0") - elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64") + elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64" OR PLATFORM STREQUAL "MAC_CATALYST_UNIVERSAL") # Unless specified, SDK version 13.0 is used by default as the minimum target version (mac catalyst minimum requirement). set(DEPLOYMENT_TARGET "13.1") else() @@ -553,6 +555,13 @@ elseif(PLATFORM_INT STREQUAL "MAC_UNIVERSAL") endif() string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}) +elseif(PLATFORM_INT STREQUAL "MAC_CATALYST_UNIVERSAL") + set(SDK_NAME macosx) + if(NOT ARCHS) + set(ARCHS "x86_64;arm64") + endif() + string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-macabi) else() message(FATAL_ERROR "Invalid PLATFORM: ${PLATFORM_INT}") endif() @@ -761,7 +770,7 @@ set(APPLE ON CACHE BOOL "") if(PLATFORM STREQUAL "MAC" OR PLATFORM STREQUAL "MAC_ARM64" OR PLATFORM STREQUAL "MAC_UNIVERSAL") set(IOS OFF CACHE BOOL "") set(MACOS ON CACHE BOOL "") -elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64") +elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64" OR PLATFORM STREQUAL "MAC_CATALYST_UNIVERSAL") set(IOS ON CACHE BOOL "") set(MACOS ON CACHE BOOL "") elseif(PLATFORM STREQUAL "VISIONOS" OR PLATFORM STREQUAL "SIMULATOR_VISIONOS" OR PLATFORM STREQUAL "VISIONOSCOMBINED") From 0a11b3fda36397976dd31741fa5f9b4ba2466061 Mon Sep 17 00:00:00 2001 From: Oliver Epper <45991777+oliverepper@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:49:58 +0200 Subject: [PATCH 2/3] Update README.md fixed a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index affeffa..0aee61e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ A CMake toolchain file for iOS (+ Catalyst), watchOS, tvOS and macOS development * _MAC_UNIVERSAL_ - to build for macOS on x86_64 and Apple Silicon (arm64) combined * _MAC_CATALYST_ - to build iOS for Mac (Catalyst, x86_64) * _MAC_CATALYST_ARM64_ - to build iOS for Mac on Apple Silicon (Catalyst, arm64) -* _MAC_CATALYST_UNIVERSAL - to build iOS for Mac on x86_64 and Mac on arm64 combined +* _MAC_CATALYST_UNIVERSAL_ - to build iOS for Mac on x86_64 and Mac on arm64 combined # Example usage From 3b10f913a693dce295d65072497b90bedc9c6b27 Mon Sep 17 00:00:00 2001 From: Oliver Epper Date: Tue, 16 Jul 2024 14:10:51 +0200 Subject: [PATCH 3/3] fixed help text --- ios.toolchain.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios.toolchain.cmake b/ios.toolchain.cmake index bcda290..cdf7380 100644 --- a/ios.toolchain.cmake +++ b/ios.toolchain.cmake @@ -81,7 +81,7 @@ # Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS # MAC_CATALYST_ARM64 = Build for Apple Silicon macOS with Catalyst support (iOS toolchain on macOS). # Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS -# MAC_CATALYST_UNIVERSAL = OE_FIXME +# MAC_CATALYST_UNIVERSAL = Combined build for x86_64 and Apple Silicon on Catalyst. # # CMAKE_OSX_SYSROOT: Path to the SDK to use. By default this is # automatically determined from PLATFORM and xcodebuild, but