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-Original-Commit-Position: refs/heads/master@{#296849} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 2c8e745d9c4de27b44f4d866a2bf0f0a880d9b8c
This commit is contained in:
Родитель
dcfffaa9ea
Коммит
fbf385d4ba
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
Загрузка…
Ссылка в новой задаче