Add support for XROS (aka visionOS) (#53)

Co-authored-by: Davide De Rosa <keeshux@gmail.com>
This commit is contained in:
Nicola Ferruzzi 2024-01-11 08:33:46 +01:00 committed by GitHub
parent 026702febc
commit ab3f2bc5e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 1 deletions

24
assets/XROS/Info.plist Executable file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>openssl</string>
<key>CFBundleIdentifier</key>
<string>org.openssl.OpenSSL</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>openssl</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>$(OPENSSL_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>
<string>$(MIN_SDK_VERSION)</string>
</dict>
</plist>

1
assets/XRSimulator Symbolic link
View File

@ -0,0 +1 @@
XROS

View File

@ -34,6 +34,7 @@ macos64-x86_64 macos64-arm64
mac-catalyst-x86_64 mac-catalyst-arm64 mac-catalyst-x86_64 mac-catalyst-arm64
watchos-cross-armv7k watchos-cross-arm64_32 watchos-sim-cross-x86_64 watchos-sim-cross-i386 watchos-sim-cross-arm64 watchos-cross-armv7k watchos-cross-arm64_32 watchos-sim-cross-x86_64 watchos-sim-cross-i386 watchos-sim-cross-arm64
tvos-sim-cross-x86_64 tvos-sim-cross-arm64 tvos-cross-arm64 tvos-sim-cross-x86_64 tvos-sim-cross-arm64 tvos-cross-arm64
xros-sim-cross-arm64 xros-cross-arm64
TARGETS` TARGETS`
# Minimum iOS/tvOS SDK version to build for # Minimum iOS/tvOS SDK version to build for
@ -42,6 +43,7 @@ MACOS_MIN_SDK_VERSION="10.14"
CATALYST_MIN_SDK_VERSION="10.14" CATALYST_MIN_SDK_VERSION="10.14"
WATCHOS_MIN_SDK_VERSION="4.0" WATCHOS_MIN_SDK_VERSION="4.0"
TVOS_MIN_SDK_VERSION="12.0" TVOS_MIN_SDK_VERSION="12.0"
XROS_MIN_SDK_VERSION="1.0"
# Init optional env variables (use available variable or default to empty string) # Init optional env variables (use available variable or default to empty string)
CURL_OPTIONS="${CURL_OPTIONS:-}" CURL_OPTIONS="${CURL_OPTIONS:-}"
@ -60,6 +62,7 @@ echo_help()
echo " --catalyst-sdk=SDKVERSION Override macOS SDK version for Catalyst" echo " --catalyst-sdk=SDKVERSION Override macOS SDK version for Catalyst"
echo " --watchos-sdk=SDKVERSION Override watchOS SDK version" echo " --watchos-sdk=SDKVERSION Override watchOS SDK version"
echo " --tvos-sdk=SDKVERSION Override tvOS SDK version" echo " --tvos-sdk=SDKVERSION Override tvOS SDK version"
echo " --xros-sdk=SDKVERSION Override xrOS SDK version"
echo " --min-ios-sdk=SDKVERSION Set minimum iOS SDK version (default: $IOS_MIN_SDK_VERSION)" echo " --min-ios-sdk=SDKVERSION Set minimum iOS SDK version (default: $IOS_MIN_SDK_VERSION)"
echo " --min-macos-sdk=SDKVERSION Set minimum macOS SDK version (default: $MACOS_MIN_SDK_VERSION)" echo " --min-macos-sdk=SDKVERSION Set minimum macOS SDK version (default: $MACOS_MIN_SDK_VERSION)"
echo " --min-watchos-sdk=SDKVERSION Set minimum watchOS SDK version (default: $WATCHOS_MIN_SDK_VERSION)" echo " --min-watchos-sdk=SDKVERSION Set minimum watchOS SDK version (default: $WATCHOS_MIN_SDK_VERSION)"
@ -180,6 +183,14 @@ finish_build_loop()
else else
OPENSSLCONF_SUFFIX="ios_${ARCH}" OPENSSLCONF_SUFFIX="ios_${ARCH}"
fi fi
elif [[ "${PLATFORM}" == XR* ]]; then
LIBSSL_XROS+=("${TARGETDIR}/lib/libssl.a")
LIBCRYPTO_XROS+=("${TARGETDIR}/lib/libcrypto.a")
if [[ "${PLATFORM}" == XRSimulator* ]]; then
OPENSSLCONF_SUFFIX="xros_sim_${ARCH}"
else
OPENSSLCONF_SUFFIX="xros_${ARCH}"
fi
elif [[ "${PLATFORM}" == Watch* ]]; then elif [[ "${PLATFORM}" == Watch* ]]; then
LIBSSL_WATCHOS+=("${TARGETDIR}/lib/libssl.a") LIBSSL_WATCHOS+=("${TARGETDIR}/lib/libssl.a")
LIBCRYPTO_WATCHOS+=("${TARGETDIR}/lib/libcrypto.a") LIBCRYPTO_WATCHOS+=("${TARGETDIR}/lib/libcrypto.a")
@ -243,6 +254,7 @@ MACOS_SDKVERSION=""
CATALYST_SDKVERSION="" CATALYST_SDKVERSION=""
WATCHOS_SDKVERSION="" WATCHOS_SDKVERSION=""
TVOS_SDKVERSION="" TVOS_SDKVERSION=""
XROS_SDKVERSION=""
LOG_VERBOSE="" LOG_VERBOSE=""
PARALLEL="" PARALLEL=""
TARGETS="" TARGETS=""
@ -305,6 +317,10 @@ case $i in
TVOS_MIN_SDK_VERSION="${i#*=}" TVOS_MIN_SDK_VERSION="${i#*=}"
shift shift
;; ;;
--min-xros-sdk=*)
XROS_MIN_SDK_VERSION="${i#*=}"
shift
;;
--noparallel) --noparallel)
PARALLEL="false" PARALLEL="false"
;; ;;
@ -392,6 +408,9 @@ fi
if [ ! -n "${TVOS_SDKVERSION}" ]; then if [ ! -n "${TVOS_SDKVERSION}" ]; then
TVOS_SDKVERSION=$(xcrun -sdk appletvos --show-sdk-version) TVOS_SDKVERSION=$(xcrun -sdk appletvos --show-sdk-version)
fi fi
if [ ! -n "${XROS_SDKVERSION}" ]; then
XROS_SDKVERSION=$(xcrun -sdk xros --show-sdk-version)
fi
# Truncate to minor version # Truncate to minor version
MINOR_VERSION=(${MACOS_SDKVERSION//./ }) MINOR_VERSION=(${MACOS_SDKVERSION//./ })
@ -446,6 +465,7 @@ echo " macOS SDK: ${MACOS_SDKVERSION} (min ${MACOS_MIN_SDK_VERSION})"
echo " macOS SDK (Catalyst): ${CATALYST_SDKVERSION} (min ${CATALYST_MIN_SDK_VERSION})" echo " macOS SDK (Catalyst): ${CATALYST_SDKVERSION} (min ${CATALYST_MIN_SDK_VERSION})"
echo " watchOS SDK: ${WATCHOS_SDKVERSION} (min ${WATCHOS_MIN_SDK_VERSION})" echo " watchOS SDK: ${WATCHOS_SDKVERSION} (min ${WATCHOS_MIN_SDK_VERSION})"
echo " tvOS SDK: ${TVOS_SDKVERSION} (min ${TVOS_MIN_SDK_VERSION})" echo " tvOS SDK: ${TVOS_SDKVERSION} (min ${TVOS_MIN_SDK_VERSION})"
echo " xrOS SDK: ${XROS_SDKVERSION} (min ${XROS_MIN_SDK_VERSION})"
if [ "${CONFIG_DISABLE_BITCODE}" == "true" ]; then if [ "${CONFIG_DISABLE_BITCODE}" == "true" ]; then
echo " Bitcode embedding disabled" echo " Bitcode embedding disabled"
fi fi
@ -547,6 +567,8 @@ LIBSSL_WATCHOS=()
LIBCRYPTO_WATCHOS=() LIBCRYPTO_WATCHOS=()
LIBSSL_TVOS=() LIBSSL_TVOS=()
LIBCRYPTO_TVOS=() LIBCRYPTO_TVOS=()
LIBSSL_XROS=()
LIBCRYPTO_XROS=()
source "${SCRIPTDIR}/scripts/build-loop-targets.sh" source "${SCRIPTDIR}/scripts/build-loop-targets.sh"
@ -619,6 +641,12 @@ if [ ${#OPENSSLCONF_ALL[@]} -gt 1 ]; then
*_tvos_sim_x86_64.h) *_tvos_sim_x86_64.h)
DEFINE_CONDITION="TARGET_OS_TV && TARGET_OS_SIMULATOR && TARGET_CPU_X86_64" DEFINE_CONDITION="TARGET_OS_TV && TARGET_OS_SIMULATOR && TARGET_CPU_X86_64"
;; ;;
*_xros_sim_arm64.h)
DEFINE_CONDITION="TARGET_OS_VISION && TARGET_OS_SIMULATOR && TARGET_CPU_ARM64"
;;
*_xros_arm64.h)
DEFINE_CONDITION="TARGET_OS_VISION && TARGET_CPU_ARM64"
;;
*) *)
# Don't run into unexpected cases by setting the default condition to false # Don't run into unexpected cases by setting the default condition to false
DEFINE_CONDITION="0" DEFINE_CONDITION="0"

