diff --git a/README.md b/README.md index 1c6d749..c0a3d9f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -## ICU for iOS and Mac OS X (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64 +## ICU for iOS, visionOS, macOS (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64 Supported versions: 74.2 -This repo provides a universal script for building static ICU libraries for use in iOS and Mac OS X applications. The repo contains "icu" submodule that is taken from https://github.com/unicode-org/icu . The repo branches correspond to the suitable branches of ICU repo. E.g. "74" branch corresponds to "maint/maint-74" branch. +This repo provides a universal script for building static ICU libraries for use in iOS, visionOS, and macOS applications. The repo contains "icu" submodule that is taken from https://github.com/unicode-org/icu . The repo branches correspond to the suitable branches of ICU repo. E.g. "74" branch corresponds to "maint/maint-74" branch. ## Prerequisites 1) Xcode must be installed because xcodebuild is used to create xcframeworks @@ -26,7 +26,7 @@ This repo provides a universal script for building static ICU libraries for use use_frameworks! pod 'icu4c-iosx', '~> 74.2' # or optionally more precisely - # pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :tag => '74.2.7', :submodules => 'true' + # pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :tag => '74.2.8', :submodules => 'true' ``` install new dependency: ``` diff --git a/icu4c-iosx.podspec b/icu4c-iosx.podspec index e7783a8..be906fa 100644 --- a/icu4c-iosx.podspec +++ b/icu4c-iosx.podspec @@ -1,15 +1,17 @@ Pod::Spec.new do |s| s.name = "icu4c-iosx" - s.version = "74.2.7" - s.summary = "ICU XCFramework for macOS and iOS, including both arm64 and x86_64 builds for macOS, Mac Catalyst and Simulator." + s.version = "74.2.8" + s.summary = "ICU XCFramework for macOS, iOS, and visionOS, including both arm64 and x86_64 builds for macOS, Mac Catalyst, iOS Simulator, and visionOS Simulator." s.homepage = "https://github.com/apotocki/icu4c-iosx" s.license = "BSD" s.author = { "Alexander Pototskiy" => "alex.a.potocki@gmail.com" } s.social_media_url = "https://www.linkedin.com/in/alexander-pototskiy" s.ios.deployment_target = "13.4" s.osx.deployment_target = "11.0" + s.visionos.deployment_target = "1.0" s.osx.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' } s.ios.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' } + s.visionos.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' } s.static_framework = true s.prepare_command = "sh scripts/build.sh" s.source = { :git => "https://github.com/apotocki/icu4c-iosx.git", :tag => "#{s.version}", :submodules => "true" } diff --git a/scripts/build.sh b/scripts/build.sh index f6a5699..af63185 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -11,9 +11,11 @@ IOS_VERSION=13.4 IOS_SIM_VERSION=13.4 CATALYST_VERSION=13.4 ################## SETUP END -DEVSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer -SIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer +IOSSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer +IOSSIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer MACSYSROOT=$XCODE_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk +XROSSYSROOT=$XCODE_ROOT/Platforms/XROS.platform/Developer +XROSSIMSYSROOT=$XCODE_ROOT/Platforms/XRSimulator.platform/Developer ICU_VER_NAME=icu4c-${ICU_VER//\//-} BUILD_DIR="$( cd "$( dirname "./" )" >/dev/null 2>&1 && pwd )" @@ -100,12 +102,18 @@ build_catalyst_libs() # "--target=arm-apple-ios13.4-macabi" "--target=x86_64-apple-ios13.4-macabi" "-L$MACSYSROOT/System/iOSSupport/usr/lib/" } -build_sim_libs() +build_iossim_libs() { - CFLAGS="-isysroot $SIMSYSROOT/SDKs/iPhoneSimulator.sdk -mios-simulator-version-min=$IOS_SIM_VERSION " + CFLAGS="-isysroot $IOSSIMSYSROOT/SDKs/iPhoneSimulator.sdk -mios-simulator-version-min=$IOS_SIM_VERSION " generic_double_build ios.sim "$CFLAGS" } +build_xrossim_libs() +{ + CFLAGS="-isysroot $XROSSIMSYSROOT/SDKs/XRSimulator.sdk " + generic_double_build xros.sim "$CFLAGS" +} + ################### BUILD FOR MAC OSX ICU_BUILD_FOLDER=$ICU_VER_NAME-build if [ ! -f $ICU_BUILD_FOLDER.success ]; then @@ -145,19 +153,40 @@ lipo -create $INSTALL_DIR/lib/libicuio.a $ICU_VER_NAME-macos-$FOREIGN_ARC-build/ lipo -create $INSTALL_DIR/lib/libicuuc.a $ICU_VER_NAME-macos-$FOREIGN_ARC-build/source/lib/libicuuc.a -output $ICU_VER_NAME-macos-build/source/lib/libicuuc.a build_catalyst_libs -build_sim_libs +build_iossim_libs -generic_build ios arm64 arm "-fembed-bitcode -isysroot $DEVSYSROOT/SDKs/iPhoneOS.sdk -mios-version-min=$IOS_VERSION" +if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then +build_xrossim_libs +fi + +generic_build ios arm64 arm "-fembed-bitcode -isysroot $IOSSYSROOT/SDKs/iPhoneOS.sdk -mios-version-min=$IOS_VERSION" + +if [ -d $XROSSYSROOT ]; then +generic_build xros arm64 arm "-fembed-bitcode -isysroot $XROSSYSROOT/SDKs/XROS.sdk" +fi if [ -d $INSTALL_DIR/frameworks ]; then rm -rf $INSTALL_DIR/frameworks fi mkdir $INSTALL_DIR/frameworks -xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicudata.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicudata.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicudata.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicudata.a -output $INSTALL_DIR/frameworks/icudata.xcframework - -xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicui18n.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicui18n.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicui18n.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicui18n.a -output $INSTALL_DIR/frameworks/icui18n.xcframework - -xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicuio.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicuio.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicuio.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicuio.a -output $INSTALL_DIR/frameworks/icuio.xcframework +create_xcframework() +{ + PARAMS="-library $ICU_VER_NAME-macos-build/source/lib/lib$1.a \ + -library $ICU_VER_NAME-catalyst-build/source/lib/lib$1.a \ + -library $ICU_VER_NAME-ios.sim-build/source/lib/lib$1.a \ + -library $ICU_VER_NAME-ios-arm64-build/source/lib/lib$1.a" + + if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then + PARAMS="$PARAMS -library $ICU_VER_NAME-xros.sim-build/source/lib/lib$1.a" + fi + if [ -d $XROSSYSROOT ]; then + PARAMS="$PARAMS -library $ICU_VER_NAME-xros-arm64-build/source/lib/lib$1.a" + fi + xcodebuild -create-xcframework $PARAMS -output $INSTALL_DIR/frameworks/$1.xcframework +} -xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicuuc.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicuuc.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicuuc.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicuuc.a -output $INSTALL_DIR/frameworks/icuuc.xcframework +create_xcframework icudata +create_xcframework icui18n +create_xcframework icuio +create_xcframework icuuc