2016-05-24 08:54:42 +00:00
|
|
|
# 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.
|
|
|
|
|
2016-06-17 07:06:22 +00:00
|
|
|
import("//build/config/v8_target_cpu.gni")
|
2016-06-21 23:35:19 +00:00
|
|
|
import("//build/config/sanitizers/sanitizers.gni")
|
2016-05-24 10:39:57 +00:00
|
|
|
|
2016-05-24 08:54:42 +00:00
|
|
|
declare_args() {
|
2016-06-14 10:07:22 +00:00
|
|
|
# Turns on compiler optimizations in V8 in Debug build.
|
|
|
|
v8_optimized_debug = true
|
|
|
|
|
2016-06-03 08:16:50 +00:00
|
|
|
# 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
|
2016-05-24 10:39:57 +00:00
|
|
|
}
|
2016-06-14 10:07:22 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# 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" ]
|
2016-06-21 23:35:19 +00:00
|
|
|
|
|
|
|
# TODO(crbug.com/621335) Rework this so that we don't have the confusion
|
|
|
|
# between "optimize_speed" and "optimize_max".
|
|
|
|
if (is_posix && !is_android && !is_nacl && !using_sanitizer) {
|
|
|
|
add_configs += [ "//build/config/compiler:optimize_speed" ]
|
|
|
|
} else {
|
|
|
|
add_configs += [ "//build/config/compiler:optimize_max" ]
|
|
|
|
}
|
2016-06-14 10:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
}
|
|
|
|
}
|