Support specifying multiple zircon projects to target
Change-Id: I2f90adbcb60b2117c8dfab04dadf1ff0ec8bad8d
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index dc24744..538f72e 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -61,18 +61,32 @@
# See //build/toolchain/clang_toolchain.gni for details.
current_base_toolchain = target_toolchain
- # zircon build project
+ # Zircon projects to target - must match the target architecture.
+ zircon_projects = []
+
+ # DEPRECATED: zircon build project
+ # Use zircon_projects instead
zircon_project = ""
}
-if (zircon_project == "") {
+if (zircon_project != "") {
+ assert(zircon_projects == [], "Use zircon_projects instead of zircon_project")
+ zircon_projects = [ zircon_project ]
+} else if (zircon_projects == []) {
if (current_cpu == "arm64") {
- zircon_project = "zircon-qemu-arm64"
+ zircon_projects = [ "zircon-qemu-arm64" ]
} else if (current_cpu == "x64") {
- zircon_project = "zircon-pc-x86-64"
+ zircon_projects = [ "zircon-pc-x86-64" ]
}
}
-assert(zircon_project != "", "unable to set default zircon build project")
+if (target_cpu == "x64") {
+ zircon_sysroot =
+ rebase_path("//out/build-zircon/build-zircon-pc-x86-64/sysroot")
+} else {
+ assert(target_cpu == "arm64", "Unsupported target architecture $target_cpu")
+ zircon_sysroot =
+ rebase_path("//out/build-zircon/build-zircon-qemu-arm64/sysroot")
+}
is_android = false
is_fuchsia = false
diff --git a/config/sysroot.gni b/config/sysroot.gni
index fbe3fc1..20c924b 100644
--- a/config/sysroot.gni
+++ b/config/sysroot.gni
@@ -10,7 +10,7 @@
if (current_os == target_os && target_sysroot != "") {
sysroot = target_sysroot
} else if (is_fuchsia) {
- sysroot = rebase_path("//out/build-zircon/build-${zircon_project}/sysroot")
+ sysroot = zircon_sysroot
} else if (is_linux) {
sysroot = rebase_path("//buildtools/sysroot")
} else if (is_mac) {
diff --git a/go/build.py b/go/build.py
index b5919ad..89a1cec 100755
--- a/go/build.py
+++ b/go/build.py
@@ -20,7 +20,7 @@
required=True)
parser.add_argument('--root-out-dir', help='Path to root of build output',
required=True)
- parser.add_argument('--zircon-build-dir', help='The Zircon build dir to use',
+ parser.add_argument('--zircon-sysroot', help='The Zircon sysroot to use',
required=True)
parser.add_argument('--depfile', help='The path to the depfile',
required=True)
@@ -87,7 +87,7 @@
env['GOARCH'] = goarch
env['GOOS'] = goos
env['GOPATH'] = gopath
- env['ZIRCON_BUILD_DIR'] = args.zircon_build_dir
+ env['ZIRCON_SYSROOT'] = args.zircon_sysroot
# /usr/bin:/bin are required for basic things like bash(1) and env(1), but
# preference the toolchain path. Note that on Mac, ld is also found from
diff --git a/go/go_build.gni b/go/go_build.gni
index fdfe347..2d2eb63 100644
--- a/go/go_build.gni
+++ b/go/go_build.gni
@@ -48,7 +48,9 @@
use_strip = is_fuchsia
output_path = "${root_out_dir}/${output_name}"
- outputs = [ output_path ]
+ outputs = [
+ output_path,
+ ]
if (use_strip) {
unstripped_output_path = "${root_out_dir}/exe.unstripped/${output_name}"
@@ -72,8 +74,8 @@
rebase_path("//."),
"--root-out-dir",
rebase_path(root_out_dir, root_build_dir),
- "--zircon-build-dir",
- rebase_path("//out/build-zircon/build-${zircon_project}"),
+ "--zircon-sysroot",
+ rebase_path(zircon_sysroot),
"--depfile",
rebase_path(depfile),
"--current-cpu",
@@ -89,7 +91,10 @@
]
if (use_strip) {
- args += [ "--unstripped-binname", "exe.unstripped/${output_name}" ]
+ args += [
+ "--unstripped-binname",
+ "exe.unstripped/${output_name}",
+ ]
}
if (defined(invoker.test) && invoker.test) {