naiveproxy/third_party/WebKit/Source/BUILD.gn
2018-01-29 00:30:36 +08:00

155 lines
4.2 KiB
Plaintext

# 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("config.gni")
if (is_clang) {
import("//build/config/clang/clang.gni")
}
visibility = [ "//third_party/WebKit/*" ]
# 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
# Set to true to have the clang Blink GC plugin additionally check if
# a class has an empty destructor which would be unnecessarily invoked
# when finalized.
blink_gc_plugin_option_warn_unneeded_finalizer = false
}
# features ---------------------------------------------------------------------
config("features") {
defines = feature_defines_list
}
# inside_blink -----------------------------------------------------------------
config("inside_blink") {
defines = [
"BLINK_IMPLEMENTATION=1",
"INSIDE_BLINK",
]
}
# 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", root_build_dir)
# 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/WebKit/Source/build/win/Precompile.cpp"
# Force include the header.
cflags = [ "/FI$precompiled_header" ]
} else if (is_mac) {
precompiled_source = "//third_party/WebKit/Source/build/mac/Prefix.h"
}
}
}
# config -----------------------------------------------------------------------
config("config") {
include_dirs = [
".",
"..",
"$root_gen_dir/blink",
"$root_gen_dir/third_party/WebKit",
]
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.
"/wd4996", # Deprecated function call.
]
}
if (is_win) {
if (is_component_build) {
defines += [ "USING_V8_SHARED" ]
}
}
if (is_clang && blink_gc_plugin && clang_use_chrome_plugins) {
# On Windows, the plugin is built directly into clang, so there's
# no need to load it dynamically.
if (!is_win) {
_blink_gc_plugin_dll_extension = "so"
if (is_mac || is_ios) {
_blink_gc_plugin_dll_extension = "dylib"
}
cflags += [
"-Xclang",
"-load",
"-Xclang",
rebase_path(
"${clang_base_path}/lib/libBlinkGCPlugin.${_blink_gc_plugin_dll_extension}",
root_build_dir),
]
}
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",
]
}
if (blink_gc_plugin_option_warn_unneeded_finalizer) {
cflags += [
"-Xclang",
"-plugin-arg-blink-gc-plugin",
"-Xclang",
"warn-unneeded-finalizer",
]
}
}
}
# The follow configs apply to all targets except for unit tests, which rely on
# static initializers.
config("non_test_config") {
cflags = []
if (is_clang) {
cflags += [ "-Wglobal-constructors" ]
}
}