Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3166)

Unified Diff: build/config/BUILDCONFIG.gn

Issue 2350583002: Starting work on full GN build (Closed)
Patch Set: Fixes for Fuchsia and Flutter. Cleanup. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/BUILD.gn ('k') | build/config/allocator.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/BUILDCONFIG.gn
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index e22b29aa69009850db1501e5b425e19fc8cbe36a..09527af891a44b77658db88c90d24c21840ab941 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -38,17 +38,8 @@ if (target_os == "") {
target_os = host_os
}
-if (target_cpu == "") {
- if (target_os == "android") {
- # 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"
- } else {
- target_cpu = host_cpu
- }
-}
+assert(host_cpu != "")
+assert(target_cpu != "")
if (current_cpu == "") {
current_cpu = target_cpu
@@ -110,28 +101,23 @@ if (current_os == "") {
# - 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.
-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.
- # -1 means auto-set (off in release, regular in debug).
- symbol_level = -1
-
- # Component build.
- is_component_build = false
+# There is no component build for the Dart VM, but build files in some
+# dependencies check this.
+is_component_build = false
+declare_args() {
# Debug build.
is_debug = true
- # Whether we're a traditional desktop unix.
- is_desktop_linux = current_os == "linux" && current_os != "chromeos"
+ # Release build.
+ is_release = false
+
+ # Product build.
+ is_product = false
# Set to true when compiling with the Clang compiler. Typically this is used
# to configure warnings.
- is_clang = current_os == "mac" || current_os == "ios" ||
- current_os == "linux" || current_os == "chromeos"
+ is_clang = current_os == "mac" || current_os == "linux"
# Compile for Address Sanitizer to find memory bugs.
is_asan = false
@@ -144,15 +130,6 @@ declare_args() {
# Compile for Thread Sanitizer to find threading bugs.
is_tsan = false
-
- if (current_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
- }
-
- # DON'T ADD MORE FLAGS HERE. Read the comment above.
}
# =============================================================================
@@ -176,7 +153,6 @@ declare_args() {
if (current_os == "win") {
is_android = false
is_chromeos = false
- is_fnl = false
is_ios = false
is_linux = false
is_mac = false
@@ -186,7 +162,6 @@ if (current_os == "win") {
} else if (current_os == "mac") {
is_android = false
is_chromeos = false
- is_fnl = false
is_ios = false
is_linux = false
is_mac = true
@@ -196,60 +171,15 @@ if (current_os == "win") {
} else if (current_os == "android") {
is_android = true
is_chromeos = false
- is_fnl = false
is_ios = false
is_linux = false
is_mac = false
is_nacl = false
is_posix = true
is_win = false
-} else if (current_os == "chromeos") {
- is_android = false
- is_chromeos = true
- is_fnl = false
- is_ios = false
- is_linux = true
- is_mac = false
- is_nacl = false
- is_posix = true
- is_win = false
-} 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.
- is_android = false
- is_chromeos = false
- is_fnl = false
- is_ios = false
- is_linux = false
- is_mac = false
- is_nacl = true
- is_posix = true
- is_win = false
-} else if (current_os == "ios") {
- is_android = false
- is_chromeos = false
- is_fnl = false
- is_ios = true
- is_linux = false
- is_mac = false
- is_nacl = false
- is_posix = true
- is_win = false
} else if (current_os == "linux") {
is_android = false
is_chromeos = false
- is_fnl = false
- is_ios = false
- is_linux = true
- is_mac = false
- is_nacl = false
- is_posix = true
- is_win = false
-} else if (current_os == "fnl") {
- is_android = false
- is_chromeos = false
- is_fnl = true
is_ios = false
is_linux = true
is_mac = false
@@ -259,119 +189,6 @@ if (current_os == "win") {
}
# =============================================================================
-# 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).
-
-# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
-# below.
-sources_assignment_filter = []
-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/*",
- "*.def",
- "*.rc",
- ]
-}
-if (!is_mac) {
- 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/*",
- ]
-}
-if (!is_ios) {
- sources_assignment_filter += [
- "*_ios.h",
- "*_ios.cc",
- "*_ios.mm",
- "*_ios_unittest.h",
- "*_ios_unittest.cc",
- "*_ios_unittest.mm",
- "*\bios/*",
- ]
-}
-if (!is_mac && !is_ios) {
- sources_assignment_filter += [ "*.mm" ]
-}
-if (!is_linux) {
- sources_assignment_filter += [
- "*_linux.h",
- "*_linux.cc",
- "*_linux_unittest.h",
- "*_linux_unittest.cc",
- "*\blinux/*",
- ]
-}
-if (!is_android) {
- sources_assignment_filter += [
- "*_android.h",
- "*_android.cc",
- "*_android_unittest.h",
- "*_android_unittest.cc",
- "*\bandroid/*",
- ]
-}
-if (!is_chromeos) {
- sources_assignment_filter += [
- "*_chromeos.h",
- "*_chromeos.cc",
- "*_chromeos_unittest.h",
- "*_chromeos_unittest.cc",
- "*\bchromeos/*",
- ]
-}
-
-# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
-# below.
-
-# 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.
-set_sources_assignment_filter(sources_assignment_filter)
-
-# =============================================================================
# BUILD OPTIONS
# =============================================================================
@@ -393,7 +210,6 @@ if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
# Holds all configs used for making native executables and libraries, to avoid
# duplication in each target below.
_native_compiler_configs = [
- "//build/config:feature_flags",
"//build/config/compiler:compiler",
"//build/config/compiler:compiler_arm_fpu",
"//build/config/compiler:chromium_code",
@@ -413,18 +229,13 @@ if (is_win) {
if (is_posix) {
_native_compiler_configs += [
"//build/config/gcc:no_exceptions",
- "//build/config/gcc:symbol_visibility_hidden",
]
}
-if (is_fnl) {
- _native_compiler_configs += [ "//build/config/fnl:sdk" ]
-} else if (is_linux) {
+if (is_linux) {
_native_compiler_configs += [ "//build/config/linux:sdk" ]
} else if (is_mac) {
_native_compiler_configs += [ "//build/config/mac:sdk" ]
-} else if (is_ios) {
- _native_compiler_configs += [ "//build/config/ios:sdk" ]
} else if (is_android) {
_native_compiler_configs += [ "//build/config/android:sdk" ]
}
@@ -440,36 +251,18 @@ if (is_clang) {
if (is_debug) {
_native_compiler_configs += [ "//build/config:debug" ]
_default_optimization_config = "//build/config/compiler:no_optimize"
-} else {
+} else if (is_release) {
_native_compiler_configs += [ "//build/config:release" ]
_default_optimization_config = "//build/config/compiler:optimize"
+} else {
+ assert(is_product)
+ _native_compiler_configs += [ "//build/config:product" ]
+ _default_optimization_config = "//build/config/compiler:optimize"
}
_native_compiler_configs += [ _default_optimization_config ]
-# 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 if (is_asan || is_lsan || is_tsan || is_msan) {
- # Sanitizers require symbols for filename suppressions to work.
- symbol_level = 1
- } else {
- symbol_level = 0
- }
-}
-
# Symbol setup.
-if (symbol_level == 2) {
- _default_symbols_config = "//build/config/compiler:symbols"
-} else if (symbol_level == 1) {
- _default_symbols_config = "//build/config/compiler:minimal_symbols"
-} else if (symbol_level == 0) {
- _default_symbols_config = "//build/config/compiler:no_symbols"
-} else {
- assert(false, "Bad value for symbol_level.")
-}
+_default_symbols_config = "//build/config/compiler:symbols"
_native_compiler_configs += [ _default_symbols_config ]
# Windows linker setup for EXEs and DLLs.
@@ -486,8 +279,7 @@ if (is_win) {
}
# Executable defaults.
-_executable_configs =
- _native_compiler_configs + [ "//build/config:default_libs" ]
+_executable_configs = _native_compiler_configs
if (is_win) {
_executable_configs += _windows_linker_configs
} else if (is_mac) {
@@ -511,8 +303,7 @@ set_defaults("static_library") {
}
# Shared library defaults (also for components in component mode).
-_shared_library_configs =
- _native_compiler_configs + [ "//build/config:default_libs" ]
+_shared_library_configs = _native_compiler_configs
if (is_win) {
_shared_library_configs += _windows_linker_configs
} else if (is_mac) {
@@ -526,29 +317,13 @@ if (is_win) {
set_defaults("shared_library") {
configs = _shared_library_configs
}
-if (is_component_build) {
- set_defaults("component") {
- configs = _shared_library_configs
- }
-}
# Source set defaults (also for components in non-component mode).
set_defaults("source_set") {
configs = _native_compiler_configs
}
-if (!is_component_build) {
- set_defaults("component") {
- configs = _native_compiler_configs
- }
-}
-
-# Test defaults.
-set_defaults("test") {
- if (is_android) {
- configs = _shared_library_configs
- } else {
- configs = _executable_configs
- }
+set_defaults("component") {
+ configs = _native_compiler_configs
}
# ==============================================================================
@@ -570,7 +345,6 @@ if (is_win) {
set_default_toolchain("$host_toolchain")
} else if (is_android) {
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 {
@@ -594,234 +368,108 @@ if (is_win) {
host_toolchain = "//build/toolchain/linux:$host_cpu"
set_default_toolchain("//build/toolchain/linux:$current_cpu")
}
- if (is_chromeos && cros_use_custom_toolchain) {
- set_default_toolchain("//build/toolchain/cros:target")
- }
- if (is_fnl) {
- set_default_toolchain("//build/toolchain/fnl:target")
- }
} else if (is_mac) {
host_toolchain = "//build/toolchain/mac:clang_x64"
set_default_toolchain(host_toolchain)
-} else if (is_ios) {
- host_toolchain = "//build/toolchain/mac:clang_x64"
- if (use_ios_simulator) {
- set_default_toolchain("//build/toolchain/mac:ios_clang_x64")
- } else {
- set_default_toolchain("//build/toolchain/mac:ios_clang_arm")
- }
-} 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
- # host_toolchain) needs to be reworked regardless to key off of host_os
- # and host_cpu rather than the is_* variables.
- host_toolchain = "//build/toolchain/linux:clang_x64"
}
# ==============================================================================
# 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"
-}
+# Don't try to do component builds for the standalone Dart VM.
+assert(!is_component_build)
+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
-
- # 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([])
-
- 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.data_deps)) {
- data_deps = invoker.data_deps
- }
- if (defined(invoker.datadeps)) {
- datadeps = invoker.datadeps
- }
- if (defined(invoker.defines)) {
- defines = invoker.defines
- }
-
- # 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",
- ]
- }
- 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
- }
- if (defined(invoker.public_configs)) {
- public_configs = invoker.public_configs
- }
- if (defined(invoker.public_deps)) {
- public_deps = invoker.public_deps
- }
- if (defined(invoker.sources)) {
- sources = invoker.sources
- }
- if (defined(invoker.testonly)) {
- testonly = invoker.testonly
- }
- if (defined(invoker.visibility)) {
- visibility = invoker.visibility
- }
+ source_set(target_name) {
+ # See above.
+ configs = [] # Prevent list overwriting warning.
+ configs = invoker.configs
+
+ # See above call.
+ set_sources_assignment_filter([])
+
+ if (defined(invoker.all_dependent_configs)) {
+ all_dependent_configs = invoker.all_dependent_configs
}
- } else {
- source_set(target_name) {
- # See above.
- configs = [] # Prevent list overwriting warning.
- configs = invoker.configs
-
- # See above call.
- set_sources_assignment_filter([])
-
- 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.data_deps)) {
- data_deps = invoker.data_deps
- }
- 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
- }
- if (defined(invoker.public_configs)) {
- public_configs = invoker.public_configs
- }
- if (defined(invoker.public_deps)) {
- public_deps = invoker.public_deps
- }
- if (defined(invoker.sources)) {
- sources = invoker.sources
- }
- if (defined(invoker.testonly)) {
- testonly = invoker.testonly
- }
- if (defined(invoker.visibility)) {
- visibility = invoker.visibility
- }
+ 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.data_deps)) {
+ data_deps = invoker.data_deps
+ }
+ 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
+ }
+ if (defined(invoker.public_configs)) {
+ public_configs = invoker.public_configs
+ }
+ if (defined(invoker.public_deps)) {
+ public_deps = invoker.public_deps
+ }
+ if (defined(invoker.sources)) {
+ sources = invoker.sources
+ }
+ if (defined(invoker.testonly)) {
+ testonly = invoker.testonly
+ }
+ if (defined(invoker.visibility)) {
+ visibility = invoker.visibility
}
}
}
« no previous file with comments | « build/config/BUILD.gn ('k') | build/config/allocator.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698