diff options
author | cmasone <cmasone@chromium.org> | 2014-09-25 18:28:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-26 01:28:15 +0000 |
commit | 2c8e745d9c4de27b44f4d866a2bf0f0a880d9b8c (patch) | |
tree | 190e8cc49f994d092338653b6af9249744c98840 /build | |
parent | 8e87d53d550ad2b3b254b19b888158be41259b6d (diff) | |
download | chromium_src-2c8e745d9c4de27b44f4d866a2bf0f0a880d9b8c.zip chromium_src-2c8e745d9c4de27b44f4d866a2bf0f0a880d9b8c.tar.gz chromium_src-2c8e745d9c4de27b44f4d866a2bf0f0a880d9b8c.tar.bz2 |
GN: Fix compile errors with os==chromeos mojo/public build
The big changes here are:
1) Allow injecting of a target toolchain via args for os==chromeos.
2) For ARM builds, allow injecting -mtune and -mfloat-abi settings.
3) Allow injecting a pkg-config wrapper that correctly handles the
CrOS build environment. This is how pkg-config is handled for
all other packages in the build.
4) Create libmojo_sdk target, a static library of public Mojo code
suitable for distribution.
5) Added testonly = true to a few targets under mojo/ that are not
meant to be used in production.
BUG=388412
TEST=Create a target that builds //mojo/public, build with os==chromeos
Review URL: https://codereview.chromium.org/549453004
Cr-Commit-Position: refs/heads/master@{#296849}
Diffstat (limited to 'build')
-rw-r--r-- | build/config/BUILDCONFIG.gn | 10 | ||||
-rw-r--r-- | build/config/arm.gni | 23 | ||||
-rw-r--r-- | build/config/linux/pkg-config.py | 4 | ||||
-rw-r--r-- | build/config/linux/pkg_config.gni | 11 | ||||
-rw-r--r-- | build/toolchain/cros/BUILD.gn | 35 |
5 files changed, 76 insertions, 7 deletions
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index bf2076c..7994dd7 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -64,6 +64,13 @@ declare_args() { # Compile for Thread Sanitizer to find threading bugs. is_tsan = false + + if (os == "chromeos") { + # Allows the target toolchain to be injected as arguments. This is needed + # to support the CrOS build system which supports per-build-configuration + # toolchains. + cros_use_custom_toolchain = false + } } # ============================================================================= @@ -496,6 +503,9 @@ if (is_win) { host_toolchain = "//build/toolchain/linux:$build_cpu_arch" set_default_toolchain("//build/toolchain/linux:$cpu_arch") } + if (is_chromeos && cros_use_custom_toolchain) { + set_default_toolchain("//build/toolchain/cros:target") + } } else if (is_mac) { host_toolchain = "//build/toolchain/mac:clang" set_default_toolchain(host_toolchain) diff --git a/build/config/arm.gni b/build/config/arm.gni index 65cb160..59de668 100644 --- a/build/config/arm.gni +++ b/build/config/arm.gni @@ -12,6 +12,14 @@ if (cpu_arch == "arm") { # "softfp". An empty string means to use the default one for the # arm_version. arm_float_abi = "" + + # The ARM variant-specific tuning mode. This will be a string like "armv6" + # or "cortex-a15". An empty string means to use the default for the + # arm_version. + arm_tune = "" + + # Whether to use the neon FPU instruction set or not. + arm_use_neon = true } assert(arm_float_abi == "" || @@ -21,15 +29,14 @@ if (cpu_arch == "arm") { if (is_android) { arm_use_neon = false - arm_optionally_use_neon = true - } else { - arm_use_neon = true - arm_optionally_use_neon = true } + arm_optionally_use_neon = true if (arm_version == 6) { arm_arch = "armv6" - arm_tune = "" + if (arm_tune != "") { + arm_tune = "" + } if (arm_float_abi == "") { arm_float_abi = "softfp" } @@ -40,10 +47,14 @@ if (cpu_arch == "arm") { } else if (arm_version == 7) { arm_arch = "armv7-a" - arm_tune = "generic-armv7-a" + if (arm_tune == "") { + arm_tune = "generic-armv7-a" + } + if (arm_float_abi == "") { arm_float_abi = "softfp" } + arm_use_thumb = true if (arm_use_neon) { diff --git a/build/config/linux/pkg-config.py b/build/config/linux/pkg-config.py index b107e74..60304d4 100644 --- a/build/config/linux/pkg-config.py +++ b/build/config/linux/pkg-config.py @@ -101,6 +101,8 @@ def RewritePath(path, strip_prefix, sysroot): parser = OptionParser() +parser.add_option('-p', action='store', dest='pkg_config', type='string', + default='pkg-config') parser.add_option('-v', action='append', dest='strip_out', type='string') parser.add_option('-s', action='store', dest='sysroot', type='string') parser.add_option('-a', action='store', dest='arch', type='string') @@ -120,7 +122,7 @@ else: try: flag_string = subprocess.check_output( - [ "pkg-config", "--cflags", "--libs-only-l", "--libs-only-L" ] + + [ options.pkg_config, "--cflags", "--libs-only-l", "--libs-only-L" ] + args, env=os.environ) # For now just split on spaces to get the args out. This will break if # pkgconfig returns quoted things with spaces in them, but that doesn't seem diff --git a/build/config/linux/pkg_config.gni b/build/config/linux/pkg_config.gni index 46f7d75..378863e 100644 --- a/build/config/linux/pkg_config.gni +++ b/build/config/linux/pkg_config.gni @@ -24,6 +24,15 @@ import("//build/config/sysroot.gni") # when doing manual dynamic linking), set: # ignore_libs = true +declare_args() { + # A pkg-config wrapper to call instead of trying to find and call the right + # pkg-config directly. Wrappers like this are common in cross-compilation + # environments. + # Leaving it blank defaults to searching PATH for 'pkg-config' and relying on + # the sysroot mechanism to find the right .pc files. + pkg_config = "" +} + template("pkg_config") { assert(defined(invoker.packages), "Variable |packages| must be defined to be a list in pkg_config.") @@ -31,6 +40,8 @@ template("pkg_config") { if (sysroot != "") { # Pass the sysroot if we're using one (it requires the CPU arch also). args = ["-s", sysroot, "-a", cpu_arch] + invoker.packages + } else if (pkg_config != "") { + args = ["-p", pkg_config] + invoker.packages } else { args = invoker.packages } diff --git a/build/toolchain/cros/BUILD.gn b/build/toolchain/cros/BUILD.gn new file mode 100644 index 0000000..d360f72 --- /dev/null +++ b/build/toolchain/cros/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/toolchain/clang.gni") +import("//build/toolchain/gcc_toolchain.gni") + +declare_args() { + # The CrOS build system supports many different kinds of targets across + # many different architectures. Bringing your own toolchain is also supported, + # so it's actually impossible to enumerate all toolchains for all targets + # as GN toolchain specifications. + # These arguments provide a mechanism for specifying your CC, CXX and AR at + # buildfile-generation time, allowing the CrOS build system to always use + # the right tools for the current target. + cros_target_cc = "" + cros_target_cxx = "" + cros_target_ar = "" +} + +gcc_toolchain("target") { + assert(cros_target_cc != "", "Must provide target CC.") + assert(cros_target_cxx != "", "Must provide target CXX.") + assert(cros_target_ar != "", "Must provide target AR.") + + cc = "${cros_target_cc}" + cxx = "${cros_target_cxx}" + + ar = "${cros_target_ar}" + ld = cxx + + toolchain_cpu_arch = "${cpu_arch}" + toolchain_os = "linux" + is_clang = is_clang +} |