blob: cd2857b16a7c6589da05b6a9411b5e639da2e020 [file] [log] [blame]
# 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("//build/split_static_library.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. The GYP code sets "optimize: max" which sets
# speed-over-size optimization for official builds on Windows only. The GN's
# build optimize_max config applies this optimization on all platforms, so
# compute how to modify the config list to duplicate the GYP behavior.
# TODO revisit this behavior, as the Windows-specific part seems suspicious.
if (is_win && is_official_build) {
core_config_remove += [ "//build/config/compiler:default_optimization" ]
core_config_add += [ "//build/config/compiler:optimize_max" ]
}
core_config_remove += [ "//build/config/compiler:default_symbols" ]
core_config_add += blink_symbols_config
# Use this target type to link core targets.
if (is_component_build) {
# To get exported symbols correct in component builds, the files must be in
# source sets.
core_link_large_target_type = "source_set"
core_link_small_target_type = "source_set"
} else {
# In static builds some of the libraries can get >2GB on Windows so we need
# to split the targets for the larger ones.
core_link_large_target_type = "split_static_library"
core_link_small_target_type = "static_library"
}
# Use this to generate a static library or source set that gets linked into
# "core". This will either be a source_set (component build), a static library
# (split_count undefined) or a split static library (split_count defined).
#
# 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).
#
# split_count
# If defined, non-component builds will generate this number of static
# libraries by splitting the sources. This is for use on Windows where the
# maximum static library size is 2GB, and 64-bit builds with full symbols
# can exceed this if there are many sources.
#
# 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"
# This assert avoids an unused variable warning.
assert(!defined(invoker.split_count) || invoker.split_count != 0)
} else if (!defined(invoker.split_count)) {
target_type = "jumbo_static_library"
} else {
target_type = "jumbo_split_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/*" ]
if (target_type == "jumbo_split_static_library") {
split_count = invoker.split_count
}
deps = [
"//third_party/blink/renderer/core:prerequisites",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
public_deps = [
"//third_party/blink/renderer/core:all_generators",
]
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",
"split_count",
])
}
}
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",
]
}
declare_args() {
# Use base::TimeDelta to represent time in renderer/core/animations. See
# http://crbug.com/737867
blink_animation_use_time_delta = false
}