blob: 24f65679a4731518b729d8d4ab1f9767e68108c9 [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001# Copyright 2016 the V8 project authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/v8_target_cpu.gni")
6import("//build/config/sanitizers/sanitizers.gni")
7
8declare_args() {
9 # Turns on compiler optimizations in V8 in Debug build.
10 v8_optimized_debug = true
11
12 # Enable the snapshot feature, for fast context creation.
13 # http://v8project.blogspot.com/2015/09/custom-startup-snapshots.html
14 v8_use_snapshot = true
15
16 # Use external files for startup data blobs:
17 # the JS builtins sources and the start snapshot.
18 v8_use_external_startup_data = !is_ios
19}
20
21###############################################################################
22# Templates
23#
24
25# Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute
26# paths for all configs in templates as they are shared in different
27# subdirectories.
28path_prefix = get_path_info("../", "abspath")
29
30# Common configs to remove or add in all v8 targets.
31remove_configs = [ "//build/config/compiler:chromium_code" ]
32add_configs = [
33 "//build/config/compiler:no_chromium_code",
34 path_prefix + ":features",
35 path_prefix + ":toolchain",
36]
37
38if (is_debug && !v8_optimized_debug) {
39 remove_configs += [ "//build/config/compiler:default_optimization" ]
40 add_configs += [ "//build/config/compiler:no_optimize" ]
41} else {
42 remove_configs += [ "//build/config/compiler:default_optimization" ]
43
44 # TODO(crbug.com/621335) Rework this so that we don't have the confusion
45 # between "optimize_speed" and "optimize_max".
46 if (is_posix && !is_android && !is_nacl && !using_sanitizer) {
47 add_configs += [ "//build/config/compiler:optimize_speed" ]
48 } else {
49 add_configs += [ "//build/config/compiler:optimize_max" ]
50 }
51}
52
53# All templates should be kept in sync.
54template("v8_source_set") {
55 source_set(target_name) {
56 forward_variables_from(invoker, "*", [ "configs" ])
57 configs += invoker.configs
58 configs -= remove_configs
59 configs += add_configs
60 }
61}
62
63template("v8_executable") {
64 executable(target_name) {
65 forward_variables_from(invoker, "*", [ "configs" ])
66 configs += invoker.configs
67 configs -= remove_configs
68 configs += add_configs
69 }
70}
71
72template("v8_component") {
73 component(target_name) {
74 forward_variables_from(invoker, "*", [ "configs" ])
75 configs += invoker.configs
76 configs -= remove_configs
77 configs += add_configs
78 }
79}