View File

@ -38,6 +38,11 @@ my %targets = ();
cflags => add(sub { defined($ENV{'TVOS_MIN_SDK_VERSION'}) ? '-mtvos-version-min=$(TVOS_MIN_SDK_VERSION)' : '-mtvos-version-min=12.0'; }), cflags => add(sub { defined($ENV{'TVOS_MIN_SDK_VERSION'}) ? '-mtvos-version-min=$(TVOS_MIN_SDK_VERSION)' : '-mtvos-version-min=12.0'; }),
defines => [ "HAVE_FORK=0" ], defines => [ "HAVE_FORK=0" ],
}, },
"xros-cross-base" => {
inherit_from => [ "all-base" ],
template => 1,
# cflags => add(sub { defined($ENV{'XROS_MIN_SDK_VERSION'}) ? '-mxros-version-min=$(XROS_MIN_SDK_VERSION)' : '-mxros-version-min=1.0'; }),
},
## Apple iOS ## Apple iOS
@ -151,4 +156,26 @@ my %targets = ();
inherit_from => [ "darwin64-x86_64-cc", "tvos-cross-base" ], inherit_from => [ "darwin64-x86_64-cc", "tvos-cross-base" ],
sys_id => "tvOS", sys_id => "tvOS",
}, },
## Vision OS
# Device
"xros-cross-arm64" => {
inherit_from => [ "darwin64-arm64-cc", "xros-cross-base" ],
cflags => add("-arch arm64"),
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
sys_id => "xros",
},
# Simulator
"xros-sim-cross-arm64" => {
inherit_from => [ "darwin64-arm64-cc", "xros-cross-base" ],
cflags => add("-arch arm64"),
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
sys_id => "xros",
},
"xros-sim-cross-x86_64" => {
inherit_from => [ "darwin64-x86_64-cc", "xros-cross-base" ],
sys_id => "xros",
},
); );

