# Copyright 2014 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. import("//build/config/chrome_build.gni") import("//build/config/jumbo.gni") import("//third_party/blink/renderer/config.gni") blink_core_output_dir = "$root_gen_dir/third_party/blink/renderer/core" # This file sets core_config_add and core_config_remove lists of configs to # modify the default lists of configs set in the build as appropriate for core # targets. This avoids duplicating logic across many targets. core_config_add = [ "//build/config/compiler:wexit_time_destructors", "//third_party/blink/renderer:config", "//third_party/blink/renderer:non_test_config", "//third_party/blink/renderer/core:config", ] core_config_remove = [] # Compute the optimization level. `optimize_max` ensures that speed is preferred # over size on all platforms. # TODO: It's unclear if the perf vs size win here is a good trade-off for # Android. Investigate that. if (!is_debug && !is_android) { core_config_remove += [ "//build/config/compiler:default_optimization" ] core_config_add += [ "//build/config/compiler:optimize_max" ] } else { core_config_remove += [ "//build/config/compiler:default_optimization" ] core_config_add += blink_optimization_config } core_config_remove += [ "//build/config/compiler:default_symbols" ] core_config_add += blink_symbols_config # Use this to generate a static library or source set that gets linked into # "core". This will either be a source_set (component build), or a static # library. # # Special values (all unlisted values are forwarded to the underlying library): # # configs # Normal meaning. The set_defaults call below will make the default value # of configs in the calling code take into account the core_config_add and # core_config_remove lists above. So you don't need to manually take these # into account: just modify the configs as normal for target-specific # overrides (or don't touch it). # # deps # Normal meaning but "core:prerequisites" target is always added. Callers # shouldn't list prerequisites as a dependency. # # visibility # Normal meaning if defined. If undefined, defaults to everything in core. template("blink_core_sources") { if (is_component_build) { target_type = "jumbo_source_set" } else { target_type = "jumbo_static_library" } target(target_type, target_name) { # The visibility will get overridden by forward_variables_from below if the # invoker defined it. visibility = [ "//third_party/blink/renderer/core/*" ] deps = [ "//third_party/blink/renderer/core:prerequisites" ] if (defined(invoker.deps)) { deps += invoker.deps } public_deps = [ "//third_party/blink/renderer/core:all_generators", "//third_party/blink/renderer/core:core_common", ] if (defined(invoker.public_deps)) { public_deps += invoker.public_deps } # Take everything else not handled above from the invoker. forward_variables_from(invoker, "*", [ "deps", "public_deps", ]) } } set_defaults("blink_core_sources") { # This sets the default list of configs when the blink_core_sources target # is defined. The default_compiler_configs comes from BUILDCONFIG.gn and # is the list normally applied to static libraries and source sets. configs = default_compiler_configs - core_config_remove + core_config_add configs += [ "//third_party/blink/renderer/core:blink_core_pch" ] } template("blink_core_tests") { jumbo_source_set(target_name) { # The visibility will get overridden by forward_variables_from below if the # invoker defined it. visibility = [ "//third_party/blink/renderer/core/*" ] testonly = true deps = [ "//testing/gmock", "//testing/gtest", "//third_party/blink/renderer/core", ] if (defined(invoker.deps)) { deps += invoker.deps } # Take everything else not handled above from the invoker. forward_variables_from(invoker, "*", [ "deps" ]) } } set_defaults("blink_core_tests") { configs = default_compiler_configs configs += [ "//third_party/blink/renderer:config", "//third_party/blink/renderer/core:blink_core_pch", "//third_party/blink/renderer:inside_blink", ] }