2013-11-21 02:21:03 +04:00
|
|
|
# Copyright (c) 2013 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.
|
|
|
|
|
2015-07-15 19:11:50 +03:00
|
|
|
# =============================================================================
|
|
|
|
# PLATFORM SELECTION
|
|
|
|
# =============================================================================
|
|
|
|
#
|
|
|
|
# There are two main things to set: "os" and "cpu". The "toolchain" is the name
|
|
|
|
# of the GN thing that encodes combinations of these things.
|
|
|
|
#
|
|
|
|
# Users typically only set the variables "target_os" and "target_cpu" in "gn
|
|
|
|
# args", the rest are set up by our build and internal to GN.
|
|
|
|
#
|
|
|
|
# There are three different types of each of these things: The "host"
|
|
|
|
# represents the computer doing the compile and never changes. The "target"
|
|
|
|
# represents the main thing we're trying to build. The "current" represents
|
|
|
|
# which configuration is currently being defined, which can be either the
|
|
|
|
# host, the target, or something completely different (like nacl). GN will
|
|
|
|
# run the same build file multiple times for the different required
|
|
|
|
# configuration in the same build.
|
|
|
|
#
|
|
|
|
# This gives the following variables:
|
|
|
|
# - host_os, host_cpu, host_toolchain
|
|
|
|
# - target_os, target_cpu, default_toolchain
|
|
|
|
# - current_os, current_cpu, current_toolchain.
|
|
|
|
#
|
|
|
|
# Note the default_toolchain isn't symmetrical (you would expect
|
|
|
|
# target_toolchain). This is because the "default" toolchain is a GN built-in
|
|
|
|
# concept, and "target" is something our build sets up that's symmetrical with
|
|
|
|
# its GYP counterpart. Potentially the built-in default_toolchain variable
|
|
|
|
# could be renamed in the future.
|
|
|
|
#
|
|
|
|
# When writing build files, to do something only for the host:
|
|
|
|
# if (current_toolchain == host_toolchain) { ...
|
|
|
|
|
Roll GN binaries to #317120 for the cpu_arch changes
The newest version of GN replaces the 'cpu_arch' and 'os' variables with 'current_cpu', 'target_cpu', 'current_os', and 'target_os', and also replaces 'build_cpu' with 'host_cpu', and 'build_os' with 'host_os'.
The roll also picks up the change to add a new 'gn clean'
command, some absolute path handling fixes, a check_includes fix for action_foreach(), and some minor
internal fixes.
This patch also updates the build config files to accommodate the GN changes in a backwards-compatible manner, i.e., the configs now will set cpu_arch and os correctly in the right contexts. They will also allow the users to continue to set os= and cpu_arch= in an args file, so no user builds (or bots) will break.
Once all of the bots and all of the build files have been updated to refer to the new variables instead of the old ones, we can drop the backwards-compatible versions.
TBR=brettw@chromium.org
BUG=344767
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/936103003
Cr-Original-Commit-Position: refs/heads/master@{#317186}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7ee02bed35766535521c8e1f072b98cbf9eef53d
2015-02-20 03:16:17 +03:00
|
|
|
if (target_os == "") {
|
2015-03-27 02:35:35 +03:00
|
|
|
target_os = host_os
|
Roll GN binaries to #317120 for the cpu_arch changes
The newest version of GN replaces the 'cpu_arch' and 'os' variables with 'current_cpu', 'target_cpu', 'current_os', and 'target_os', and also replaces 'build_cpu' with 'host_cpu', and 'build_os' with 'host_os'.
The roll also picks up the change to add a new 'gn clean'
command, some absolute path handling fixes, a check_includes fix for action_foreach(), and some minor
internal fixes.
This patch also updates the build config files to accommodate the GN changes in a backwards-compatible manner, i.e., the configs now will set cpu_arch and os correctly in the right contexts. They will also allow the users to continue to set os= and cpu_arch= in an args file, so no user builds (or bots) will break.
Once all of the bots and all of the build files have been updated to refer to the new variables instead of the old ones, we can drop the backwards-compatible versions.
TBR=brettw@chromium.org
BUG=344767
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/936103003
Cr-Original-Commit-Position: refs/heads/master@{#317186}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7ee02bed35766535521c8e1f072b98cbf9eef53d
2015-02-20 03:16:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (target_cpu == "") {
|
2015-03-27 02:35:35 +03:00
|
|
|
if (target_os == "android") {
|
2015-02-21 01:09:56 +03:00
|
|
|
# If we're building for Android, we should assume that we want to
|
|
|
|
# build for ARM by default, not the host_cpu (which is likely x64).
|
|
|
|
# This allows us to not have to specify both target_os and target_cpu
|
|
|
|
# on the command line.
|
|
|
|
target_cpu = "arm"
|
Roll GN binaries to #317120 for the cpu_arch changes
The newest version of GN replaces the 'cpu_arch' and 'os' variables with 'current_cpu', 'target_cpu', 'current_os', and 'target_os', and also replaces 'build_cpu' with 'host_cpu', and 'build_os' with 'host_os'.
The roll also picks up the change to add a new 'gn clean'
command, some absolute path handling fixes, a check_includes fix for action_foreach(), and some minor
internal fixes.
This patch also updates the build config files to accommodate the GN changes in a backwards-compatible manner, i.e., the configs now will set cpu_arch and os correctly in the right contexts. They will also allow the users to continue to set os= and cpu_arch= in an args file, so no user builds (or bots) will break.
Once all of the bots and all of the build files have been updated to refer to the new variables instead of the old ones, we can drop the backwards-compatible versions.
TBR=brettw@chromium.org
BUG=344767
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/936103003
Cr-Original-Commit-Position: refs/heads/master@{#317186}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7ee02bed35766535521c8e1f072b98cbf9eef53d
2015-02-20 03:16:17 +03:00
|
|
|
} else {
|
|
|
|
target_cpu = host_cpu
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_cpu == "") {
|
|
|
|
current_cpu = target_cpu
|
|
|
|
}
|
|
|
|
if (current_os == "") {
|
|
|
|
current_os = target_os
|
|
|
|
}
|
|
|
|
|
2015-05-20 20:32:06 +03:00
|
|
|
# =============================================================================
|
|
|
|
# BUILD FLAGS
|
|
|
|
# =============================================================================
|
|
|
|
#
|
|
|
|
# This block lists input arguments to the build, along with their default
|
|
|
|
# values.
|
|
|
|
#
|
|
|
|
# If a value is specified on the command line, it will overwrite the defaults
|
|
|
|
# given in a declare_args block, otherwise the default will be used.
|
|
|
|
#
|
|
|
|
# YOU SHOULD ALMOST NEVER NEED TO ADD FLAGS TO THIS FILE. GN allows any file in
|
|
|
|
# the build to declare build flags. If you need a flag for a single component,
|
|
|
|
# you can just declare it in the corresponding BUILD.gn file. If you need a
|
|
|
|
# flag in multiple components, there are a few options:
|
|
|
|
#
|
|
|
|
# - If your feature is a single target, say //components/foo, and the targets
|
|
|
|
# depending on foo need to have some define set if foo is enabled: (1) Write
|
|
|
|
# a declare_args block in foo's BUILD.gn file listing your enable_foo build
|
|
|
|
# flag. (2) Write a config in that file listing the define, and list that
|
|
|
|
# config in foo's public_configs. This will propagate that define to all the
|
|
|
|
# targets depending on foo. (3) When foo is not enabled, just make it expand
|
|
|
|
# to an empty group (or whatever's appropriate for the "off" state of your
|
|
|
|
# feature.
|
|
|
|
#
|
|
|
|
# - If a semi-random set of targets need to know about a define: (1) In the
|
|
|
|
# lowest level of the build that knows about this feature, add a declare_args
|
|
|
|
# block in the build file for your enable flag. (2) Write a config that adds
|
|
|
|
# a define conditionally based on that build flags. (3) Manually add that
|
|
|
|
# config to the "configs" applying to the targets that need the define.
|
|
|
|
#
|
|
|
|
# - If a semi-random set of targets need to know about the build flag (to do
|
|
|
|
# file inclusion or exclusion, more than just defines): (1) Write a .gni file
|
|
|
|
# in the lowest-level directory that knows about the feature. (2) Put the
|
|
|
|
# declare_args block with your build flag in that .gni file. (3) Import that
|
|
|
|
# .gni file from the BUILD.gn files that need the flag.
|
|
|
|
#
|
|
|
|
# Other advice:
|
|
|
|
#
|
|
|
|
# - Use boolean values when possible. If you need a default value that expands
|
|
|
|
# to some complex thing in the default case (like the location of the
|
|
|
|
# compiler which would be computed by a script), use a default value of -1 or
|
|
|
|
# the empty string. Outside of the declare_args block, conditionally expand
|
|
|
|
# the default value as necessary.
|
|
|
|
#
|
|
|
|
# - Use a name like "use_foo" or "is_foo" (whatever is more appropriate for
|
|
|
|
# your feature) rather than just "foo".
|
|
|
|
#
|
|
|
|
# - Write good comments directly above the declaration with no blank line.
|
|
|
|
# These comments will appear as documentation in "gn args --list".
|
|
|
|
#
|
|
|
|
# - Don't call exec_script inside declare_args. This will execute the script
|
|
|
|
# even if the value is overridden, which is wasteful. See first bullet.
|
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
declare_args() {
|
|
|
|
# How many symbols to include in the build. This affects the performance of
|
|
|
|
# the build since the symbols are large and dealing with them is slow.
|
|
|
|
# 2 means regular build with symbols.
|
|
|
|
# 1 means minimal symbols, usually enough for backtraces only.
|
|
|
|
# 0 means no symbols.
|
2014-09-12 03:24:27 +04:00
|
|
|
# -1 means auto-set (off in release, regular in debug).
|
|
|
|
symbol_level = -1
|
2013-11-21 02:21:03 +04:00
|
|
|
|
|
|
|
# Component build.
|
|
|
|
is_component_build = false
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# Debug build.
|
|
|
|
is_debug = true
|
|
|
|
|
2015-01-13 11:05:09 +03:00
|
|
|
# Whether we're a traditional desktop unix.
|
2015-02-20 05:55:19 +03:00
|
|
|
is_desktop_linux = current_os == "linux" && current_os != "chromeos"
|
2015-01-13 11:05:09 +03:00
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# Set to true when compiling with the Clang compiler. Typically this is used
|
|
|
|
# to configure warnings.
|
2015-02-20 05:55:19 +03:00
|
|
|
is_clang = current_os == "mac" || current_os == "ios" ||
|
|
|
|
current_os == "linux" || current_os == "chromeos"
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2013-12-23 09:11:32 +04:00
|
|
|
# Compile for Address Sanitizer to find memory bugs.
|
|
|
|
is_asan = false
|
|
|
|
|
|
|
|
# Compile for Leak Sanitizer to find leaks.
|
|
|
|
is_lsan = false
|
|
|
|
|
|
|
|
# Compile for Memory Sanitizer to find uninitialized reads.
|
|
|
|
is_msan = false
|
|
|
|
|
|
|
|
# Compile for Thread Sanitizer to find threading bugs.
|
|
|
|
is_tsan = false
|
2014-09-26 05:28:02 +04:00
|
|
|
|
2015-02-20 05:55:19 +03:00
|
|
|
if (current_os == "chromeos") {
|
2014-09-26 05:28:02 +04:00
|
|
|
# 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
|
|
|
|
}
|
2015-05-20 20:32:06 +03:00
|
|
|
|
|
|
|
# DON'T ADD MORE FLAGS HERE. Read the comment above.
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
# OS DEFINITIONS
|
|
|
|
# =============================================================================
|
|
|
|
#
|
|
|
|
# We set these various is_FOO booleans for convenience in writing OS-based
|
|
|
|
# conditions.
|
|
|
|
#
|
|
|
|
# - is_android, is_chromeos, is_ios, and is_win should be obvious.
|
|
|
|
# - is_mac is set only for desktop Mac. It is not set on iOS.
|
|
|
|
# - is_posix is true for mac and any Unix-like system (basically everything
|
|
|
|
# except Windows).
|
2014-02-12 04:30:55 +04:00
|
|
|
# - is_linux is true for desktop Linux and ChromeOS, but not Android (which is
|
|
|
|
# generally too different despite being based on the Linux kernel).
|
2013-11-21 02:21:03 +04:00
|
|
|
#
|
|
|
|
# Do not add more is_* variants here for random lesser-used Unix systems like
|
2015-02-20 05:55:19 +03:00
|
|
|
# aix or one of the BSDs. If you need to check these, just check the
|
|
|
|
# current_os value directly.
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2015-07-29 18:50:00 +03:00
|
|
|
if (current_os == "win" || current_os == "winrt_81" ||
|
|
|
|
current_os == "winrt_81_phone" || current_os == "winrt_10") {
|
2013-11-21 02:21:03 +04:00
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = false
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = false
|
|
|
|
is_win = true
|
2015-02-20 05:55:19 +03:00
|
|
|
} else if (current_os == "mac") {
|
2013-11-21 02:21:03 +04:00
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = false
|
|
|
|
is_mac = true
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
2015-02-20 05:55:19 +03:00
|
|
|
} else if (current_os == "android") {
|
2013-12-28 10:49:32 +04:00
|
|
|
is_android = true
|
2013-11-21 02:21:03 +04:00
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
2014-02-12 04:30:55 +04:00
|
|
|
is_linux = false
|
2013-11-21 02:21:03 +04:00
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
2015-02-20 05:55:19 +03:00
|
|
|
} else if (current_os == "chromeos") {
|
2013-11-21 02:21:03 +04:00
|
|
|
is_android = false
|
|
|
|
is_chromeos = true
|
|
|
|
is_ios = false
|
|
|
|
is_linux = true
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
2015-02-20 05:55:19 +03:00
|
|
|
} else if (current_os == "nacl") {
|
|
|
|
# current_os == "nacl" will be passed by the nacl toolchain definition.
|
|
|
|
# It is not set by default or on the command line. We treat is as a
|
|
|
|
# Posix variant.
|
2013-11-21 02:21:03 +04:00
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = false
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = true
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
2015-02-20 05:55:19 +03:00
|
|
|
} else if (current_os == "ios") {
|
2013-11-21 02:21:03 +04:00
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = true
|
|
|
|
is_linux = false
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
2015-02-20 05:55:19 +03:00
|
|
|
} else if (current_os == "linux") {
|
2013-11-21 02:21:03 +04:00
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = true
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
|
|
|
}
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
# SOURCES FILTERS
|
|
|
|
# =============================================================================
|
|
|
|
#
|
|
|
|
# These patterns filter out platform-specific files when assigning to the
|
|
|
|
# sources variable. The magic variable |sources_assignment_filter| is applied
|
|
|
|
# to each assignment or appending to the sources variable and matches are
|
|
|
|
# automatcally removed.
|
|
|
|
#
|
|
|
|
# Note that the patterns are NOT regular expressions. Only "*" and "\b" (path
|
|
|
|
# boundary = end of string or slash) are supported, and the entire string
|
|
|
|
# muct match the pattern (so you need "*.cc" to match all .cc files, for
|
|
|
|
# example).
|
|
|
|
|
2014-04-12 03:06:17 +04:00
|
|
|
# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
|
|
|
|
# below.
|
2013-11-21 02:21:03 +04:00
|
|
|
sources_assignment_filter = []
|
2014-05-16 23:31:36 +04:00
|
|
|
if (!is_posix) {
|
|
|
|
sources_assignment_filter += [
|
|
|
|
"*_posix.h",
|
|
|
|
"*_posix.cc",
|
|
|
|
"*_posix_unittest.h",
|
|
|
|
"*_posix_unittest.cc",
|
|
|
|
"*\bposix/*",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
if (!is_win) {
|
|
|
|
sources_assignment_filter += [
|
|
|
|
"*_win.cc",
|
|
|
|
"*_win.h",
|
|
|
|
"*_win_unittest.cc",
|
|
|
|
"*\bwin/*",
|
2015-06-02 11:04:13 +03:00
|
|
|
"*.def",
|
2014-05-16 23:31:36 +04:00
|
|
|
"*.rc",
|
|
|
|
]
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
if (!is_mac) {
|
2014-05-16 23:31:36 +04:00
|
|
|
sources_assignment_filter += [
|
|
|
|
"*_mac.h",
|
|
|
|
"*_mac.cc",
|
|
|
|
"*_mac.mm",
|
|
|
|
"*_mac_unittest.h",
|
|
|
|
"*_mac_unittest.cc",
|
|
|
|
"*_mac_unittest.mm",
|
|
|
|
"*\bmac/*",
|
|
|
|
"*_cocoa.h",
|
|
|
|
"*_cocoa.cc",
|
|
|
|
"*_cocoa.mm",
|
|
|
|
"*_cocoa_unittest.h",
|
|
|
|
"*_cocoa_unittest.cc",
|
|
|
|
"*_cocoa_unittest.mm",
|
|
|
|
"*\bcocoa/*",
|
|
|
|
]
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
if (!is_ios) {
|
2014-05-16 23:31:36 +04:00
|
|
|
sources_assignment_filter += [
|
|
|
|
"*_ios.h",
|
|
|
|
"*_ios.cc",
|
|
|
|
"*_ios.mm",
|
|
|
|
"*_ios_unittest.h",
|
|
|
|
"*_ios_unittest.cc",
|
|
|
|
"*_ios_unittest.mm",
|
|
|
|
"*\bios/*",
|
|
|
|
]
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
if (!is_mac && !is_ios) {
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
sources_assignment_filter += [ "*.mm" ]
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
if (!is_linux) {
|
2014-05-16 23:31:36 +04:00
|
|
|
sources_assignment_filter += [
|
|
|
|
"*_linux.h",
|
|
|
|
"*_linux.cc",
|
|
|
|
"*_linux_unittest.h",
|
|
|
|
"*_linux_unittest.cc",
|
|
|
|
"*\blinux/*",
|
|
|
|
]
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
if (!is_android) {
|
2014-05-16 23:31:36 +04:00
|
|
|
sources_assignment_filter += [
|
|
|
|
"*_android.h",
|
|
|
|
"*_android.cc",
|
|
|
|
"*_android_unittest.h",
|
|
|
|
"*_android_unittest.cc",
|
|
|
|
"*\bandroid/*",
|
|
|
|
]
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
2014-04-15 23:26:44 +04:00
|
|
|
if (!is_chromeos) {
|
2014-05-16 23:31:36 +04:00
|
|
|
sources_assignment_filter += [
|
|
|
|
"*_chromeos.h",
|
|
|
|
"*_chromeos.cc",
|
|
|
|
"*_chromeos_unittest.h",
|
|
|
|
"*_chromeos_unittest.cc",
|
|
|
|
"*\bchromeos/*",
|
|
|
|
]
|
2014-04-15 23:26:44 +04:00
|
|
|
}
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
|
2014-05-16 23:31:36 +04:00
|
|
|
# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
|
|
|
|
# below.
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2014-04-12 03:06:17 +04:00
|
|
|
# Actually save this list.
|
|
|
|
#
|
|
|
|
# These patterns are executed for every file in the source tree of every run.
|
|
|
|
# Therefore, adding more patterns slows down the build for everybody. We should
|
|
|
|
# only add automatic patterns for configurations affecting hundreds of files
|
|
|
|
# across many projects in the tree.
|
|
|
|
#
|
|
|
|
# Therefore, we only add rules to this list corresponding to platforms on the
|
|
|
|
# Chromium waterfall. This is not for non-officially-supported platforms
|
|
|
|
# (FreeBSD, etc.) toolkits, (X11, GTK, etc.), or features. For these cases,
|
|
|
|
# write a conditional in the target to remove the file(s) from the list when
|
|
|
|
# your platform/toolkit/feature doesn't apply.
|
2013-11-21 02:21:03 +04:00
|
|
|
set_sources_assignment_filter(sources_assignment_filter)
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
# BUILD OPTIONS
|
|
|
|
# =============================================================================
|
|
|
|
|
2013-12-23 09:11:32 +04:00
|
|
|
# These Sanitizers all imply using the Clang compiler. On Windows they either
|
|
|
|
# don't work or work differently.
|
|
|
|
if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
|
|
|
|
is_clang = true
|
|
|
|
}
|
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# =============================================================================
|
|
|
|
# TARGET DEFAULTS
|
|
|
|
# =============================================================================
|
|
|
|
#
|
|
|
|
# Set up the default configuration for every build target of the given type.
|
|
|
|
# The values configured here will be automatically set on the scope of the
|
|
|
|
# corresponding target. Target definitions can add or remove to the settings
|
|
|
|
# here as needed.
|
|
|
|
|
|
|
|
# Holds all configs used for making native executables and libraries, to avoid
|
|
|
|
# duplication in each target below.
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs = [
|
2014-02-12 15:34:25 +04:00
|
|
|
"//build/config:feature_flags",
|
2013-11-21 02:21:03 +04:00
|
|
|
"//build/config/compiler:compiler",
|
2014-07-29 04:20:58 +04:00
|
|
|
"//build/config/compiler:compiler_arm_fpu",
|
2013-11-21 02:21:03 +04:00
|
|
|
"//build/config/compiler:chromium_code",
|
2014-07-11 02:00:37 +04:00
|
|
|
"//build/config/compiler:default_include_dirs",
|
2013-11-21 02:21:03 +04:00
|
|
|
"//build/config/compiler:no_rtti",
|
|
|
|
"//build/config/compiler:runtime_library",
|
|
|
|
]
|
|
|
|
if (is_win) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [
|
2014-04-16 22:29:50 +04:00
|
|
|
"//build/config/win:lean_and_mean",
|
2014-05-28 00:15:20 +04:00
|
|
|
"//build/config/win:nominmax",
|
2014-04-16 22:29:50 +04:00
|
|
|
"//build/config/win:sdk",
|
|
|
|
"//build/config/win:unicode",
|
2014-09-03 01:59:57 +04:00
|
|
|
"//build/config/win:winver",
|
2014-04-16 22:29:50 +04:00
|
|
|
]
|
2014-06-06 03:19:28 +04:00
|
|
|
}
|
2015-07-29 18:50:00 +03:00
|
|
|
if (current_os == "winrt_81" || current_os == "winrt_81_phone" ||
|
|
|
|
current_os == "winrt_10") {
|
|
|
|
_native_compiler_configs += [ "//build/config/win:target_winrt" ]
|
|
|
|
}
|
2014-06-06 03:19:28 +04:00
|
|
|
if (is_posix) {
|
|
|
|
_native_compiler_configs += [
|
|
|
|
"//build/config/gcc:no_exceptions",
|
|
|
|
"//build/config/gcc:symbol_visibility_hidden",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_linux) {
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
_native_compiler_configs += [ "//build/config/linux:sdk" ]
|
2014-02-03 16:04:33 +04:00
|
|
|
} else if (is_mac) {
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
_native_compiler_configs += [ "//build/config/mac:sdk" ]
|
2014-02-03 16:04:33 +04:00
|
|
|
} else if (is_ios) {
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
_native_compiler_configs += [ "//build/config/ios:sdk" ]
|
2014-04-12 05:19:16 +04:00
|
|
|
} else if (is_android) {
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
_native_compiler_configs += [ "//build/config/android:sdk" ]
|
2014-02-03 16:04:33 +04:00
|
|
|
}
|
2014-06-06 03:19:28 +04:00
|
|
|
|
2014-02-03 16:04:33 +04:00
|
|
|
if (is_clang) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [
|
2014-04-18 00:33:19 +04:00
|
|
|
"//build/config/clang:find_bad_constructs",
|
|
|
|
"//build/config/clang:extra_warnings",
|
|
|
|
]
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Optimizations and debug checking.
|
|
|
|
if (is_debug) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [ "//build/config:debug" ]
|
|
|
|
_default_optimization_config = "//build/config/compiler:no_optimize"
|
2013-11-21 02:21:03 +04:00
|
|
|
} else {
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [ "//build/config:release" ]
|
|
|
|
_default_optimization_config = "//build/config/compiler:optimize"
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [ _default_optimization_config ]
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2014-09-12 03:24:27 +04:00
|
|
|
# If it wasn't manually set, set to an appropriate default.
|
|
|
|
if (symbol_level == -1) {
|
|
|
|
# Linux is slowed by having symbols as part of the target binary, whereas
|
|
|
|
# Mac and Windows have them separate, so in Release Linux, default them off.
|
|
|
|
if (is_debug || !is_linux) {
|
|
|
|
symbol_level = 2
|
2015-05-20 10:33:52 +03:00
|
|
|
} else if (is_asan || is_lsan || is_tsan || is_msan) {
|
|
|
|
# Sanitizers require symbols for filename suppressions to work.
|
|
|
|
symbol_level = 1
|
2014-09-12 03:24:27 +04:00
|
|
|
} else {
|
|
|
|
symbol_level = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# Symbol setup.
|
2014-08-26 04:24:59 +04:00
|
|
|
if (symbol_level == 2) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_default_symbols_config = "//build/config/compiler:symbols"
|
2013-11-21 02:21:03 +04:00
|
|
|
} else if (symbol_level == 1) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_default_symbols_config = "//build/config/compiler:minimal_symbols"
|
2013-11-21 02:21:03 +04:00
|
|
|
} else if (symbol_level == 0) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_default_symbols_config = "//build/config/compiler:no_symbols"
|
2013-11-21 02:21:03 +04:00
|
|
|
} else {
|
|
|
|
assert(false, "Bad value for symbol_level.")
|
|
|
|
}
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [ _default_symbols_config ]
|
2013-11-21 02:21:03 +04:00
|
|
|
|
|
|
|
# Windows linker setup for EXEs and DLLs.
|
|
|
|
if (is_win) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_windows_linker_configs = [
|
2015-03-20 20:08:20 +03:00
|
|
|
"//build/config/win:default_incremental_linking",
|
2013-11-21 02:21:03 +04:00
|
|
|
"//build/config/win:sdk_link",
|
|
|
|
"//build/config/win:common_linker_setup",
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# Default to console-mode apps. Most of our targets are tests and such
|
|
|
|
# that shouldn't use the windows subsystem.
|
|
|
|
"//build/config/win:console",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2014-09-10 03:18:07 +04:00
|
|
|
# Executable defaults.
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
_executable_configs =
|
|
|
|
_native_compiler_configs + [ "//build/config:default_libs" ]
|
2014-08-29 03:35:28 +04:00
|
|
|
if (is_win) {
|
|
|
|
_executable_configs += _windows_linker_configs
|
|
|
|
} else if (is_mac) {
|
|
|
|
_executable_configs += [
|
|
|
|
"//build/config/mac:mac_dynamic_flags",
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
"//build/config/mac:mac_executable_flags",
|
|
|
|
]
|
2014-08-29 03:35:28 +04:00
|
|
|
} else if (is_linux || is_android) {
|
|
|
|
_executable_configs += [ "//build/config/gcc:executable_ldconfig" ]
|
2014-11-03 18:37:25 +03:00
|
|
|
if (is_android) {
|
|
|
|
_executable_configs += [ "//build/config/android:executable_config" ]
|
|
|
|
}
|
2014-08-29 03:35:28 +04:00
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
set_defaults("executable") {
|
2014-08-29 03:35:28 +04:00
|
|
|
configs = _executable_configs
|
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2014-08-29 03:35:28 +04:00
|
|
|
# Static library defaults.
|
2013-11-21 02:21:03 +04:00
|
|
|
set_defaults("static_library") {
|
2014-05-16 23:31:36 +04:00
|
|
|
configs = _native_compiler_configs
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
|
2014-08-29 03:35:28 +04:00
|
|
|
# Shared library defaults (also for components in component mode).
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
_shared_library_configs =
|
|
|
|
_native_compiler_configs + [ "//build/config:default_libs" ]
|
2014-08-29 03:35:28 +04:00
|
|
|
if (is_win) {
|
|
|
|
_shared_library_configs += _windows_linker_configs
|
|
|
|
} else if (is_mac) {
|
|
|
|
_shared_library_configs += [ "//build/config/mac:mac_dynamic_flags" ]
|
2015-02-19 00:37:16 +03:00
|
|
|
} else if (is_android) {
|
|
|
|
# Strip native JNI exports from shared libraries by default. Binaries that
|
|
|
|
# want this can remove this config.
|
|
|
|
_shared_library_configs +=
|
|
|
|
[ "//build/config/android:hide_native_jni_exports" ]
|
2014-08-29 03:35:28 +04:00
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
set_defaults("shared_library") {
|
2014-08-29 03:35:28 +04:00
|
|
|
configs = _shared_library_configs
|
|
|
|
}
|
|
|
|
if (is_component_build) {
|
|
|
|
set_defaults("component") {
|
2014-09-22 23:42:37 +04:00
|
|
|
configs = _shared_library_configs
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-29 03:35:28 +04:00
|
|
|
# Source set defaults (also for components in non-component mode).
|
2013-11-21 02:21:03 +04:00
|
|
|
set_defaults("source_set") {
|
2014-05-16 23:31:36 +04:00
|
|
|
configs = _native_compiler_configs
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
2014-08-29 03:35:28 +04:00
|
|
|
if (!is_component_build) {
|
|
|
|
set_defaults("component") {
|
|
|
|
configs = _native_compiler_configs
|
|
|
|
}
|
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2014-09-10 03:18:07 +04:00
|
|
|
# Test defaults.
|
|
|
|
set_defaults("test") {
|
|
|
|
if (is_android) {
|
|
|
|
configs = _shared_library_configs
|
|
|
|
} else {
|
|
|
|
configs = _executable_configs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# ==============================================================================
|
|
|
|
# TOOLCHAIN SETUP
|
|
|
|
# ==============================================================================
|
|
|
|
#
|
|
|
|
# Here we set the default toolchain, as well as the variable host_toolchain
|
|
|
|
# which will identify the toolchain corresponding to the local system when
|
|
|
|
# doing cross-compiles. When not cross-compiling, this will be the same as the
|
|
|
|
# default toolchain.
|
|
|
|
|
|
|
|
if (is_win) {
|
Rework win_toolchains a bit and copy the vs runtime DLLs as needed.
In order to run both the visual studio tools and the binaries built
by them (and ninja), we need to ensure that the VS runtime DLLs
are available in the path.
In the GYP build, we accomplish this by copying them into the
Debug and Debug_x64 dirs as appropriate inside the gyp_chromium
script.
In the pure-GN build, then, things would be broken, so we need to
modify the GN build to do the copy as well, or we need to inject
a step somewhere that happens after GN runs but before Ninja tries
to run (since none of the toolchain binaries will work).
This patch accomplishes this by calling out to vs_toolchain.py to
copy the DLLs as neede when the toolchain is defined. This is somewhat
less than ideal (makes 'gn gen' slower) but seems better than forcing
devs to have to run an additional command.
In addition, the GYP build writes targets into Debug and Debug_x64
concurrently. This doesn't really carry over into GN correctly, and
we probably only ever want to write targets into Debug and Debug/64
(or some such).
However, the way the toolchains are currently implemented, it's not
clear if this really works and the interplay between 32-bit and 64-bit
is weird (we apparently normally "force" 32-bit even if we set cpu_arch
to 64-bit, and require you to specify force_win64). To work around this
and make sure that we copy the right DLLs for the right arch into the
outer Debug/ directory, this patch temporarily disables the cross-arch
part of the build, forcing the host_toolchain to match the target_toolchain.
This likely means that 'cpu_arch="x86"' works (the default), but the 'host'
binaries like image_diff and mksnapshot will be compiled in 32-bit mode,
not 64-bit mode. 'cpu_arch="x64" force_win64=true' should also work, and
produce all-64-bit binaries. 'cpu_arch="x64"' does not work at all and
won't until we can clean up the above stuff.
R=scottmg@chromium.org, brettw@chromium.org
BUG=430661
Review URL: https://codereview.chromium.org/722723004
Cr-Original-Commit-Position: refs/heads/master@{#304310}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0b95195e49489b7a4d87048d2ce4b747173a5b8a
2014-11-15 03:09:14 +03:00
|
|
|
# On windows we use the same toolchain for host and target by default.
|
2015-06-03 11:11:44 +03:00
|
|
|
if (is_clang) {
|
|
|
|
host_toolchain = "//build/toolchain/win:clang_$current_cpu"
|
|
|
|
} else {
|
|
|
|
host_toolchain = "//build/toolchain/win:$current_cpu"
|
2013-11-23 03:30:28 +04:00
|
|
|
}
|
2015-07-29 18:50:00 +03:00
|
|
|
|
|
|
|
if (current_os == "win") {
|
|
|
|
set_default_toolchain("$host_toolchain")
|
|
|
|
} else if (current_cpu == "x64") { # WinRT x64
|
|
|
|
set_default_toolchain("//build/toolchain/win:winrt_x64")
|
|
|
|
} else if (current_cpu == "x86") { # WinRT x86
|
|
|
|
set_default_toolchain("//build/toolchain/win:winrt_x86")
|
|
|
|
}
|
2013-12-28 10:49:32 +04:00
|
|
|
} else if (is_android) {
|
2015-05-15 00:38:47 +03:00
|
|
|
if (host_os == "linux") {
|
|
|
|
# Use clang for the x86/64 Linux host builds.
|
|
|
|
if (host_cpu == "x86" || host_cpu == "x64") {
|
|
|
|
host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
|
|
|
|
} else {
|
|
|
|
host_toolchain = "//build/toolchain/linux:$host_cpu"
|
|
|
|
}
|
|
|
|
} else if (host_os == "mac") {
|
|
|
|
host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
|
2014-08-05 04:13:11 +04:00
|
|
|
} else {
|
2015-05-15 00:38:47 +03:00
|
|
|
assert(false, "Unknown host for android cross compile")
|
2014-08-05 04:13:11 +04:00
|
|
|
}
|
2015-08-07 02:18:46 +03:00
|
|
|
if (is_clang) {
|
|
|
|
set_default_toolchain("//build/toolchain/android:clang_$current_cpu")
|
|
|
|
} else {
|
|
|
|
set_default_toolchain("//build/toolchain/android:$current_cpu")
|
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
} else if (is_linux) {
|
2014-07-12 00:27:10 +04:00
|
|
|
if (is_clang) {
|
2015-02-20 05:55:19 +03:00
|
|
|
host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
|
|
|
|
set_default_toolchain("//build/toolchain/linux:clang_$current_cpu")
|
2014-07-12 00:27:10 +04:00
|
|
|
} else {
|
2015-02-20 05:55:19 +03:00
|
|
|
host_toolchain = "//build/toolchain/linux:$host_cpu"
|
|
|
|
set_default_toolchain("//build/toolchain/linux:$current_cpu")
|
2014-07-12 00:27:10 +04:00
|
|
|
}
|
2014-09-26 05:28:02 +04:00
|
|
|
if (is_chromeos && cros_use_custom_toolchain) {
|
|
|
|
set_default_toolchain("//build/toolchain/cros:target")
|
|
|
|
}
|
2014-02-12 15:27:00 +04:00
|
|
|
} else if (is_mac) {
|
2015-05-15 00:38:47 +03:00
|
|
|
host_toolchain = "//build/toolchain/mac:clang_x64"
|
2013-11-21 02:21:03 +04:00
|
|
|
set_default_toolchain(host_toolchain)
|
2014-02-12 15:27:00 +04:00
|
|
|
} else if (is_ios) {
|
2015-05-15 00:38:47 +03:00
|
|
|
host_toolchain = "//build/toolchain/mac:clang_x64"
|
2015-08-07 08:23:01 +03:00
|
|
|
set_default_toolchain("//build/toolchain/mac:ios_clang_arm")
|
2015-02-26 06:30:58 +03:00
|
|
|
} else if (is_nacl) {
|
|
|
|
# TODO(GYP): This will need to change when we get NaCl working
|
|
|
|
# on multiple platforms, but this whole block of code (how we define
|
2015-03-27 02:35:35 +03:00
|
|
|
# host_toolchain) needs to be reworked regardless to key off of host_os
|
|
|
|
# and host_cpu rather than the is_* variables.
|
2015-02-26 06:30:58 +03:00
|
|
|
host_toolchain = "//build/toolchain/linux:clang_x64"
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
2014-08-29 03:35:28 +04:00
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# COMPONENT SETUP
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
if (is_component_build) {
|
2015-08-07 00:38:58 +03:00
|
|
|
_component_mode = "shared_library"
|
2014-08-29 03:35:28 +04:00
|
|
|
} else {
|
2015-08-07 00:38:58 +03:00
|
|
|
_component_mode = "source_set"
|
2014-08-29 03:35:28 +04:00
|
|
|
}
|
|
|
|
template("component") {
|
2015-08-07 00:38:58 +03:00
|
|
|
target(_component_mode, target_name) {
|
2015-08-04 22:50:33 +03:00
|
|
|
forward_variables_from(invoker, "*")
|
|
|
|
|
|
|
|
# All shared libraries must have the sanitizer deps to properly link in
|
|
|
|
# asan mode (this target will be empty in other cases).
|
|
|
|
if (!defined(deps)) {
|
|
|
|
deps = []
|
2014-08-29 03:35:28 +04:00
|
|
|
}
|
2015-08-04 22:50:33 +03:00
|
|
|
deps += [ "//build/config/sanitizers:deps" ]
|
2014-08-29 03:35:28 +04:00
|
|
|
}
|
|
|
|
}
|