View File

@ -17,7 +17,7 @@ if [ -d $FWROOT ]; then
fi fi
#ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX" "Catalyst" "Watch") #ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX" "Catalyst" "Watch")
ALL_SYSTEMS=("iPhoneOS" "iPhoneSimulator" "AppleTVOS" "AppleTVSimulator" "MacOSX" "Catalyst" "WatchOS" "WatchSimulator") ALL_SYSTEMS=("iPhoneOS" "iPhoneSimulator" "AppleTVOS" "AppleTVSimulator" "MacOSX" "Catalyst" "WatchOS" "WatchSimulator" "XROS" "XRSimulator")
# Inspect Mach-O load commands to get minimum SDK version. # Inspect Mach-O load commands to get minimum SDK version.
# #
@ -123,6 +123,10 @@ for TARGETDIR in `ls -d *.sdk`; do
MIN_SDK="-platform_version watchos $MIN_SDK_VERSION $SDKVERSION" MIN_SDK="-platform_version watchos $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == WatchSimulator* ]]; then elif [[ $PLATFORM == WatchSimulator* ]]; then
MIN_SDK="-platform_version watchos-simulator $MIN_SDK_VERSION $SDKVERSION" MIN_SDK="-platform_version watchos-simulator $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == XRSimulator* ]]; then
MIN_SDK="-platform_version xros-simulator $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == XR* ]]; then
MIN_SDK="-platform_version xros $MIN_SDK_VERSION $SDKVERSION"
else else
MIN_SDK="-platform_version ios $MIN_SDK_VERSION $SDKVERSION" MIN_SDK="-platform_version ios $MIN_SDK_VERSION $SDKVERSION"
fi fi

View File

@ -30,6 +30,8 @@ do
SDKVERSION="${WATCHOS_SDKVERSION}" SDKVERSION="${WATCHOS_SDKVERSION}"
elif [[ "${TARGET}" == tvos* ]]; then elif [[ "${TARGET}" == tvos* ]]; then
SDKVERSION="${TVOS_SDKVERSION}" SDKVERSION="${TVOS_SDKVERSION}"
elif [[ "${TARGET}" == xr* ]]; then
SDKVERSION="${XROS_SDKVERSION}"
else else
SDKVERSION="${IOS_SDKVERSION}" SDKVERSION="${IOS_SDKVERSION}"
fi fi
@ -41,6 +43,7 @@ do
export CATALYST_MIN_SDK_VERSION export CATALYST_MIN_SDK_VERSION
export WATCHOS_MIN_SDK_VERSION export WATCHOS_MIN_SDK_VERSION
export TVOS_MIN_SDK_VERSION export TVOS_MIN_SDK_VERSION
export XROS_MIN_SDK_VERSION
export CONFIG_DISABLE_BITCODE export CONFIG_DISABLE_BITCODE
# Determine platform # Determine platform
@ -61,6 +64,10 @@ do
PLATFORM="AppleTVOS" PLATFORM="AppleTVOS"
elif [[ "${TARGET}" == "ios-sim-cross-"* ]]; then elif [[ "${TARGET}" == "ios-sim-cross-"* ]]; then
PLATFORM="iPhoneSimulator" PLATFORM="iPhoneSimulator"
elif [[ "${TARGET}" == "xros-sim-cross"* ]]; then
PLATFORM="XRSimulator"
elif [[ "${TARGET}" == "xros"* ]]; then
PLATFORM="XROS"
else else
PLATFORM="iPhoneOS" PLATFORM="iPhoneOS"
fi fi