Reland "watchOS target os"
This is a reland of commit 7ae1d75869
TEST=manual, no watchOS SDK on bots yet.
Original change's description:
> watchOS target os
>
> - add support for --os=watchos | --os=watchos_simulator
> - do not depend on perfetto if dart_support_perfetto is false
> - change the default value for dart_support_perfetto to !is_watchos
>
> To minimize changes and to avoid modifying third-party zlib BUILD file, is_watchos implies is_ios for now.
>
> TEST=manual, no watchOS SDK on bots yet.
>
> Cq-Include-Trybots: luci.dart.try:vm-mac-debug-arm64-try,vm-mac-release-arm64-try
> Change-Id: If2130068ef546162a07a9ba53f94b11ff25fb565
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415021
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Cq-Include-Trybots: luci.dart.try:vm-mac-debug-arm64-try,vm-mac-release-arm64-try
Change-Id: I2b50f7eb4da173627aeb4833b88a08712b278d9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425523
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
918899974a
commit
29e33b00d0
@@ -177,6 +177,7 @@ if (current_os == "win") {
|
||||
is_mac = false
|
||||
is_nacl = false
|
||||
is_posix = false
|
||||
is_watchos = false
|
||||
is_win = true
|
||||
} else if (current_os == "mac") {
|
||||
is_android = false
|
||||
@@ -187,6 +188,7 @@ if (current_os == "win") {
|
||||
is_mac = true
|
||||
is_nacl = false
|
||||
is_posix = true
|
||||
is_watchos = false
|
||||
is_win = false
|
||||
} else if (current_os == "android") {
|
||||
is_android = true
|
||||
@@ -197,6 +199,7 @@ if (current_os == "win") {
|
||||
is_mac = false
|
||||
is_nacl = false
|
||||
is_posix = true
|
||||
is_watchos = false
|
||||
is_win = false
|
||||
} else if (current_os == "linux") {
|
||||
is_android = false
|
||||
@@ -207,6 +210,7 @@ if (current_os == "win") {
|
||||
is_mac = false
|
||||
is_nacl = false
|
||||
is_posix = true
|
||||
is_watchos = false
|
||||
is_win = false
|
||||
} else if (current_os == "fuchsia") {
|
||||
is_android = false
|
||||
@@ -217,6 +221,7 @@ if (current_os == "win") {
|
||||
is_mac = false
|
||||
is_nacl = false
|
||||
is_posix = true
|
||||
is_watchos = false
|
||||
is_win = false
|
||||
} else if (current_os == "ios") {
|
||||
is_android = false
|
||||
@@ -227,6 +232,23 @@ if (current_os == "win") {
|
||||
is_mac = false
|
||||
is_nacl = false
|
||||
is_posix = true
|
||||
is_watchos = false
|
||||
is_win = false
|
||||
} else if (current_os == "watchos") {
|
||||
is_android = false
|
||||
is_chromeos = false
|
||||
is_fuchsia = false
|
||||
|
||||
# watchOS and iOS are similar enough, so almost all codepaths in
|
||||
# BUILD files are the same for watchOS and iOS. Additionally,
|
||||
# BUILD.gn zlib file doesn't support `is_watchos`, but works fine
|
||||
# with `is_ios`.
|
||||
is_ios = true
|
||||
is_linux = false
|
||||
is_mac = false
|
||||
is_nacl = false
|
||||
is_posix = true
|
||||
is_watchos = true
|
||||
is_win = false
|
||||
}
|
||||
|
||||
@@ -445,17 +467,19 @@ if (is_win) {
|
||||
host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
|
||||
set_default_toolchain("//build/toolchain/mac:clang_$current_cpu")
|
||||
} else if (is_ios) {
|
||||
import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator
|
||||
import("//build/config/ios/ios_sdk.gni") # For use_simulator
|
||||
host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
|
||||
if (use_ios_simulator) {
|
||||
if (target_cpu == "arm64") {
|
||||
set_default_toolchain("//build/toolchain/mac:ios_clang_arm64_sim")
|
||||
} else {
|
||||
set_default_toolchain("//build/toolchain/mac:ios_clang_x64_sim")
|
||||
}
|
||||
toolchain_target = "clang"
|
||||
if (is_watchos) {
|
||||
toolchain_target = "watchos_$toolchain_target"
|
||||
} else {
|
||||
set_default_toolchain("//build/toolchain/mac:ios_clang_arm64")
|
||||
toolchain_target = "ios_$toolchain_target"
|
||||
}
|
||||
toolchain_target = "${toolchain_target}_$target_cpu"
|
||||
if (use_simulator) {
|
||||
toolchain_target = "${toolchain_target}_sim"
|
||||
}
|
||||
set_default_toolchain("//build/toolchain/mac:$toolchain_target")
|
||||
} else if (is_fuchsia) {
|
||||
assert(host_cpu == "x64")
|
||||
if (host_os == "linux") {
|
||||
@@ -554,7 +578,8 @@ if (!is_shared_library) {
|
||||
|
||||
output_prefix = "lib"
|
||||
if (!defined(output_extension)) {
|
||||
if (current_os == "mac" || current_os == "ios") {
|
||||
if (current_os == "mac" || current_os == "ios" ||
|
||||
current_os == "watchos") {
|
||||
output_extension = "dylib"
|
||||
} else if (current_os == "win") {
|
||||
output_extension = "dll"
|
||||
|
||||
@@ -6,28 +6,41 @@ import("//build/toolchain/rbe.gni")
|
||||
|
||||
declare_args() {
|
||||
# SDK path to use. When empty this will use the default SDK based on the
|
||||
# value of use_ios_simulator.
|
||||
# value of use_simulator.
|
||||
ios_sdk_path = ""
|
||||
|
||||
# Set to true when targeting a simulator build on iOS. False means that the
|
||||
# target is for running on the device. The default value is to use the
|
||||
# Simulator except when targeting GYP's Xcode builds (for compat with the
|
||||
# existing GYP build).
|
||||
use_ios_simulator = false
|
||||
use_simulator = false
|
||||
|
||||
# Minimum supported version of the iOS SDK.
|
||||
ios_sdk_min = "12.0"
|
||||
|
||||
# Minimum supported version of the watchOS SDK.
|
||||
watchos_sdk_min = "11.0"
|
||||
|
||||
# The path to the iOS device SDK.
|
||||
ios_device_sdk_path = ""
|
||||
|
||||
# The path to the iOS simulator SDK.
|
||||
ios_simulator_sdk_path = ""
|
||||
|
||||
# The path to the watchOS device SDK.
|
||||
watchos_device_sdk_path = ""
|
||||
|
||||
# The path to the watchOS simulator SDK.
|
||||
watchos_simulator_sdk_path = ""
|
||||
|
||||
ios_enable_relative_sdk_path = use_rbe
|
||||
}
|
||||
|
||||
if (ios_sdk_path == "") {
|
||||
if (is_watchos) {
|
||||
ios_sdk_min = watchos_sdk_min
|
||||
}
|
||||
|
||||
_find_sdk_args = [
|
||||
"--print_sdk_path",
|
||||
ios_sdk_min,
|
||||
@@ -42,25 +55,44 @@ if (ios_sdk_path == "") {
|
||||
]
|
||||
}
|
||||
|
||||
if (use_ios_simulator && ios_simulator_sdk_path == "") {
|
||||
_find_sdk_args += [ "--platform=iphone_simulator" ]
|
||||
_find_sdk_result =
|
||||
exec_script("//build/mac/find_sdk.py", _find_sdk_args, "list lines")
|
||||
ios_simulator_sdk_path = _find_sdk_result[0]
|
||||
platform = "iphone"
|
||||
if (is_watchos) {
|
||||
platform = "watch"
|
||||
}
|
||||
if (use_simulator) {
|
||||
platform = "${platform}_simulator"
|
||||
}
|
||||
|
||||
if (!use_ios_simulator && ios_device_sdk_path == "") {
|
||||
_find_sdk_args += [ "--platform=iphone" ]
|
||||
_find_sdk_result =
|
||||
exec_script("//build/mac/find_sdk.py", _find_sdk_args, "list lines")
|
||||
ios_device_sdk_path = _find_sdk_result[0]
|
||||
}
|
||||
_find_sdk_args += [ "--platform=$platform" ]
|
||||
_find_sdk_result =
|
||||
exec_script("//build/mac/find_sdk.py", _find_sdk_args, "list lines")
|
||||
platform_sdk_path = _find_sdk_result[0]
|
||||
|
||||
if (use_ios_simulator) {
|
||||
assert(ios_simulator_sdk_path != "")
|
||||
ios_sdk_path = ios_simulator_sdk_path
|
||||
} else {
|
||||
assert(ios_device_sdk_path != "")
|
||||
ios_sdk_path = ios_device_sdk_path
|
||||
if (use_simulator && is_watchos) {
|
||||
# watchos_simulator
|
||||
if (watchos_simulator_sdk_path != "") {
|
||||
platform_sdk_path = watchos_simulator_sdk_path
|
||||
}
|
||||
ios_sdk_path = platform_sdk_path
|
||||
ios_sdk_min = watchos_sdk_min
|
||||
} else if (!use_simulator && is_watchos) {
|
||||
# watchos
|
||||
if (watchos_device_sdk_path != "") {
|
||||
platform_sdk_path = watchos_device_sdk_path
|
||||
}
|
||||
ios_sdk_path = platform_sdk_path
|
||||
ios_sdk_min = watchos_sdk_min
|
||||
} else if (use_simulator && !is_watchos) {
|
||||
# ios_simulator
|
||||
if (ios_simulator_sdk_path != "") {
|
||||
platform_sdk_path = ios_simulator_sdk_path
|
||||
}
|
||||
ios_sdk_path = platform_sdk_path
|
||||
} else if (!use_simulator && !is_watchos) {
|
||||
# ios
|
||||
if (ios_device_sdk_path != "") {
|
||||
platform_sdk_path = ios_device_sdk_path
|
||||
}
|
||||
ios_sdk_path = platform_sdk_path
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,55 @@ mac_toolchain_suite("ios_clang_x64_sim") {
|
||||
"-isysroot $ios_sdk_path -mios-simulator-version-min=$ios_sdk_min"
|
||||
}
|
||||
|
||||
if (is_watchos) {
|
||||
# Toolchain used for watchOS device targets.
|
||||
mac_toolchain_suite("watchos_clang_arm64") {
|
||||
toolchain_cpu = "arm64"
|
||||
toolchain_os = "watchos"
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm64-apple-darwin"
|
||||
cxx = "${cxx} --target=arm64-apple-darwin"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
strip = "${prefix}/llvm-strip"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
is_clang = true
|
||||
if (ios_enable_relative_sdk_path) {
|
||||
ios_sdk_path = rebase_path(ios_sdk_path, root_build_dir)
|
||||
}
|
||||
sysroot_flags = "-isysroot $ios_sdk_path -mwatchos-version-min=$ios_sdk_min"
|
||||
}
|
||||
|
||||
# Toolchain used for watchOS simulator targets (arm64).
|
||||
mac_toolchain_suite("watchos_clang_arm64_sim") {
|
||||
toolchain_cpu = "arm64"
|
||||
toolchain_os = "watchos"
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm64-apple-darwin"
|
||||
cxx = "${cxx} --target=arm64-apple-darwin"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
strip = "${prefix}/llvm-strip"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
is_clang = true
|
||||
if (ios_enable_relative_sdk_path) {
|
||||
ios_sdk_path = rebase_path(ios_sdk_path, root_build_dir)
|
||||
}
|
||||
sysroot_flags =
|
||||
"-isysroot $ios_sdk_path -mwatchos-simulator-version-min=$ios_sdk_min"
|
||||
}
|
||||
}
|
||||
|
||||
mac_toolchain_suite("clang_x64") {
|
||||
toolchain_cpu = "x64"
|
||||
toolchain_os = "mac"
|
||||
|
||||
Reference in New Issue
Block a user