diff --git a/build_all_vision.sh b/build_all_vision.sh index 92d57597..28a346a6 100755 --- a/build_all_vision.sh +++ b/build_all_vision.sh @@ -4,7 +4,7 @@ set -e rm -rf ./dist ./update_version.sh ./build_metadata_generator.sh -./build_nativescript.sh -./build_tklivesync.sh +BUILD_CATALYST=false BUILD_IPHONE=false BUILD_SIMULATOR=false ./build_nativescript.sh +BUILD_CATALYST=false BUILD_IPHONE=false BUILD_SIMULATOR=false ./build_tklivesync.sh ./prepare_dSYMs.sh ./build_npm_vision.sh \ No newline at end of file diff --git a/build_nativescript.sh b/build_nativescript.sh index 40942340..f488290e 100755 --- a/build_nativescript.sh +++ b/build_nativescript.sh @@ -111,17 +111,32 @@ xcodebuild archive -project v8ios.xcodeproj \ fi if $BUILD_VISION; then -checkpoint "Building NativeScript for visionOS" +checkpoint "Building NativeScript for visionOS Device" xcodebuild archive -project v8ios.xcodeproj \ -scheme "NativeScript" \ -configuration Release \ - -destination "generic/platform=xrsimulator" \ + -destination "generic/platform=visionOS" \ + -sdk xros \ + $QUIET \ + EXCLUDED_ARCHS="i386 x86_64" \ + DEVELOPMENT_TEAM=$DEV_TEAM \ + SKIP_INSTALL=NO \ + IPHONEOS_DEPLOYMENT_TARGET=13.0 \ + -archivePath $DIST/intermediates/NativeScript.xros.xcarchive + +checkpoint "Building NativeScript for visionOS Simulators" +xcodebuild archive -project v8ios.xcodeproj \ + -scheme "NativeScript" \ + -configuration Release \ + -destination "generic/platform=visionOS Simulator" \ -sdk xrsimulator \ $QUIET \ EXCLUDED_ARCHS="i386 x86_64" \ DEVELOPMENT_TEAM=$DEV_TEAM \ SKIP_INSTALL=NO \ + IPHONEOS_DEPLOYMENT_TARGET=13.0 \ -archivePath $DIST/intermediates/NativeScript.xrsimulator.xcarchive + fi if $BUILD_IPHONE; then @@ -170,6 +185,8 @@ if $BUILD_IPHONE; then fi if $BUILD_VISION; then + XCFRAMEWORKS+=( -framework "$DIST/intermediates/NativeScript.xros.xcarchive/Products/Library/Frameworks/NativeScript.framework" \ + -debug-symbols "$DIST/intermediates/NativeScript.xros.xcarchive/dSYMs/NativeScript.framework.dSYM" ) XCFRAMEWORKS+=( -framework "$DIST/intermediates/NativeScript.xrsimulator.xcarchive/Products/Library/Frameworks/NativeScript.framework" \ -debug-symbols "$DIST/intermediates/NativeScript.xrsimulator.xcarchive/dSYMs/NativeScript.framework.dSYM" ) fi diff --git a/build_tklivesync.sh b/build_tklivesync.sh index c81f3e4d..e1cb6e18 100755 --- a/build_tklivesync.sh +++ b/build_tklivesync.sh @@ -2,6 +2,48 @@ set -e source "$(dirname "$0")/build_utils.sh" +function to_bool() { + local arg="$1" + case "$(echo "$arg" | tr '[:upper:]' '[:lower:]')" in + [0-9]+) + if [ $arg -eq 0 ]; then + echo false + else + echo true + fi + ;; + n|no|f|false) echo false ;; + y|yes|t|true) echo true ;; + * ) + if [ -n "$arg" ]; then + echo "warning: invalid boolean argument ('$arg'). Expected true or false" >&2 + fi + echo false + ;; + esac; +} + +BUILD_CATALYST=$(to_bool ${BUILD_CATALYST:=true}) +BUILD_IPHONE=$(to_bool ${BUILD_IPHONE:=true}) +BUILD_SIMULATOR=$(to_bool ${BUILD_SIMULATOR:=true}) +BUILD_VISION=$(to_bool ${BUILD_VISION:=true}) +VERBOSE=$(to_bool ${VERBOSE:=false}) + +for arg in $@; do + case $arg in + --catalyst|--maccatalyst) BUILD_CATALYST=true ;; + --no-catalyst|--no-maccatalyst) BUILD_CATALYST=false ;; + --sim|--simulator) BUILD_SIMULATOR=true ;; + --no-sim|--no-simulator) BUILD_SIMULATOR=false ;; + --iphone|--device) BUILD_IPHONE=true ;; + --no-iphone|--no-device) BUILD_IPHONE=false ;; + --xr|--vision) BUILD_VISION=true ;; + --no-xr|--no-vision) BUILD_VISION=false ;; + --verbose|-v) VERBOSE=true ;; + *) ;; + esac +done + DIST=$(PWD)/dist mkdir -p $DIST @@ -14,6 +56,7 @@ xcodebuild -project v8ios.xcodeproj \ -configuration Release clean \ -quiet +if $BUILD_CATALYST; then #generates library for Mac Catalyst target checkpoint "Building TKLiveSync for Mac Catalyst" xcodebuild archive -project v8ios.xcodeproj \ @@ -23,6 +66,7 @@ xcodebuild archive -project v8ios.xcodeproj \ -quiet \ SKIP_INSTALL=NO \ -archivePath $DIST/intermediates/TKLiveSync.maccatalyst.xcarchive +fi # #generates library for x86_64 simulator target # xcodebuild archive -project v8ios.xcodeproj \ @@ -43,6 +87,7 @@ xcodebuild archive -project v8ios.xcodeproj \ # SKIP_INSTALL=NO \ # -archivePath $DIST/TKLiveSync.arm64-iphonesimulator.xcarchive +if $BUILD_SIMULATOR; then # generates library for simulator targets (usually includes arm64, x86_64) checkpoint "Building TKLiveSync for iphone simulators (multi-arch)" xcodebuild archive -project v8ios.xcodeproj \ @@ -53,17 +98,31 @@ xcodebuild archive -project v8ios.xcodeproj \ -quiet \ SKIP_INSTALL=NO \ -archivePath $DIST/intermediates/TKLiveSync.iphonesimulator.xcarchive +fi -checkpoint "Building TKLiveSync for visionOS" +if $BUILD_VISION; then +checkpoint "Building TKLiveSync for visionOS Device" xcodebuild archive -project v8ios.xcodeproj \ - -scheme TKLiveSync \ + -scheme "TKLiveSync" \ + -configuration Release \ + -destination "generic/platform=visionOS" \ + -sdk xros \ + -quiet \ + SKIP_INSTALL=NO \ + -archivePath $DIST/intermediates/TKLiveSync.xros.xcarchive + +checkpoint "Building TKLiveSync for visionOS Simulators" +xcodebuild archive -project v8ios.xcodeproj \ + -scheme "TKLiveSync" \ -configuration Release \ - -destination "generic/platform=xrsimulator" \ + -destination "generic/platform=visionOS Simulator" \ -sdk xrsimulator \ -quiet \ SKIP_INSTALL=NO \ -archivePath $DIST/intermediates/TKLiveSync.xrsimulator.xcarchive +fi +if $BUILD_IPHONE; then #generates library for device target checkpoint "Building TKLiveSync for ARM64 device" xcodebuild archive -project v8ios.xcodeproj \ @@ -74,6 +133,7 @@ xcodebuild archive -project v8ios.xcodeproj \ -quiet \ SKIP_INSTALL=NO \ -archivePath $DIST/intermediates/TKLiveSync.iphoneos.xcarchive +fi #Creates directory for fat-library OUTPUT_DIR="$DIST/TKLiveSync.xcframework" @@ -95,17 +155,33 @@ rm -rf "${OUTPUT_PATH}" # "$DIST/TKLiveSync.iphonesimulator.xcarchive/Products/Library/Frameworks/TKLiveSync.framework/TKLiveSync" #Creates xcframework +XCFRAMEWORKS=() +if $BUILD_CATALYST; then + XCFRAMEWORKS+=( -framework "$DIST/intermediates/TKLiveSync.maccatalyst.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ + -debug-symbols "$DIST/intermediates/TKLiveSync.maccatalyst.xcarchive/dSYMs/TKLiveSync.framework.dSYM" ) +fi + +if $BUILD_SIMULATOR; then + XCFRAMEWORKS+=( -framework "$DIST/intermediates/TKLiveSync.iphonesimulator.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ + -debug-symbols "$DIST/intermediates/TKLiveSync.iphonesimulator.xcarchive/dSYMs/TKLiveSync.framework.dSYM" ) +fi + +if $BUILD_IPHONE; then + XCFRAMEWORKS+=( -framework "$DIST/intermediates/TKLiveSync.iphoneos.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ + -debug-symbols "$DIST/intermediates/TKLiveSync.iphoneos.xcarchive/dSYMs/TKLiveSync.framework.dSYM" ) +fi + +if $BUILD_VISION; then + XCFRAMEWORKS+=( -framework "$DIST/intermediates/TKLiveSync.xros.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ + -debug-symbols "$DIST/intermediates/TKLiveSync.xros.xcarchive/dSYMs/TKLiveSync.framework.dSYM" ) + XCFRAMEWORKS+=( -framework "$DIST/intermediates/TKLiveSync.xrsimulator.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ + -debug-symbols "$DIST/intermediates/TKLiveSync.xrsimulator.xcarchive/dSYMs/TKLiveSync.framework.dSYM" ) +fi + checkpoint "Creating TKLiveSync.xcframework" -xcodebuild -create-xcframework \ - -framework "$DIST/intermediates/TKLiveSync.maccatalyst.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ - -debug-symbols "$DIST/intermediates/TKLiveSync.maccatalyst.xcarchive/dSYMs/TKLiveSync.framework.dSYM" \ - -framework "$DIST/intermediates/TKLiveSync.iphonesimulator.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ - -debug-symbols "$DIST/intermediates/TKLiveSync.iphonesimulator.xcarchive/dSYMs/TKLiveSync.framework.dSYM" \ - -framework "$DIST/intermediates/TKLiveSync.iphoneos.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ - -debug-symbols "$DIST/intermediates/TKLiveSync.iphoneos.xcarchive/dSYMs/TKLiveSync.framework.dSYM" \ - -framework "$DIST/intermediates/TKLiveSync.xrsimulator.xcarchive/Products/Library/Frameworks/TKLiveSync.framework" \ - -debug-symbols "$DIST/intermediates/TKLiveSync.xrsimulator.xcarchive/dSYMs/TKLiveSync.framework.dSYM" \ - -output "$OUTPUT_DIR" +OUTPUT_DIR="$DIST/TKLiveSync.xcframework" +rm -rf $OUTPUT_DIR +xcodebuild -create-xcframework ${XCFRAMEWORKS[@]} -output "$OUTPUT_DIR" rm -rf "$DIST/intermediates" diff --git a/metadata-generator/CMakeLists.txt b/metadata-generator/CMakeLists.txt index 757a0d45..85a21ab4 100644 --- a/metadata-generator/CMakeLists.txt +++ b/metadata-generator/CMakeLists.txt @@ -14,7 +14,7 @@ if (NOT LIBXML2_FOUND) endif () get_filename_component(LLVM_ROOT "../../llvm/13.0.1" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") -set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0) +set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0) set(LLVM_SYSTEM_LIBS "-lz -lcurses -lm -lxml2") set(LLVM_PREPROCESSOR_FLAGS "-I${LLVM_ROOT}/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS") diff --git a/project-template-vision/internal/nsld.sh b/project-template-vision/internal/nsld.sh index 5a6179c5..9b5dda3a 100755 --- a/project-template-vision/internal/nsld.sh +++ b/project-template-vision/internal/nsld.sh @@ -44,17 +44,19 @@ function GEN_MODULEMAP() { } function GEN_METADATA() { + TARGET_ARCH=$1 set -e cpu_arch=$(uname -m) pushd "$SRCROOT/internal/metadata-generator-${cpu_arch}/bin" - ./build-step-metadata-generator.py + ./build-step-metadata-generator.py $TARGET_ARCH popd } # Workaround for ARCH being set to `undefined_arch` here. Extract it from command line arguments. -GEN_MODULEMAP $(getArch "$@") +TARGET_ARCH=$(getArch "$@") +GEN_MODULEMAP $TARGET_ARCH printf "Generating metadata..." -GEN_METADATA +GEN_METADATA $TARGET_ARCH DELETE_SWIFT_MODULES_DIR NS_LD="${NS_LD:-"$TOOLCHAIN_DIR/usr/bin/clang"}" $NS_LD "$@"