diff options
Diffstat (limited to 'chromium/build/config/BUILDCONFIG.gn')
-rw-r--r-- | chromium/build/config/BUILDCONFIG.gn | 321 |
1 files changed, 184 insertions, 137 deletions
diff --git a/chromium/build/config/BUILDCONFIG.gn b/chromium/build/config/BUILDCONFIG.gn index 1110970a82a..3df338da72c 100644 --- a/chromium/build/config/BUILDCONFIG.gn +++ b/chromium/build/config/BUILDCONFIG.gn @@ -33,16 +33,6 @@ declare_args() { # to configure warnings. is_clang = false - # ASH is enabled. - # TODO(brettw) this should be moved out of the main build config file. - use_ash = false - # Aura is enabled. - # TODO(brettw) this should be moved out of the main build config file. - use_aura = false - # Ozone is enabled. - # TODO(brettw) this should be moved out of the main build config file. - use_ozone = false - # 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. @@ -52,10 +42,6 @@ declare_args() { # the default toolchain to 64-bit. force_win64 = false - # Set to true on the command line when invoked by GYP. Build files can key - # off of this to make any GYP-output-specific changes to the build. - is_gyp = false - # 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. @@ -65,6 +51,18 @@ declare_args() { # true means official Google Chrome branding (requires extra Google-internal # resources). is_chrome_branded = false + + # 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 } # ============================================================================= @@ -78,7 +76,8 @@ declare_args() { # - 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). -# - is_linux is true for any Linux variant including Android and ChromeOS. +# - is_linux is true for desktop Linux and ChromeOS, but not Android (which is +# generally too different despite being based on the Linux kernel). # # 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 @@ -102,12 +101,14 @@ if (os == "win") { is_nacl = false is_posix = true is_win = false - is_clang = true # Always use clang on Mac. + if (!is_clang) { + is_clang = true # Always use clang on Mac. + } } else if (os == "android") { - is_android = false + is_android = true is_chromeos = false is_ios = false - is_linux = true + is_linux = false is_mac = false is_nacl = false is_posix = true @@ -141,6 +142,10 @@ if (os == "win") { is_nacl = false is_posix = true is_win = false + if (!is_gyp_xcode_generator) { + # Always use clang on iOS when using ninja + is_clang = true + } } else if (os == "linux") { is_android = false is_chromeos = false @@ -152,6 +157,8 @@ if (os == "win") { is_win = false } +is_desktop_linux = is_linux && !is_chromeos + # ============================================================================= # CPU ARCHITECTURE # ============================================================================= @@ -175,97 +182,108 @@ if (is_win) { # to each assignment or appending to the sources variable and matches are # automatcally removed. # -# We define lists of filters for each platform for all builds so they can -# be used by individual targets if necessary (a target can always change -# sources_assignment_filter on itself if it needs something more specific). -# # 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). -windows_sources_filters = [ - "*_win.cc", - "*_win.h", - "*_win_unittest.cc", - "*\bwin/*", -] -mac_sources_filters = [ - "*_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/*", -] -ios_sources_filters = [ - "*_ios.h", - "*_ios.cc", - "*_ios.mm", - "*_ios_unittest.h", - "*_ios_unittest.cc", - "*_ios_unittest.mm", - "*\bios/*", -] -objective_c_sources_filters = [ - "*.mm", -] -linux_sources_filters = [ - "*_linux.h", - "*_linux.cc", - "*_linux_unittest.h", - "*_linux_unittest.cc", - "*\blinux/*", - "*_x11.cc", - "*_x11.h", -] -android_sources_filters = [ - "*_android.h", - "*_android.cc", - "*_android_unittest.h", - "*_android_unittest.cc", - "*\bandroid/*", -] -posix_sources_filters = [ - "*_posix.h", - "*_posix.cc", - "*_posix_unittest.h", - "*_posix_unittest.cc", - "*\bposix/*", -] - -# Construct the full list of sources we're using for this platform. +# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call +# below. sources_assignment_filter = [] -if (is_win) { - sources_assignment_filter += posix_sources_filters -} else { - sources_assignment_filter += windows_sources_filters +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", + ] } if (!is_mac) { - sources_assignment_filter += mac_sources_filters + 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_sources_filters + 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 += objective_c_sources_filters + sources_assignment_filter += [ + "*.mm", + ] } if (!is_linux) { - sources_assignment_filter += linux_sources_filters + sources_assignment_filter += [ + "*_linux.h", + "*_linux.cc", + "*_linux_unittest.h", + "*_linux_unittest.cc", + "*\blinux/*", + ] } if (!is_android) { - sources_assignment_filter += android_sources_filters + 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. -# This is the actual set. +# 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) # ============================================================================= @@ -275,10 +293,14 @@ set_sources_assignment_filter(sources_assignment_filter) if (is_component_build) { component_mode = "shared_library" } else { - component_mode = "static_library" + component_mode = "source_set" } -toolkit_uses_gtk = is_linux +# 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 +} # ============================================================================= # TARGET DEFAULTS @@ -291,8 +313,8 @@ toolkit_uses_gtk = is_linux # Holds all configs used for making native executables and libraries, to avoid # duplication in each target below. -native_compiler_configs = [ - "//build/config:my_msvs", # TODO(brettw) eraseme +_native_compiler_configs = [ + "//build/config:feature_flags", "//build/config/compiler:compiler", "//build/config/compiler:chromium_code", @@ -301,22 +323,46 @@ native_compiler_configs = [ "//build/config/compiler:runtime_library", ] if (is_win) { - native_compiler_configs += [ + _native_compiler_configs += [ + "//build/config/win:lean_and_mean", + "//build/config/win:nominmax", "//build/config/win:sdk", + "//build/config/win:unicode", + ] +} +if (is_posix) { + _native_compiler_configs += [ + "//build/config/gcc:no_exceptions", + "//build/config/gcc:symbol_visibility_hidden", + ] +} + +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", ] +} + +if (is_clang) { + _native_compiler_configs += [ + "//build/config/clang:find_bad_constructs", + "//build/config/clang:extra_warnings", ] -} else if (is_clang) { - native_compiler_configs += "//build/config/clang:find_bad_constructs" } # Optimizations and debug checking. if (is_debug) { - native_compiler_configs += "//build/config:debug" - default_optimization_config = "//build/config/compiler:no_optimize" + _native_compiler_configs += [ "//build/config:debug" ] + _default_optimization_config = "//build/config/compiler:no_optimize" } else { - native_compiler_configs += "//build/config:release" - default_optimization_config = "//build/config/compiler:optimize" + _native_compiler_configs += [ "//build/config:release" ] + _default_optimization_config = "//build/config/compiler:optimize" } -native_compiler_configs += default_optimization_config +_native_compiler_configs += [ _default_optimization_config ] # Symbol setup. if (is_clang && (is_linux || is_android)) { @@ -324,29 +370,29 @@ if (is_clang && (is_linux || is_android)) { # For now, don't create debug information with clang. # See http://crbug.com/70000 # TODO(brettw) This just copies GYP. Why not do this on Mac as well? - default_symbols_config = "//build/config/compiler:no_symbols" + _default_symbols_config = "//build/config/compiler:no_symbols" } else if (symbol_level == 2) { - default_symbols_config = "//build/config/compiler:symbols" + _default_symbols_config = "//build/config/compiler:symbols" } else if (symbol_level == 1) { - default_symbols_config = "//build/config/compiler:minimal_symbols" + _default_symbols_config = "//build/config/compiler:minimal_symbols" } else if (symbol_level == 0) { - default_symbols_config = "//build/config/compiler:no_symbols" + _default_symbols_config = "//build/config/compiler:no_symbols" } else { assert(false, "Bad value for symbol_level.") } -native_compiler_configs += default_symbols_config +_native_compiler_configs += [ _default_symbols_config ] # Windows linker setup for EXEs and DLLs. if (is_win) { if (is_debug) { - default_incremental_linking_config = + _default_incremental_linking_config = "//build/config/win:incremental_linking" } else { - default_incremental_linking_config = + _default_incremental_linking_config = "//build/config/win:no_incremental_linking" } - windows_linker_configs = [ - default_incremental_linking_config, + _windows_linker_configs = [ + _default_incremental_linking_config, "//build/config/win:sdk_link", "//build/config/win:common_linker_setup", # Default to console-mode apps. Most of our targets are tests and such @@ -356,31 +402,37 @@ if (is_win) { } set_defaults("executable") { - configs = native_compiler_configs + configs = _native_compiler_configs + [ + "//build/config:default_libs", + ] if (is_win) { - configs += windows_linker_configs + configs += _windows_linker_configs } else if (is_mac) { - configs += "//build/config/mac:mac_dynamic_flags" - } else if (is_linux) { - configs += "//build/config/linux:executable_ldconfig" + configs += [ + "//build/config/mac:mac_dynamic_flags", + "//build/config/mac:mac_executable_flags" ] + } else if (is_linux || is_android) { + configs += [ "//build/config/gcc:executable_ldconfig" ] } } set_defaults("static_library") { - configs = native_compiler_configs + configs = _native_compiler_configs } set_defaults("shared_library") { - configs = native_compiler_configs + configs = _native_compiler_configs + [ + "//build/config:default_libs", + ] if (is_win) { - configs += windows_linker_configs + configs += _windows_linker_configs } else if (is_mac) { - configs += "//build/config/mac:mac_dynamic_flags" + configs += [ "//build/config/mac:mac_dynamic_flags" ] } } set_defaults("source_set") { - configs = native_compiler_configs + configs = _native_compiler_configs } # ============================================================================== @@ -393,6 +445,8 @@ set_defaults("source_set") { # default toolchain. if (is_win) { + # TODO(brettw) name the toolchains the same as cpu_arch as with Linux below + # to eliminate these conditionals. if (build_cpu_arch == "x64") { host_toolchain = "//build/toolchain/win:64" } else if (build_cpu_arch == "x86") { @@ -404,23 +458,16 @@ if (is_win) { } else if (cpu_arch == "x86") { set_default_toolchain("//build/toolchain/win:32") } +} else if (is_android) { + host_toolchain = "//build/toolchain/linux:$build_cpu_arch" + set_default_toolchain("//build/toolchain/android:$cpu_arch") } else if (is_linux) { - if (build_cpu_arch == "arm") { - host_toolchain = "//build/toolchain/linux:arm" - } else if (build_cpu_arch == "x86") { - host_toolchain = "//build/toolchain/linux:32" - } else if (build_cpu_arch == "x64") { - host_toolchain = "//build/toolchain/linux:64" - } - - if (build_cpu_arch == "arm") { - set_default_toolchain("//build/toolchain/linux:arm") - } else if (build_cpu_arch == "x86") { - set_default_toolchain("//build/toolchain/linux:32") - } else if (build_cpu_arch == "x64") { - set_default_toolchain("//build/toolchain/linux:64") - } + host_toolchain = "//build/toolchain/linux:$build_cpu_arch" + set_default_toolchain("//build/toolchain/linux:$cpu_arch") } else if (is_mac) { host_toolchain = "//build/toolchain/mac:clang" set_default_toolchain(host_toolchain) +} else if (is_ios) { + host_toolchain = "//build/toolchain/mac:host_clang" + set_default_toolchain("//build/toolchain/mac:clang") } |