# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+# Update this file on every upversion based on //build/config/BUILDCONFIG.gn.
+
# =============================================================================
# WHAT IS THIS FILE?
# =============================================================================
# separate flags.
is_official_build = false
- # Debug build. Enabling official builds automatically sets is_debug to false.
- is_debug = false
-
# Whether we're a traditional desktop unix.
is_desktop_linux = current_os == "linux"
# Set to true when compiling with the Clang compiler. Typically this is used
# to configure warnings.
- is_clang = current_os == "ios"
+ is_clang =
+ current_os == "mac" || current_os == "ios" || current_os == "chromeos" ||
+ current_os == "fuchsia" || current_os == "android" ||
+ current_os == "win" ||
+ (current_os == "linux" && current_cpu != "s390x" &&
+ current_cpu != "s390" && current_cpu != "ppc64" &&
+ current_cpu != "ppc" && current_cpu != "mips" && current_cpu != "mips64")
# Allows the path to a custom target toolchain to be injected as a single
# argument, and set as the default toolchain.
# This should not normally be set as a build argument. It's here so that
# every toolchain can pass through the "global" value via toolchain_args().
- if (current_os == "tizen") {
- host_toolchain = "//tizen_src/build/toolchain/tizen:$host_cpu"
- } else {
- host_toolchain = ""
- }
+ host_toolchain = ""
# DON'T ADD MORE FLAGS HERE. Read the comment above.
}
declare_args() {
+ # Debug build. is_debug is set to false for efl port.
+ is_debug = false
+}
+
+declare_args() {
# Component build. Setting to true compiles targets declared as "components"
# as shared libraries loaded dynamically. This speeds up development time.
# When false, components will be linked statically.
# On Windows always use the target CPU for host builds. On the
# configurations we support this will always work and it saves build steps.
if (is_clang) {
- host_toolchain = "//build/toolchain/win:clang_$target_cpu"
+ host_toolchain = "//build/toolchain/win:win_clang_$target_cpu"
} else {
host_toolchain = "//build/toolchain/win:$target_cpu"
}
+ } else if (host_os == "aix") {
+ host_toolchain = "//build/toolchain/aix:$host_cpu"
} else {
assert(false, "Unsupported host_os: $host_os")
}
_default_toolchain = ""
-if (target_os == "tizen") {
+if (target_os == "android") {
+ assert(host_os == "linux" || host_os == "mac",
+ "Android builds are only supported on Linux and Mac hosts.")
+ _default_toolchain = "//build/toolchain/android:android_clang_$target_cpu"
+} else if (target_os == "tizen") {
assert(host_os == "linux" || host_os == "mac",
"Tizen builds are only supported on Linux and Mac hosts.")
if (is_clang) {
- _default_toolchain = "//tizen_src/build/toolchain/tizen_clang_$target_cpu"
+ _default_toolchain =
+ "//tizen_src/build/toolchain/tizen:tizen_clang_$target_cpu"
} else {
- _default_toolchain = "//tizen_src/build/toolchain/tizen:$target_cpu"
+ _default_toolchain = "//tizen_src/build/toolchain/tizen:tizen_$target_cpu"
}
} else if (target_os == "chromeos" || target_os == "linux") {
# See comments in build/toolchain/cros/BUILD.gn about board compiles.
} else {
_default_toolchain = "//build/toolchain/linux:$target_cpu"
}
+} else if (target_os == "fuchsia") {
+ _default_toolchain = "//build/toolchain/fuchsia:$target_cpu"
} else if (target_os == "ios") {
_default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu"
} else if (target_os == "mac") {
_default_toolchain = host_toolchain
} else if (target_os == "win") {
# On Windows we use the same toolchain for host and target by default.
- assert(target_os == host_os, "Win cross-compiles only work on win hosts.")
+ # Beware, win cross builds have some caveats, see docs/win_cross.md
+ # TODO(thakis): See if we want to make 32-bit builds on mac hosts work.
+ assert(host_os != "mac" || target_cpu == "x64",
+ "Mac hosts can only build 64-bit chrome/win, https://crbug.com/794838")
if (is_clang) {
- _default_toolchain = "//build/toolchain/win:clang_$target_cpu"
+ _default_toolchain = "//build/toolchain/win:win_clang_$target_cpu"
} else {
_default_toolchain = "//build/toolchain/win:$target_cpu"
}
-} else if (target_os == "winrt_81" || target_os == "winrt_81_phone" ||
- target_os == "winrt_10") {
- _default_toolchain = "//build/toolchain/win:winrt_$target_cpu"
+} else if (target_os == "winuwp") {
+ # Only target WinUWP on for a Windows store application and only
+ # x86, x64 and arm are supported target CPUs.
+ assert(target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
+ target_cpu == "arm64")
+ _default_toolchain = "//build/toolchain/win:uwp_$target_cpu"
+} else if (target_os == "aix") {
+ _default_toolchain = "//build/toolchain/aix:$target_cpu"
} else {
assert(false, "Unsupported target_os: $target_os")
}
# aix or one of the BSDs. If you need to check these, just check the
# current_os value directly.
-if (current_os == "win" || current_os == "winrt_81" ||
- current_os == "winrt_81_phone" || current_os == "winrt_10") {
+if (current_os == "win" || current_os == "winuwp") {
is_android = false
is_chromeos = false
+ is_fuchsia = false
is_ios = false
is_linux = false
is_mac = false
} else if (current_os == "mac") {
is_android = false
is_chromeos = false
+ is_fuchsia = false
is_ios = false
is_linux = false
is_mac = true
is_win = false
is_tizen = true
use_efl = true
+} else if (current_os == "android") {
+ is_android = true
+ is_chromeos = false
+ is_fuchsia = false
+ is_ios = false
+ is_linux = false
+ is_mac = false
+ is_nacl = false
+ is_posix = true
+ is_win = false
+ is_tizen = false
+ use_efl = false
+} else if (current_os == "chromeos") {
+ is_android = false
+ is_chromeos = true
+ is_fuchsia = false
+ is_ios = false
+ is_linux = true
+ is_mac = false
+ is_nacl = false
+ is_posix = true
+ is_win = false
+ is_tizen = false
+ use_efl = 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_fuchsia = false
is_ios = false
is_linux = false
is_mac = false
is_win = false
is_tizen = false
use_efl = false
+} else if (current_os == "fuchsia") {
+ is_android = false
+ is_chromeos = false
+ is_fuchsia = true
+ is_ios = false
+ is_linux = false
+ is_mac = false
+ is_nacl = false
+ is_posix = false
+ is_win = false
} else if (current_os == "ios") {
is_android = false
is_chromeos = false
+ is_fuchsia = false
is_ios = true
is_linux = false
is_mac = false
is_win = false
is_tizen = false
use_efl = true
+} else if (current_os == "aix") {
+ is_android = false
+ is_chromeos = false
+ is_fuchsia = false
+ is_ios = false
+ is_linux = false
+ is_mac = false
+ is_nacl = false
+ is_posix = true
+ is_win = false
}
# =============================================================================
# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
# below.
sources_assignment_filter = []
-if (!is_posix) {
+
+# TODO(crbug.com/812974): Clean up _posix files and remove Fuchsia here.
+if (!is_posix && !is_fuchsia) {
sources_assignment_filter += [
"*_posix.h",
"*_posix.cc",
"*\bposix/*",
]
}
+
if (!is_win) {
sources_assignment_filter += [
"*_win.cc",
# 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.
+#
+# WHAT GOES HERE?
+#
+# Other than the main compiler and linker configs, the only reason for a config
+# to be in this list is if some targets need to explicitly override that config
+# by removing it. This is how targets opt-out of flags. If you don't have that
+# requirement and just need to add a config everywhere, reference it as a
+# sub-config of an existing one, most commonly the main "compiler" one.
# Holds all configs used for running the compiler.
default_compiler_configs = [
"//build/config:feature_flags",
"//tizen_src/build/config:tizen_feature_flags",
"//build/config/compiler:afdo",
+ "//build/config/compiler:afdo_optimize_size",
"//build/config/compiler:compiler",
"//build/config/compiler:clang_stackrealign",
"//build/config/compiler:compiler_arm_fpu",
+ "//build/config/compiler:compiler_arm_thumb",
"//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
"//tizen_src/build/config/compiler:tizen_default_include_dirs",
"//build/config/compiler:default_optimization",
"//build/config/compiler:default_stack_frames",
"//build/config/compiler:default_symbols",
+ "//build/config/compiler:no_exceptions",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
"//build/config/compiler:thin_archive",
"//build/config/coverage:default_coverage",
"//build/config/sanitizers:default_sanitizer_flags",
]
-if (!is_tizen) {
- default_compiler_configs +=
- [ "//tizen_src/build/config/compiler:tizen_default_lib_dirs" ]
-}
+
if (is_win) {
default_compiler_configs += [
"//build/config/win:default_crt",
"//build/config/win:vs_code_analysis",
]
}
-if (current_os == "winrt_81" || current_os == "winrt_81_phone" ||
- current_os == "winrt_10") {
- default_compiler_configs += [ "//build/config/win:target_winrt" ]
-}
+
if (is_posix) {
- default_compiler_configs += [
- "//build/config/compiler:no_exceptions",
- "//build/config/gcc:symbol_visibility_hidden",
- ]
+ if (current_os != "aix") {
+ default_compiler_configs +=
+ [ "//build/config/gcc:symbol_visibility_hidden" ]
+ }
+}
+
+if (is_fuchsia) {
+ default_compiler_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
}
-if (!use_efl) {
+if (is_android) {
default_compiler_configs +=
[ "//build/config/android:default_cygprofile_instrumentation" ]
}
+if (is_win) {
+ default_compiler_configs +=
+ [ "//build/config/win:default_cygprofile_instrumentation" ]
+}
+
if (is_clang && !is_nacl) {
default_compiler_configs += [
"//build/config/clang:find_bad_constructs",
# that shouldn't use the windows subsystem.
"//build/config/win:console",
]
-} else if (is_mac || is_ios) {
+} else if (is_mac) {
_linker_configs = [ "//build/config/mac:strip_all" ]
} else {
_linker_configs = []
configs = default_executable_configs
}
-# Test defaults.
-set_defaults("test") {
- configs = default_executable_configs
-}
-
# Shared library and loadable module defaults (also for components in component
-# Test defaults.# mode).
+# mode).
default_shared_library_configs = default_compiler_configs + [
"//build/config:default_libs",
"//build/config:shared_library_config",
] + _linker_configs
-if (!use_efl) {
+if (is_android) {
# Strip native JNI exports from shared libraries by default. Binaries that
# want this can remove this config.
default_shared_library_configs +=
- [ "//build/config/android:hide_native_jni_exports" ]
+ [ "//build/config/android:hide_all_but_jni_onload" ]
}
set_defaults("shared_library") {
configs = default_shared_library_configs
}
set_defaults("loadable_module") {
configs = default_shared_library_configs
+
+ # loadable_modules are generally used by other libs, not just via JNI.
+ if (is_android) {
+ configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
+ }
}
# ==============================================================================
if (is_component_build) {
configs = default_shared_library_configs
if (is_android) {
- configs -= [ "//build/config/android:hide_native_jni_exports" ]
+ configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
}
} else {
configs = default_compiler_configs