Skip to content

tvOS, watchOS, xrOS #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: m137_release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config/apple/codesign.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ def Load(self):
def Kind(platform, extension):
if platform in ('iphoneos', 'iphonesimulator'):
return 'ios'
if platform == 'xros':
return 'xros'
if platform == 'xrsimulator':
return 'xrsimulator'
if platform == 'appletvos':
return 'appletvos'
if platform == 'appletvsimulator':
return 'appletvsimulator'
if platform == 'watchos':
return 'watchos'
if platform == 'watchsimulator':
return 'watchsimulator'
if platform == 'macosx':
if extension == '.framework':
return 'mac_framework'
Expand Down
9 changes: 8 additions & 1 deletion config/apple/create_signed_bundle.gni
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ template("apple_mobile_create_signed_bundle") {
])

bundle_root_dir = "$_bundle_gen_dir/$_output_name$_bundle_extension"
if (target_environment == "simulator" || target_environment == "device") {
if (target_environment == "simulator" ||
target_environment == "device" ||
target_environment == "appletvsimulator" ||
target_environment == "appletv" ||
target_environment == "xrsimulator" ||
target_environment == "xrdevice") {
bundle_contents_dir = bundle_root_dir
bundle_resources_dir = bundle_contents_dir
bundle_executable_dir = bundle_contents_dir
Expand All @@ -229,6 +234,8 @@ template("apple_mobile_create_signed_bundle") {
bundle_resources_dir = "$bundle_contents_dir/Resources"
bundle_executable_dir = bundle_contents_dir
}
} else {
assert(false, "unsupported target_environment=$target_environment")
}

if (!defined(public_deps)) {
Expand Down
4 changes: 4 additions & 0 deletions config/apple/mobile_config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ if (is_ios || is_watchos) {
_target_environments = [
"simulator",
"device",
"appletv",
"appletvsimulator",
"xrdevice",
"xrsimulator",
]
if (is_ios && target_platform == "iphoneos") {
_target_environments += [ "catalyst" ]
Expand Down
11 changes: 2 additions & 9 deletions config/apple/sdk_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,8 @@ def main():
default='.',
help='Value of gn $root_build_dir')
parser.add_argument('platform',
choices=[
'appletvos',
'appletvsimulator',
'iphoneos',
'iphonesimulator',
'macosx',
'watchos',
'watchsimulator',
])
choices=['iphoneos', 'iphonesimulator', 'macosx', 'xros', 'xrsimulator', 'appletvos',
'appletvsimulator', 'watchos', 'watchsimulator'])
args = parser.parse_args()
if args.developer_dir:
os.environ['DEVELOPER_DIR'] = args.developer_dir
Expand Down
42 changes: 25 additions & 17 deletions config/clang/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ clang_lib("compiler_builtins") {
libname = "ios"
} else if (target_environment == "catalyst") {
libname = "osx"
} else {
assert(false, "unsupported target_environment=$target_environment")
}
} else if (target_platform == "tvos") {
if (target_environment == "simulator") {
} else if (target_environment == "appletvsimulator") {
libname = "tvossim"
} else if (target_environment == "device") {
} else if (target_environment == "appletv") {
libname = "tvos"
} else if (target_environment == "xrsimulator") {
libname = "xrossim"
} else if (target_environment == "xrdevice") {
libname = "xros"
} else {
assert(false, "unsupported target_environment=$target_environment")
}
Expand All @@ -290,18 +290,26 @@ clang_lib("compiler_profile") {
} else if (is_mac) {
libname = "profile_osx"
} else if (is_ios) {
if (target_environment == "simulator") {
libname = "profile_iossim"
} else if (target_environment == "catalyst") {
# We don't enable clang coverage on iOS device builds, and the library is
# not part of the Clang package tarball as a result.
#
# Don't define libname which makes this target do nothing.
if (target_platform == "iphoneos") {
if (target_environment == "simulator") {
libname = "profile_iossim"
} else if (target_environment == "catalyst") {
# We don't enable clang coverage on iOS device builds, and the library is
# not part of the Clang package tarball as a result.
#
# Don't define libname which makes this target do nothing.
} else if (target_environment == "appletvsimulator") {
libname = "profile_tvossim"
} else if (target_environment == "xrsimulator") {
libname = "profile_xrossim"
} else {
# We don't enable clang coverage on device builds, and the library is
# not part of the Clang package tarball as a result.
#
# Don't define libname which makes this target do nothing.
}
} else {
# We don't enable clang coverage on iOS device builds, and the library is
# not part of the Clang package tarball as a result.
#
# Don't define libname which makes this target do nothing.
assert(false, "unsupported target_platform=$target_platform")
}
} else {
libname = "profile"
Expand Down
32 changes: 32 additions & 0 deletions config/ios/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ config("compiler") {
triplet_environment = "-simulator"
} else if (target_environment == "device") {
triplet_environment = ""
} else if (target_environment == "xrdevice") {
triplet_environment = ""
} else if (target_environment == "xrsimulator") {
triplet_environment = "-simulator"
} else if (target_environment == "appletv") {
triplet_environment = ""
} else if (target_environment == "appletvsimulator") {
triplet_environment = "-simulator"
} else if (target_environment == "watch") {
triplet_environment = ""
} else if (target_environment == "watchsimulator") {
triplet_environment = "-simulator"
} else if (target_environment == "catalyst") {
triplet_environment = "-macabi"
} else {
Expand All @@ -50,6 +62,14 @@ config("compiler") {
triplet_os = "apple-tvos"
}

if (target_environment == "xrdevice" || target_environment == "xrsimulator") {
triplet_os = "apple-xros"
} else if (target_environment == "appletv" || target_environment == "appletvsimulator") {
triplet_os = "apple-tvos"
} else if (target_environment == "watch" || target_environment == "watchsimulator") {
triplet_os = "apple-watchos"
}

# Set target.
common_flags = [
"-target",
Expand Down Expand Up @@ -196,6 +216,18 @@ config("ios_dynamic_flags") {
_swift_compatibility_libs_suffix = "iphonesimulator"
} else if (target_environment == "device") {
_swift_compatibility_libs_suffix = "iphoneos"
} else if (target_environment == "xrdevice") {
_swift_compatibility_libs_suffix = "xros"
} else if (target_environment == "xrsimulator") {
_swift_compatibility_libs_suffix = "xrsimulator"
} else if (target_environment == "appletv") {
_swift_compatibility_libs_suffix = "appletvos"
} else if (target_environment == "appletvsimulator") {
_swift_compatibility_libs_suffix = "appletvsimulator"
} else if (target_environment == "watch") {
_swift_compatibility_libs_suffix = "watchos"
} else if (target_environment == "watchsimulator") {
_swift_compatibility_libs_suffix = "watchsimulator"
} else if (target_environment == "catalyst") {
# The Swift compatibility libraries have changed location starting with
# Xcode 13.0, so check the version of Xcode when deciding which path to
Expand Down
13 changes: 13 additions & 0 deletions config/ios/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,16 @@ declare_args() {
# application. It should generally NOT be enabled.
ios_chrome_generate_order_file = false
}

if (target_environment == "") {
if (current_cpu == "x86" || current_cpu == "x64") {
target_environment = "simulator"
} else {
target_environment = "device"
}
}

assert(target_environment == "simulator" || target_environment == "device" ||
target_environment == "catalyst" || target_environment == "xrdevice" || target_environment == "xrsimulator" ||
target_environment == "appletv" ||target_environment == "appletvsimulator" ||
target_environment == "watch" ||target_environment == "watchsimulator")
50 changes: 27 additions & 23 deletions config/ios/ios_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,33 @@ ios_use_xcode_symlinks =

if (ios_sdk_path == "") {
# Compute default target.
if (target_platform == "iphoneos") {
if (target_environment == "simulator") {
ios_sdk_name = "iphonesimulator"
ios_sdk_platform = "iPhoneSimulator"
} else if (target_environment == "device") {
ios_sdk_name = "iphoneos"
ios_sdk_platform = "iPhoneOS"
} else if (target_environment == "catalyst") {
ios_sdk_name = "macosx"
ios_sdk_platform = "MacOSX"
} else {
assert(false, "unsupported target_environment=$target_environment")
}
} else if (target_platform == "tvos") {
if (target_environment == "simulator") {
ios_sdk_name = "appletvsimulator"
ios_sdk_platform = "AppleTVSimulator"
} else if (target_environment == "device") {
ios_sdk_name = "appletvos"
ios_sdk_platform = "AppleTVOS"
} else {
assert(false, "unsupported target_environment=$target_environment")
}
if (target_environment == "simulator") {
ios_sdk_name = "iphonesimulator"
ios_sdk_platform = "iPhoneSimulator"
} else if (target_environment == "device") {
ios_sdk_name = "iphoneos"
ios_sdk_platform = "iPhoneOS"
} else if (target_environment == "xrdevice") {
ios_sdk_name = "xros"
ios_sdk_platform = "XROS"
} else if (target_environment == "xrsimulator") {
ios_sdk_name = "xrsimulator"
ios_sdk_platform = "XRSimulator"
} else if (target_environment == "watch") {
ios_sdk_name = "watchos"
ios_sdk_platform = "WatchOS"
} else if (target_environment == "watchsimulator") {
ios_sdk_name = "watchsimulator"
ios_sdk_platform = "WatchSimulator"
} else if (target_environment == "appletv") {
ios_sdk_name = "appletvos"
ios_sdk_platform = "AppleTVOS"
} else if (target_environment == "appletvsimulator") {
ios_sdk_name = "appletvsimulator"
ios_sdk_platform = "AppleTVSimulator"
} else if (target_environment == "catalyst") {
ios_sdk_name = "macosx"
ios_sdk_platform = "MacOSX"
} else {
assert(false, "unsupported target_platform=$target_platform")
}
Expand Down
4 changes: 3 additions & 1 deletion config/ios/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,9 @@ template("ios_framework_bundle") {
_public_headers = invoker.public_headers

_framework_root_dir = "$root_out_dir/$_output_name.framework"
if (target_environment == "simulator" || target_environment == "device") {
if (target_environment == "simulator" || target_environment == "device" || target_environment == "xrdevice" ||
target_environment == "xrsimulator" || target_environment == "appletv" || target_environment == "appletvsimulator" ||
target_environment == "watch" || target_environment == "watchsimulator") {
_framework_contents_dir = _framework_root_dir
} else if (target_environment == "catalyst") {
_framework_contents_dir = "$_framework_root_dir/Versions/A"
Expand Down
23 changes: 12 additions & 11 deletions config/rust.gni
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,18 @@ if (is_linux || is_chromeos) {
} else if (target_environment == "catalyst") {
rust_abi_target = "aarch64-apple-ios-macabi"
cargo_target_abi = "macabi"
} else {
assert(false, "unsupported target_environment=$target_environment")
}
} else if (target_platform == "tvos") {
if (target_environment == "simulator") {
} else if (target_environment == "appletvsimulator") {
rust_abi_target = "aarch64-apple-tvos-sim"
cargo_target_abi = "sim"
} else if (target_environment == "device") {
} else if (target_environment == "appletv") {
rust_abi_target = "aarch64-apple-tvos"
cargo_target_abi = ""
} else if (target_environment == "xrsimulator") {
rust_abi_target = "aarch64-apple-xros-sim"
cargo_target_abi = "sim"
} else if (target_environment == "xrdevice") {
rust_abi_target = "aarch64-apple-xros"
cargo_target_abi = ""
} else {
assert(false, "unsupported target_environment=$target_environment")
}
Expand All @@ -308,13 +310,12 @@ if (is_linux || is_chromeos) {
} else if (target_environment == "catalyst") {
rust_abi_target = "x86_64-apple-ios-macabi"
cargo_target_abi = "macabi"
} else {
assert(false, "unsupported target_environment=$target_environment")
}
} else if (target_platform == "tvos") {
if (target_environment == "simulator") {
} else if (target_environment == "appletvsimulator") {
rust_abi_target = "x86_64-apple-tvos"
cargo_target_abi = "sim"
} else if (target_environment == "xrsimulator") {
rust_abi_target = "x86_64-apple-xros"
cargo_target_abi = "sim"
} else {
assert(false, "unsupported target_environment=$target_environment")
}
Expand Down