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.
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
# BUILD FLAGS
|
|
|
|
# =============================================================================
|
|
|
|
#
|
|
|
|
# This block lists input arguments to the build, along with their default
|
|
|
|
# values. GN requires listing them explicitly so it can validate input and have
|
|
|
|
# a central place to manage the build flags.
|
|
|
|
#
|
|
|
|
# If a value is specified on the command line, it will overwrite the defaults
|
|
|
|
# given here, otherwise the default will be injected into the root scope.
|
|
|
|
#
|
|
|
|
# KEEP IN ALPHABETICAL ORDER and write a good description for everything.
|
|
|
|
# Use "is_*" names for intrinsic platform descriptions and build modes, and
|
|
|
|
# "use_*" names for optional features libraries, and configurations.
|
|
|
|
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
|
|
|
|
# Debug build.
|
|
|
|
is_debug = true
|
|
|
|
|
|
|
|
# Set to true when compiling with the Clang compiler. Typically this is used
|
|
|
|
# to configure warnings.
|
2014-07-20 23:08:58 +04:00
|
|
|
is_clang = (os == "mac" || os == "ios" || os == "linux")
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2013-11-23 02:13:47 +04:00
|
|
|
# Forces a 64-bit build on Windows. Does nothing on other platforms. Normally
|
|
|
|
# we build 32-bit on Windows regardless of the current host OS bit depth.
|
|
|
|
# Setting this flag will override this logic and generate 64-bit toolchains.
|
|
|
|
#
|
|
|
|
# Normally this would get set automatically when you specify a target using
|
|
|
|
# the 64-bit toolchain. You can also set this on the command line to convert
|
|
|
|
# the default toolchain to 64-bit.
|
|
|
|
force_win64 = false
|
|
|
|
|
2013-12-16 21:58:16 +04:00
|
|
|
# Selects the desired build flavor. Official builds get additional
|
|
|
|
# processing to prepare for release. Normally you will want to develop and
|
|
|
|
# test with this flag off.
|
|
|
|
is_official_build = false
|
|
|
|
|
|
|
|
# Select the desired branding flavor. False means normal Chromium branding,
|
|
|
|
# true means official Google Chrome branding (requires extra Google-internal
|
|
|
|
# resources).
|
|
|
|
is_chrome_branded = false
|
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
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2014-10-17 22:47:14 +04:00
|
|
|
|
|
|
|
# TODO(cjhopman): Make target_arch work for all platforms.
|
|
|
|
|
|
|
|
# Architecture of the target device. For Android builds, this will be equal to
|
|
|
|
# the cpu_arch of the default toolchain. When checking the CPU architecture
|
|
|
|
# for source files and build dependencies you should almost alway use cpu_arch
|
|
|
|
# instead. cpu_arch is the architecture of the current toolchain and allows
|
|
|
|
# cross-compiles (compiling the same target for multiple toolchains in the
|
|
|
|
# same build) to work.
|
|
|
|
target_arch = "arm"
|
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
|
|
|
|
# aix or one of the BSDs. If you need to check these, just check the os value
|
|
|
|
# directly.
|
|
|
|
|
|
|
|
if (os == "win") {
|
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = false
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = false
|
|
|
|
is_win = true
|
|
|
|
} else if (os == "mac") {
|
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = false
|
|
|
|
is_mac = true
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
|
|
|
} else if (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
|
|
|
|
} else if (os == "chromeos") {
|
|
|
|
is_android = false
|
|
|
|
is_chromeos = true
|
|
|
|
is_ios = false
|
|
|
|
is_linux = true
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
|
|
|
} else if (os == "nacl") {
|
|
|
|
# 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.
|
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = false
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = true
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
|
|
|
} else if (os == "ios") {
|
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = true
|
|
|
|
is_linux = false
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
|
|
|
} else if (os == "linux") {
|
|
|
|
is_android = false
|
|
|
|
is_chromeos = false
|
|
|
|
is_ios = false
|
|
|
|
is_linux = true
|
|
|
|
is_mac = false
|
|
|
|
is_nacl = false
|
|
|
|
is_posix = true
|
|
|
|
is_win = false
|
|
|
|
}
|
|
|
|
|
2014-05-31 08:34:50 +04:00
|
|
|
is_desktop_linux = is_linux && !is_chromeos
|
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# =============================================================================
|
|
|
|
# CPU ARCHITECTURE
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
if (is_win) {
|
2013-11-23 02:13:47 +04:00
|
|
|
# Always use 32-bit on Windows, even when compiling on a 64-bit host OS,
|
|
|
|
# unless the override flag is specified.
|
|
|
|
if (force_win64) {
|
2013-11-23 02:38:39 +04:00
|
|
|
cpu_arch = "x64"
|
2013-11-23 02:13:47 +04:00
|
|
|
} else {
|
2013-11-23 02:38:39 +04:00
|
|
|
cpu_arch = "x86"
|
2013-11-23 02:13:47 +04:00
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
|
|
|
|
2014-10-17 22:47:14 +04:00
|
|
|
if (is_android) {
|
|
|
|
# TODO(cjhopman): enable this assert once bots are updated to not set
|
|
|
|
# cpu_arch.
|
|
|
|
#assert(cpu_arch == build_cpu_arch, "Android device target architecture should
|
|
|
|
# be set with 'target_arch', not 'cpu_arch'")
|
|
|
|
cpu_arch = target_arch
|
|
|
|
}
|
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
# =============================================================================
|
|
|
|
# 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/*",
|
|
|
|
"*.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) {
|
2014-05-16 23:31:36 +04: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
|
|
|
}
|
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:default_warnings",
|
|
|
|
"//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
|
|
|
}
|
|
|
|
if (is_posix) {
|
|
|
|
_native_compiler_configs += [
|
|
|
|
"//build/config/gcc:no_exceptions",
|
|
|
|
"//build/config/gcc:symbol_visibility_hidden",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_linux) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [ "//build/config/linux:sdk", ]
|
2014-02-03 16:04:33 +04:00
|
|
|
} else if (is_mac) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [ "//build/config/mac:sdk", ]
|
2014-02-03 16:04:33 +04:00
|
|
|
} else if (is_ios) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_native_compiler_configs += [ "//build/config/ios:sdk", ]
|
2014-04-12 05:19:16 +04:00
|
|
|
} else if (is_android) {
|
2014-05-16 23:31:36 +04: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
|
|
|
|
} 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) {
|
|
|
|
if (is_debug) {
|
2014-05-16 23:31:36 +04:00
|
|
|
_default_incremental_linking_config =
|
2013-11-21 02:21:03 +04:00
|
|
|
"//build/config/win:incremental_linking"
|
|
|
|
} else {
|
2014-05-16 23:31:36 +04:00
|
|
|
_default_incremental_linking_config =
|
2013-11-21 02:21:03 +04:00
|
|
|
"//build/config/win:no_incremental_linking"
|
|
|
|
}
|
2014-05-16 23:31:36 +04:00
|
|
|
_windows_linker_configs = [
|
|
|
|
_default_incremental_linking_config,
|
2013-11-21 02:21:03 +04:00
|
|
|
"//build/config/win:sdk_link",
|
|
|
|
"//build/config/win:common_linker_setup",
|
|
|
|
# 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.
|
2014-08-29 03:35:28 +04:00
|
|
|
_executable_configs = _native_compiler_configs + [
|
|
|
|
"//build/config:default_libs",
|
|
|
|
]
|
|
|
|
if (is_win) {
|
|
|
|
_executable_configs += _windows_linker_configs
|
|
|
|
} else if (is_mac) {
|
|
|
|
_executable_configs += [
|
|
|
|
"//build/config/mac:mac_dynamic_flags",
|
|
|
|
"//build/config/mac:mac_executable_flags" ]
|
|
|
|
} else if (is_linux || is_android) {
|
|
|
|
_executable_configs += [ "//build/config/gcc:executable_ldconfig" ]
|
|
|
|
}
|
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).
|
|
|
|
_shared_library_configs = _native_compiler_configs + [
|
|
|
|
"//build/config:default_libs",
|
|
|
|
]
|
|
|
|
if (is_win) {
|
|
|
|
_shared_library_configs += _windows_linker_configs
|
|
|
|
} else if (is_mac) {
|
|
|
|
_shared_library_configs += [ "//build/config/mac:mac_dynamic_flags" ]
|
|
|
|
}
|
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) {
|
2013-12-28 10:49:32 +04:00
|
|
|
# TODO(brettw) name the toolchains the same as cpu_arch as with Linux below
|
|
|
|
# to eliminate these conditionals.
|
2013-11-23 03:30:28 +04:00
|
|
|
if (build_cpu_arch == "x64") {
|
2013-11-23 02:13:47 +04:00
|
|
|
host_toolchain = "//build/toolchain/win:64"
|
2013-11-23 03:30:28 +04:00
|
|
|
} else if (build_cpu_arch == "x86") {
|
2013-11-23 02:13:47 +04:00
|
|
|
host_toolchain = "//build/toolchain/win:32"
|
|
|
|
}
|
2013-11-23 03:30:28 +04:00
|
|
|
|
|
|
|
if (cpu_arch == "x64") {
|
|
|
|
set_default_toolchain("//build/toolchain/win:64")
|
|
|
|
} else if (cpu_arch == "x86") {
|
|
|
|
set_default_toolchain("//build/toolchain/win:32")
|
|
|
|
}
|
2013-12-28 10:49:32 +04:00
|
|
|
} else if (is_android) {
|
2014-07-12 00:27:10 +04:00
|
|
|
# Use clang for the x86/64 Linux host builds.
|
2014-08-05 04:13:11 +04:00
|
|
|
if (build_cpu_arch == "x86" || build_cpu_arch == "x64") {
|
|
|
|
host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch"
|
|
|
|
} else {
|
2014-07-12 00:27:10 +04:00
|
|
|
host_toolchain = "//build/toolchain/linux:$build_cpu_arch"
|
2014-08-05 04:13:11 +04:00
|
|
|
}
|
2013-12-28 10:49:32 +04:00
|
|
|
set_default_toolchain("//build/toolchain/android:$cpu_arch")
|
2013-11-21 02:21:03 +04:00
|
|
|
} else if (is_linux) {
|
2014-07-12 00:27:10 +04:00
|
|
|
if (is_clang) {
|
|
|
|
host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch"
|
|
|
|
set_default_toolchain("//build/toolchain/linux:clang_$cpu_arch")
|
|
|
|
} else {
|
|
|
|
host_toolchain = "//build/toolchain/linux:$build_cpu_arch"
|
|
|
|
set_default_toolchain("//build/toolchain/linux:$cpu_arch")
|
|
|
|
}
|
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) {
|
2013-11-21 02:21:03 +04:00
|
|
|
host_toolchain = "//build/toolchain/mac:clang"
|
|
|
|
set_default_toolchain(host_toolchain)
|
2014-02-12 15:27:00 +04:00
|
|
|
} else if (is_ios) {
|
|
|
|
host_toolchain = "//build/toolchain/mac:host_clang"
|
|
|
|
set_default_toolchain("//build/toolchain/mac:clang")
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
2014-08-29 03:35:28 +04:00
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# COMPONENT SETUP
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
# TODO(brettw) erase this once the built-in "component" function is removed.
|
|
|
|
if (is_component_build) {
|
|
|
|
component_mode = "shared_library"
|
|
|
|
} else {
|
|
|
|
component_mode = "source_set"
|
|
|
|
}
|
|
|
|
|
|
|
|
template("component") {
|
|
|
|
if (is_component_build) {
|
|
|
|
shared_library(target_name) {
|
|
|
|
# Configs will always be defined since we set_defaults for a component
|
|
|
|
# above. We want to use those rather than whatever came with the nested
|
|
|
|
# shared/static library inside the component.
|
|
|
|
configs = [] # Prevent list overwriting warning.
|
|
|
|
configs = invoker.configs
|
|
|
|
|
2014-09-04 10:01:47 +04:00
|
|
|
# The sources assignment filter will have already been applied when the
|
|
|
|
# code was originally executed. We don't want to apply it again, since
|
|
|
|
# the original target may have override it for some assignments.
|
|
|
|
set_sources_assignment_filter([])
|
|
|
|
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoker.all_dependent_configs }
|
2014-09-07 04:27:41 +04:00
|
|
|
if (defined(invoker.allow_circular_includes_from)) { allow_circular_includes_from = invoker.allow_circular_includes_from }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.cflags)) { cflags = invoker.cflags }
|
|
|
|
if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c }
|
|
|
|
if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc }
|
|
|
|
if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc }
|
|
|
|
if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc }
|
2014-09-07 04:27:41 +04:00
|
|
|
if (defined(invoker.check_includes)) { check_includes = invoker.check_includes }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.data)) { data = invoker.data }
|
|
|
|
if (defined(invoker.datadeps)) { datadeps = invoker.datadeps }
|
|
|
|
if (defined(invoker.defines)) { defines = invoker.defines }
|
2014-10-29 03:52:55 +03:00
|
|
|
# All shared libraries must have the sanitizer deps to properly link in
|
|
|
|
# asan mode (this target will be empty in other cases).
|
|
|
|
if (defined(invoker.deps)) {
|
|
|
|
deps = invoker.deps + [ "//build/config/sanitizers:deps" ]
|
|
|
|
} else {
|
|
|
|
deps = [ "//build/config/sanitizers:deps" ]
|
|
|
|
}
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = invoker.direct_dependent_configs }
|
|
|
|
if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_configs_from = invoker.forward_dependent_configs_from }
|
|
|
|
if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs }
|
|
|
|
if (defined(invoker.ldflags)) { ldflags = invoker.ldflags }
|
|
|
|
if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs }
|
|
|
|
if (defined(invoker.libs)) { libs = invoker.libs }
|
|
|
|
if (defined(invoker.output_extension)) { output_extension = invoker.output_extension }
|
|
|
|
if (defined(invoker.output_name)) { output_name = invoker.output_name }
|
|
|
|
if (defined(invoker.public)) { public = invoker.public }
|
2014-09-20 01:24:40 +04:00
|
|
|
if (defined(invoker.public_configs)) { public_configs = invoker.public_configs }
|
|
|
|
if (defined(invoker.public_deps)) { public_deps = invoker.public_deps }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.sources)) { sources = invoker.sources }
|
2014-09-07 04:27:41 +04:00
|
|
|
if (defined(invoker.testonly)) { testonly = invoker.testonly }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.visibility)) { visibility = invoker.visibility }
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
source_set(target_name) {
|
|
|
|
# See above.
|
|
|
|
configs = [] # Prevent list overwriting warning.
|
|
|
|
configs = invoker.configs
|
|
|
|
|
2014-09-04 10:01:47 +04:00
|
|
|
# See above call.
|
|
|
|
set_sources_assignment_filter([])
|
|
|
|
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoker.all_dependent_configs }
|
2014-09-07 04:27:41 +04:00
|
|
|
if (defined(invoker.allow_circular_includes_from)) { allow_circular_includes_from = invoker.allow_circular_includes_from }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.cflags)) { cflags = invoker.cflags }
|
|
|
|
if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c }
|
|
|
|
if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc }
|
|
|
|
if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc }
|
|
|
|
if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc }
|
2014-09-07 04:27:41 +04:00
|
|
|
if (defined(invoker.check_includes)) { check_includes = invoker.check_includes }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.data)) { data = invoker.data }
|
|
|
|
if (defined(invoker.datadeps)) { datadeps = invoker.datadeps }
|
|
|
|
if (defined(invoker.defines)) { defines = invoker.defines }
|
|
|
|
if (defined(invoker.deps)) { deps = invoker.deps }
|
|
|
|
if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = invoker.direct_dependent_configs }
|
|
|
|
if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_configs_from = invoker.forward_dependent_configs_from }
|
|
|
|
if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs }
|
|
|
|
if (defined(invoker.ldflags)) { ldflags = invoker.ldflags }
|
|
|
|
if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs }
|
|
|
|
if (defined(invoker.libs)) { libs = invoker.libs }
|
|
|
|
if (defined(invoker.output_extension)) { output_extension = invoker.output_extension }
|
|
|
|
if (defined(invoker.output_name)) { output_name = invoker.output_name }
|
|
|
|
if (defined(invoker.public)) { public = invoker.public }
|
2014-09-20 01:24:40 +04:00
|
|
|
if (defined(invoker.public_configs)) { public_configs = invoker.public_configs }
|
|
|
|
if (defined(invoker.public_deps)) { public_deps = invoker.public_deps }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.sources)) { sources = invoker.sources }
|
2014-09-07 04:27:41 +04:00
|
|
|
if (defined(invoker.testonly)) { testonly = invoker.testonly }
|
2014-08-29 03:35:28 +04:00
|
|
|
if (defined(invoker.visibility)) { visibility = invoker.visibility }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# TEST SETUP
|
|
|
|
# ==============================================================================
|
|
|
|
|
2014-09-10 03:18:07 +04:00
|
|
|
# Define a test as an executable (or shared_library on Android) with the
|
|
|
|
# "testonly" flag set.
|
2014-08-29 03:35:28 +04:00
|
|
|
template("test") {
|
2014-09-10 03:18:07 +04:00
|
|
|
if (is_android) {
|
|
|
|
shared_library(target_name) {
|
|
|
|
# Configs will always be defined since we set_defaults for a component
|
|
|
|
# above. We want to use those rather than whatever came with the nested
|
|
|
|
# shared/static library inside the component.
|
|
|
|
configs = [] # Prevent list overwriting warning.
|
|
|
|
configs = invoker.configs
|
|
|
|
|
|
|
|
# See above call.
|
|
|
|
set_sources_assignment_filter([])
|
|
|
|
|
|
|
|
testonly = true
|
|
|
|
|
|
|
|
if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoker.all_dependent_configs }
|
|
|
|
if (defined(invoker.allow_circular_includes_from)) { allow_circular_includes_from = invoker.allow_circular_includes_from }
|
|
|
|
if (defined(invoker.cflags)) { cflags = invoker.cflags }
|
|
|
|
if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c }
|
|
|
|
if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc }
|
|
|
|
if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc }
|
|
|
|
if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc }
|
|
|
|
if (defined(invoker.check_includes)) { check_includes = invoker.check_includes }
|
|
|
|
if (defined(invoker.data)) { data = invoker.data }
|
|
|
|
if (defined(invoker.datadeps)) { datadeps = invoker.datadeps }
|
|
|
|
if (defined(invoker.defines)) { defines = invoker.defines }
|
|
|
|
if (defined(invoker.deps)) { deps = invoker.deps }
|
|
|
|
if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = invoker.direct_dependent_configs }
|
|
|
|
if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_configs_from = invoker.forward_dependent_configs_from }
|
|
|
|
if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs }
|
|
|
|
if (defined(invoker.ldflags)) { ldflags = invoker.ldflags }
|
|
|
|
if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs }
|
|
|
|
if (defined(invoker.libs)) { libs = invoker.libs }
|
|
|
|
if (defined(invoker.output_extension)) { output_extension = invoker.output_extension }
|
|
|
|
if (defined(invoker.output_name)) { output_name = invoker.output_name }
|
|
|
|
if (defined(invoker.public)) { public = invoker.public }
|
2014-09-20 01:24:40 +04:00
|
|
|
if (defined(invoker.public_configs)) { public_configs = invoker.public_configs }
|
|
|
|
if (defined(invoker.public_deps)) { public_deps = invoker.public_deps }
|
2014-09-10 03:18:07 +04:00
|
|
|
if (defined(invoker.sources)) { sources = invoker.sources }
|
|
|
|
if (defined(invoker.visibility)) { visibility = invoker.visibility }
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
executable(target_name) {
|
|
|
|
# See above.
|
|
|
|
configs = [] # Prevent list overwriting warning.
|
|
|
|
configs = invoker.configs
|
|
|
|
|
|
|
|
# See above call.
|
|
|
|
set_sources_assignment_filter([])
|
|
|
|
|
|
|
|
testonly = true
|
|
|
|
|
|
|
|
if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoker.all_dependent_configs }
|
|
|
|
if (defined(invoker.allow_circular_includes_from)) { allow_circular_includes_from = invoker.allow_circular_includes_from }
|
|
|
|
if (defined(invoker.cflags)) { cflags = invoker.cflags }
|
|
|
|
if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c }
|
|
|
|
if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc }
|
|
|
|
if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc }
|
|
|
|
if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc }
|
|
|
|
if (defined(invoker.check_includes)) { check_includes = invoker.check_includes }
|
|
|
|
if (defined(invoker.data)) { data = invoker.data }
|
|
|
|
if (defined(invoker.datadeps)) { datadeps = invoker.datadeps }
|
|
|
|
if (defined(invoker.defines)) { defines = invoker.defines }
|
2014-10-29 03:52:55 +03:00
|
|
|
# All shared libraries must have the sanitizer deps to properly link in
|
|
|
|
# asan mode (this target will be empty in other cases).
|
|
|
|
if (defined(invoker.deps)) {
|
|
|
|
deps = invoker.deps + [ "//build/config/sanitizers:deps" ]
|
|
|
|
} else {
|
|
|
|
deps = [ "//build/config/sanitizers:deps" ]
|
|
|
|
}
|
2014-09-10 03:18:07 +04:00
|
|
|
if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = invoker.direct_dependent_configs }
|
|
|
|
if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_configs_from = invoker.forward_dependent_configs_from }
|
|
|
|
if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs }
|
|
|
|
if (defined(invoker.ldflags)) { ldflags = invoker.ldflags }
|
|
|
|
if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs }
|
|
|
|
if (defined(invoker.libs)) { libs = invoker.libs }
|
|
|
|
if (defined(invoker.output_extension)) { output_extension = invoker.output_extension }
|
|
|
|
if (defined(invoker.output_name)) { output_name = invoker.output_name }
|
|
|
|
if (defined(invoker.public)) { public = invoker.public }
|
2014-09-20 01:24:40 +04:00
|
|
|
if (defined(invoker.public_configs)) { public_configs = invoker.public_configs }
|
|
|
|
if (defined(invoker.public_deps)) { public_deps = invoker.public_deps }
|
2014-09-10 03:18:07 +04:00
|
|
|
if (defined(invoker.sources)) { sources = invoker.sources }
|
|
|
|
if (defined(invoker.visibility)) { visibility = invoker.visibility }
|
|
|
|
}
|
2014-08-29 03:35:28 +04:00
|
|
|
}
|
|
|
|
}
|