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 128 129 130 131 132 133 134 135 136 137 138 139 140
|
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("config.gni")
if (is_clang) {
import("//build/config/clang/clang.gni")
}
visibility = [ "//third_party/blink/*" ]
# arguments --------------------------------------------------------------------
declare_args() {
# Set to true to enable the clang plugin that checks the usage of the Blink
# garbage-collection infrastructure during compilation.
blink_gc_plugin = true
# Set to true to have the clang Blink GC plugin emit class graph (in JSON)
# with typed pointer edges; for debugging or other (internal) uses.
blink_gc_plugin_option_do_dump_graph = false
}
# features ---------------------------------------------------------------------
config("features") {
defines = feature_defines_list
}
# inside_blink -----------------------------------------------------------------
config("inside_blink") {
cflags = []
defines = [
"BLINK_IMPLEMENTATION=1",
"INSIDE_BLINK",
]
if (is_clang) {
cflags += [
"-Wconversion",
"-Wno-float-conversion",
"-Wno-sign-conversion",
"-Wno-implicit-float-conversion",
"-Wno-implicit-int-conversion",
]
}
}
# blink_pch --------------------------------------------------------------------
# Precompiled headers can save a lot of time compiling since Blink has
# a lot of source in header files.
import("//build/config/pch.gni")
config("blink_pch") {
if (enable_precompiled_headers) {
if (is_win) {
# This is a string rather than a file GN knows about. It has to match
# exactly what's in the /FI flag below, and what might appear in the
# source code in quotes for an #include directive.
precompiled_header = rebase_path("build/win/precompile.h", "//")
# This is a file that GN will compile with the above header. It will be
# implicitly added to the sources (potentially multiple times, with one
# variant for each language used in the target).
precompiled_source =
"//third_party/blink/renderer/build/win/precompile.cc"
# Force include the header.
cflags = [ "/FI$precompiled_header" ]
} else if (is_mac) {
precompiled_source = "//third_party/blink/renderer/build/mac/prefix.h"
} else if (is_linux) {
precompiled_source = "//third_party/blink/renderer/build/linux/prefix.h"
}
}
}
# config -----------------------------------------------------------------------
config("config") {
cflags = []
defines = []
if (is_win) {
cflags += [
"/wd4305", # Truncation from 'type1' to 'type2'.
"/wd4324", # Struct padded due to declspec(align).
"/wd4714", # Function marked forceinline not inlined.
"/wd4800", # Value forced to bool.
]
}
if (is_win) {
if (is_component_build) {
defines += [ "USING_V8_SHARED" ]
}
}
if (is_clang && clang_use_chrome_plugins) {
cflags += [
"-Xclang",
"-plugin-arg-find-bad-constructs",
"-Xclang",
"check-blink-data-member-type",
]
}
if (is_clang && blink_gc_plugin && clang_use_chrome_plugins) {
# The plugin is built directly into clang, so there's no need to load it
# dynamically.
cflags += [
"-Xclang",
"-add-plugin",
"-Xclang",
"blink-gc-plugin",
]
# Add arguments for enabled GC plugin options:
if (blink_gc_plugin_option_do_dump_graph) {
cflags += [
"-Xclang",
"-plugin-arg-blink-gc-plugin",
"-Xclang",
"dump-graph",
]
}
}
}
# The follow configs apply to all targets except for unit tests, which rely on
# static initializers.
config("non_test_config") {
configs = [
"//build/config/compiler:wexit_time_destructors",
"//build/config/compiler:wglobal_constructors",
]
}
|