Commit 49cce9e0 authored by machenbach's avatar machenbach Committed by Commit bot

[gn] Refactoring - share common code in source sets

BUG=chromium:474921
NOTRY=true

Review-Url: https://codereview.chromium.org/1966933003
Cr-Commit-Position: refs/heads/master@{#36166}
parent f4dd8ec3
...@@ -307,6 +307,28 @@ config("toolchain") { ...@@ -307,6 +307,28 @@ config("toolchain") {
} }
} }
###############################################################################
# Templates
#
template("v8_source_set") {
source_set(target_name) {
forward_variables_from(invoker, "*", ["configs"])
configs += invoker.configs
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":features",
":toolchain",
]
if (!is_debug || v8_optimized_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
}
############################################################################### ###############################################################################
# Actions # Actions
# #
...@@ -611,7 +633,7 @@ action("run_mksnapshot") { ...@@ -611,7 +633,7 @@ action("run_mksnapshot") {
# Source Sets (aka static libraries) # Source Sets (aka static libraries)
# #
source_set("v8_nosnapshot") { v8_source_set("v8_nosnapshot") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [ deps = [
...@@ -630,20 +652,12 @@ source_set("v8_nosnapshot") { ...@@ -630,20 +652,12 @@ source_set("v8_nosnapshot") {
"src/snapshot/snapshot-empty.cc", "src/snapshot/snapshot-empty.cc",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":features",
":toolchain",
] ]
if (!is_debug || v8_optimized_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
} }
source_set("v8_snapshot") { v8_source_set("v8_snapshot") {
# Only targets in this file and the top-level visibility target can # Only targets in this file and the top-level visibility target can
# depend on this. # depend on this.
visibility = [ visibility = [
...@@ -672,21 +686,13 @@ source_set("v8_snapshot") { ...@@ -672,21 +686,13 @@ source_set("v8_snapshot") {
"$target_gen_dir/snapshot.cc", "$target_gen_dir/snapshot.cc",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":features",
":toolchain",
] ]
if (!is_debug || v8_optimized_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
} }
if (v8_use_external_startup_data) { if (v8_use_external_startup_data) {
source_set("v8_external_snapshot") { v8_source_set("v8_external_snapshot") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [ deps = [
...@@ -706,21 +712,13 @@ if (v8_use_external_startup_data) { ...@@ -706,21 +712,13 @@ if (v8_use_external_startup_data) {
"src/snapshot/snapshot-external.cc", "src/snapshot/snapshot-external.cc",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":features",
":toolchain",
] ]
if (!is_debug || v8_optimized_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
} }
} }
source_set("v8_base") { v8_source_set("v8_base") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [ sources = [
...@@ -1801,19 +1799,10 @@ source_set("v8_base") { ...@@ -1801,19 +1799,10 @@ source_set("v8_base") {
] ]
} }
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":features",
":toolchain",
] ]
if (!is_debug || v8_optimized_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
defines = [] defines = []
deps = [ deps = [
":v8_libbase", ":v8_libbase",
...@@ -1845,7 +1834,7 @@ source_set("v8_base") { ...@@ -1845,7 +1834,7 @@ source_set("v8_base") {
} }
} }
source_set("v8_libbase") { v8_source_set("v8_libbase") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [ sources = [
...@@ -1905,19 +1894,10 @@ source_set("v8_libbase") { ...@@ -1905,19 +1894,10 @@ source_set("v8_libbase") {
"src/base/utils/random-number-generator.h", "src/base/utils/random-number-generator.h",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config_base", ":internal_config_base",
":features",
":toolchain",
] ]
if (!is_debug || v8_optimized_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
defines = [] defines = []
if (is_posix) { if (is_posix) {
...@@ -1965,7 +1945,7 @@ source_set("v8_libbase") { ...@@ -1965,7 +1945,7 @@ source_set("v8_libbase") {
# TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris. # TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris.
} }
source_set("v8_libplatform") { v8_source_set("v8_libplatform") {
sources = [ sources = [
"include/libplatform/libplatform.h", "include/libplatform/libplatform.h",
"src/libplatform/default-platform.cc", "src/libplatform/default-platform.cc",
...@@ -1976,25 +1956,16 @@ source_set("v8_libplatform") { ...@@ -1976,25 +1956,16 @@ source_set("v8_libplatform") {
"src/libplatform/worker-thread.h", "src/libplatform/worker-thread.h",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config_base", ":internal_config_base",
":features",
":toolchain",
] ]
if (!is_debug || v8_optimized_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
deps = [ deps = [
":v8_libbase", ":v8_libbase",
] ]
} }
source_set("fuzzer_support") { v8_source_set("fuzzer_support") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [ sources = [
...@@ -2002,13 +1973,9 @@ source_set("fuzzer_support") { ...@@ -2002,13 +1973,9 @@ source_set("fuzzer_support") {
"test/fuzzer/fuzzer-support.h", "test/fuzzer/fuzzer-support.h",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config_base", ":internal_config_base",
":libplatform_config", ":libplatform_config",
":features",
":toolchain",
] ]
deps = [ deps = [
...@@ -2163,7 +2130,7 @@ if ((current_toolchain == host_toolchain && v8_toolset_for_shell == "host") || ( ...@@ -2163,7 +2130,7 @@ if ((current_toolchain == host_toolchain && v8_toolset_for_shell == "host") || (
} }
} }
source_set("json_fuzzer") { v8_source_set("json_fuzzer") {
sources = [ sources = [
"test/fuzzer/json.cc", "test/fuzzer/json.cc",
] ]
...@@ -2172,17 +2139,13 @@ source_set("json_fuzzer") { ...@@ -2172,17 +2139,13 @@ source_set("json_fuzzer") {
":fuzzer_support", ":fuzzer_support",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":libplatform_config", ":libplatform_config",
":features",
":toolchain",
] ]
} }
source_set("parser_fuzzer") { v8_source_set("parser_fuzzer") {
sources = [ sources = [
"test/fuzzer/parser.cc", "test/fuzzer/parser.cc",
] ]
...@@ -2191,17 +2154,13 @@ source_set("parser_fuzzer") { ...@@ -2191,17 +2154,13 @@ source_set("parser_fuzzer") {
":fuzzer_support", ":fuzzer_support",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":libplatform_config", ":libplatform_config",
":features",
":toolchain",
] ]
} }
source_set("regexp_fuzzer") { v8_source_set("regexp_fuzzer") {
sources = [ sources = [
"test/fuzzer/regexp.cc", "test/fuzzer/regexp.cc",
] ]
...@@ -2210,17 +2169,13 @@ source_set("regexp_fuzzer") { ...@@ -2210,17 +2169,13 @@ source_set("regexp_fuzzer") {
":fuzzer_support", ":fuzzer_support",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":libplatform_config", ":libplatform_config",
":features",
":toolchain",
] ]
} }
source_set("wasm_fuzzer") { v8_source_set("wasm_fuzzer") {
sources = [ sources = [
"test/fuzzer/wasm.cc", "test/fuzzer/wasm.cc",
] ]
...@@ -2229,17 +2184,13 @@ source_set("wasm_fuzzer") { ...@@ -2229,17 +2184,13 @@ source_set("wasm_fuzzer") {
":fuzzer_support", ":fuzzer_support",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":libplatform_config", ":libplatform_config",
":features",
":toolchain",
] ]
} }
source_set("wasm_asmjs_fuzzer") { v8_source_set("wasm_asmjs_fuzzer") {
sources = [ sources = [
"test/fuzzer/wasm-asmjs.cc", "test/fuzzer/wasm-asmjs.cc",
] ]
...@@ -2248,12 +2199,8 @@ source_set("wasm_asmjs_fuzzer") { ...@@ -2248,12 +2199,8 @@ source_set("wasm_asmjs_fuzzer") {
":fuzzer_support", ":fuzzer_support",
] ]
configs -= [ "//build/config/compiler:chromium_code" ] configs = [
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
":internal_config", ":internal_config",
":libplatform_config", ":libplatform_config",
":features",
":toolchain",
] ]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment