v8/gni/v8.gni
machenbach c1b2499027 [gn] Improve sharing common configuration
This moves common configs used by all v8 targets into
common templates.

This also fixes using v8_optimized_debug correctly in
executables and components.

BUG=chromium:474921
NOTRY=true

Review-Url: https://codereview.chromium.org/2054803003
Cr-Commit-Position: refs/heads/master@{#36956}
2016-06-14 10:09:37 +00:00

87 lines
2.6 KiB
Plaintext

# Copyright 2016 the V8 project 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/sanitizers/sanitizers.gni")
declare_args() {
# Turns on compiler optimizations in V8 in Debug build.
v8_optimized_debug = true
# Enable the snapshot feature, for fast context creation.
# http://v8project.blogspot.com/2015/09/custom-startup-snapshots.html
v8_use_snapshot = true
# Use external files for startup data blobs:
# the JS builtins sources and the start snapshot.
v8_use_external_startup_data = !is_ios
# V8 generates code for this architecture. If v8_target_arch differs from
# target_cpu, a simulator will be run.
v8_target_arch = ""
}
if (v8_target_arch == "") {
if (is_msan) {
# Running the V8-generated code on an ARM simulator is a powerful hack that
# allows the tool to see the memory accesses from JITted code. Without this
# flag, JS code causes false positive reports from MSan.
v8_target_arch = "arm64"
} else {
v8_target_arch = target_cpu
}
}
###############################################################################
# Templates
#
# Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute
# paths for all configs in templates as they are shared in different
# subdirectories.
path_prefix = get_path_info("../", "abspath")
# Common configs to remove or add in all v8 targets.
remove_configs = [ "//build/config/compiler:chromium_code" ]
add_configs = [
"//build/config/compiler:no_chromium_code",
path_prefix + ":features",
path_prefix + ":toolchain",
]
if (is_debug && !v8_optimized_debug) {
remove_configs += [ "//build/config/compiler:default_optimization" ]
add_configs += [ "//build/config/compiler:no_optimize" ]
} else {
remove_configs += [ "//build/config/compiler:default_optimization" ]
add_configs += [ "//build/config/compiler:optimize_max" ]
}
# All templates should be kept in sync.
template("v8_source_set") {
source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= remove_configs
configs += add_configs
}
}
template("v8_executable") {
executable(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= remove_configs
configs += add_configs
}
}
template("v8_component") {
component(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= remove_configs
configs += add_configs
}
}