summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/core.gni
blob: 04acc23c796a809bd4202ef9de4781b2a1f2616d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# 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(crbug.com/1125115): It's unclear if the perf vs size win here is a good
# trade-off for Android. Investigate that.
if (!is_debug && !optimize_for_size) {
  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
}
if (using_mismatched_sample_profile) {
  core_config_remove += [ "//build/config/compiler:afdo_optimize_size" ]
}

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",
  ]
}