Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Side by Side Diff: runtime/BUILD.gn

Issue 2350583002: Starting work on full GN build (Closed)
Patch Set: Fixes for Fuchsia and Flutter. Cleanup. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/toolchain/linux/BUILD.gn ('k') | runtime/bin/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 # TODO(zra): These build arguments should likely be moved to a gni file that is
6 # included in BUILD.gn files that care about the values of the flags. For now,
7 # since the GN build only happens as part of a Mojo build there is no need for
8 # the indirection.
9 declare_args() { 5 declare_args() {
10 # Instead of using is_debug, we introduce a different flag for specifying a 6 # Instead of using is_debug, we introduce a different flag for specifying a
11 # Debug build of Dart so that clients can still use a Release build of Dart 7 # Debug build of Dart so that clients can still use a Release build of Dart
12 # while themselves doing a Debug build. 8 # while themselves doing a Debug build.
13 dart_debug = false 9 dart_debug = false
14 10
15 # Set the runtime mode. This affects how the runtime is built and what 11 # Set the runtime mode. This affects how the runtime is built and what
16 # features it has. Valid values are: 12 # features it has. Valid values are:
17 # 'develop' (the default) - VM is built to run as a JIT with all development 13 # 'develop' (the default) - VM is built to run as a JIT with all development
18 # features enabled. 14 # features enabled.
19 # 'profile' - The VM is built to run with AOT compiled code with only the 15 # 'profile' - The VM is built to run with AOT compiled code with only the
20 # CPU profiling features enabled. 16 # CPU profiling features enabled.
21 # 'release' - The VM is built to run with AOT compiled code with no developer 17 # 'release' - The VM is built to run with AOT compiled code with no developer
22 # features enabled. 18 # features enabled.
19 #
20 # These settings are only used for Flutter, at the moment. A standalone build
21 # of the Dart VM should leave this set to "develop", and should set
22 # 'is_debug', 'is_release', or 'is_product'.
23 dart_runtime_mode = "develop" 23 dart_runtime_mode = "develop"
24 24
25 # Explicitly set the target architecture in case of precompilation. Leaving 25 # Explicitly set the target architecture in case of precompilation. Leaving
26 # this unspecified results in automatic target architecture detection. 26 # this unspecified results in automatic target architecture detection.
27 # Available options are: arm, arm64, mips, x64 and ia32 27 # Available options are: arm, arm64, mips, x64 and ia32
28 dart_target_arch = "" 28 dart_target_arch = ""
29 29
30 dart_experimental_interpreter = false 30 dart_experimental_interpreter = false
31 } 31 }
32 32
33 config("dart_public_config") { 33 config("dart_public_config") {
34 include_dirs = [ 34 include_dirs = [
35 ".", 35 ".",
36 ] 36 ]
37 } 37 }
38 38
39 # Controls PRODUCT #define. 39 # Adds PRODUCT define if Flutter has specified "release" for dart_runtime_mode
40 config("dart_product_config") { 40 config("dart_maybe_product_config") {
41 defines = [] 41 defines = []
42 42
43 if ((dart_runtime_mode != "develop") && 43 if ((dart_runtime_mode != "develop") &&
44 (dart_runtime_mode != "profile") && 44 (dart_runtime_mode != "profile") &&
45 (dart_runtime_mode != "release")) { 45 (dart_runtime_mode != "release")) {
46 print("Invalid |dart_runtime_mode|") 46 print("Invalid |dart_runtime_mode|")
47 assert(false) 47 assert(false)
48 } 48 }
49 49
50 if (dart_runtime_mode == "release") { 50 if (dart_runtime_mode == "release") {
51 if (dart_debug) { 51 if (dart_debug) {
52 print("Debug and release mode are mutually exclusive.") 52 print("Debug and release mode are mutually exclusive.")
53 } 53 }
54 assert(!dart_debug) 54 assert(!dart_debug)
55 defines += ["PRODUCT"] 55 defines += ["PRODUCT"]
56 } 56 }
57 } 57 }
58 58
59 # Controls DART_PRECOMPILED_RUNTIME #define. 59 # Adds the DART_PRECOMPILED_RUNTIME define if Flutter has specified "profile" or
60 config("dart_precompiled_runtime_config") { 60 # "release" for dart_runtime_mode.
61 config("dart_maybe_precompiled_runtime_config") {
61 defines = [] 62 defines = []
62 63
63 if ((dart_runtime_mode != "develop") && 64 if ((dart_runtime_mode != "develop") &&
64 (dart_runtime_mode != "profile") && 65 (dart_runtime_mode != "profile") &&
65 (dart_runtime_mode != "release")) { 66 (dart_runtime_mode != "release")) {
66 print("Invalid |dart_runtime_mode|") 67 print("Invalid |dart_runtime_mode|")
67 assert(false) 68 assert(false)
68 } 69 }
69 70
70 if (dart_runtime_mode == "release") { 71 if (dart_runtime_mode == "release") {
71 if (dart_debug) { 72 if (dart_debug) {
72 print("Debug and release mode are mutually exclusive.") 73 print("Debug and release mode are mutually exclusive.")
73 } 74 }
74 assert(!dart_debug) 75 assert(!dart_debug)
75 76
76 if (!dart_experimental_interpreter) { 77 if (!dart_experimental_interpreter) {
77 defines += ["DART_PRECOMPILED_RUNTIME"] 78 defines += ["DART_PRECOMPILED_RUNTIME"]
78 } 79 }
79 } else if (dart_runtime_mode == "profile") { 80 } else if (dart_runtime_mode == "profile") {
80 if (!dart_experimental_interpreter) { 81 if (!dart_experimental_interpreter) {
81 defines += ["DART_PRECOMPILED_RUNTIME"] 82 defines += ["DART_PRECOMPILED_RUNTIME"]
82 } 83 }
83 } 84 }
84 } 85 }
85 86
87 config("dart_precompiled_runtime_config") {
88 defines = []
89 defines += ["DART_PRECOMPILED_RUNTIME"]
90 }
91
86 # Controls DART_PRECOMPILER #define. 92 # Controls DART_PRECOMPILER #define.
87 config("dart_precompiler_config") { 93 config("dart_precompiler_config") {
88 defines = [] 94 defines = []
89 defines += ["DART_PRECOMPILER"] 95 defines += ["DART_PRECOMPILER"]
90 } 96 }
91 97
98 config("dart_no_snapshot_config") {
99 defines = []
100 defines += ["DART_NO_SNAPSHOT"]
101 }
102
92 config("dart_config") { 103 config("dart_config") {
93 defines = [] 104 defines = []
94 105
95 if (dart_experimental_interpreter) { 106 if (dart_experimental_interpreter) {
96 dart_target_arch = "dbc" 107 dart_target_arch = "dbc"
97 } 108 }
98 109
99 if (dart_target_arch != "") { 110 if (dart_target_arch != "") {
100 if (dart_target_arch == "arm") { 111 if ((dart_target_arch == "arm") ||
112 (dart_target_arch == "simarm")) {
101 defines += [ "TARGET_ARCH_ARM" ] 113 defines += [ "TARGET_ARCH_ARM" ]
102 if (target_os == "mac" || target_os == "ios") { 114 if (target_os == "mac" || target_os == "ios") {
103 defines += [ "TARGET_ABI_IOS" ] 115 defines += [ "TARGET_ABI_IOS" ]
104 } else { 116 } else {
105 defines += [ "TARGET_ABI_EABI" ] 117 defines += [ "TARGET_ABI_EABI" ]
106 } 118 }
107 } else if (dart_target_arch == "arm64") { 119 } else if ((dart_target_arch == "armv6") ||
120 (dart_target_arch == "simarmv6")) {
121 defines += [ "TARGET_ARCH_ARM" ]
122 defines += [ "TARGET_ARCH_ARM_6" ]
123 defines += [ "TARGET_ABI_EABI" ]
124 } else if ((dart_target_arch == "armv5te") ||
125 (dart_target_arch == "simarmv5te")) {
126 defines += [ "TARGET_ARCH_ARM" ]
127 defines += [ "TARGET_ARCH_ARM_5TE" ]
128 defines += [ "TARGET_ABI_EABI" ]
129 } else if ((dart_target_arch == "arm64") ||
130 (dart_target_arch == "simarm64")) {
108 defines += [ "TARGET_ARCH_ARM64" ] 131 defines += [ "TARGET_ARCH_ARM64" ]
109 } else if (dart_target_arch == "mips") { 132 } else if ((dart_target_arch == "mips") ||
133 (dart_target_arch == "simmips")) {
110 defines += [ "TARGET_ARCH_MIPS" ] 134 defines += [ "TARGET_ARCH_MIPS" ]
111 } else if (dart_target_arch == "x64") { 135 } else if (dart_target_arch == "x64") {
112 defines += [ "TARGET_ARCH_X64" ] 136 defines += [ "TARGET_ARCH_X64" ]
113 } else if (dart_target_arch == "ia32") { 137 } else if (dart_target_arch == "ia32") {
114 defines += [ "TARGET_ARCH_IA32" ] 138 defines += [ "TARGET_ARCH_IA32" ]
115 } else if (dart_target_arch == "dbc") { 139 } else if ((dart_target_arch == "dbc") ||
140 (dart_target_arch == "simdbc") ||
141 (dart_target_arch == "simdbc64")) {
116 defines += [ "TARGET_ARCH_DBC" ] 142 defines += [ "TARGET_ARCH_DBC" ]
143 defines += [ "USING_SIMULATOR" ]
117 } else { 144 } else {
118 print("Invalid |dart_target_arch|") 145 print("Invalid |dart_target_arch|")
119 assert(false) 146 assert(false)
120 } 147 }
121 } 148 }
122 149
123 if (dart_debug) { 150 if (dart_debug) {
124 defines += ["DEBUG"] 151 defines += ["DEBUG"]
125 } else { 152 } else {
126 defines += ["NDEBUG"] 153 defines += ["NDEBUG"]
(...skipping 25 matching lines...) Expand all
152 } 179 }
153 180
154 if (defined(is_asan) && is_asan) { 181 if (defined(is_asan) && is_asan) {
155 ldflags = [ 182 ldflags = [
156 "-Wl,-u_sanitizer_options_link_helper", 183 "-Wl,-u_sanitizer_options_link_helper",
157 "-fsanitize=address", 184 "-fsanitize=address",
158 ] 185 ]
159 } 186 }
160 } 187 }
161 188
162 static_library("libdart") { 189 template("libdart_library") {
163 configs += [":dart_config", 190 extra_configs = []
164 ":dart_product_config", 191 if (defined(invoker.extra_configs)) {
165 ":dart_precompiled_runtime_config"] 192 extra_configs += invoker.extra_configs
166 deps = [ 193 }
194 extra_deps = []
195 if (defined(invoker.extra_deps)) {
196 extra_deps += invoker.extra_deps
197 }
198 static_library(target_name) {
199 configs += [
200 ":dart_config",
201 ":dart_maybe_product_config"
202 ] + extra_configs
203 deps = [
204 "vm:libdart_platform",
205 "third_party/double-conversion/src:libdouble_conversion",
206 ":generate_version_cc_file",
207 ] + extra_deps
208 include_dirs = [
209 ".",
210 ]
211 public_configs = [":dart_public_config"]
212 sources = [
213 "include/dart_api.h",
214 "include/dart_mirrors_api.h",
215 "include/dart_native_api.h",
216 "include/dart_tools_api.h",
217 "vm/dart_api_impl.cc",
218 "vm/debugger_api_impl.cc",
219 "vm/mirrors_api_impl.cc",
220 "vm/native_api_impl.cc",
221 "vm/version.h",
222 "$target_gen_dir/version.cc",
223 ]
224 defines = [
225 "DART_SHARED_LIB",
226 ]
227 }
228 }
229
230 libdart_library("libdart") {
231 extra_configs = [
232 ":dart_maybe_precompiled_runtime_config"
233 ]
234 extra_deps = [
167 "vm:libdart_lib", 235 "vm:libdart_lib",
168 "vm:libdart_vm", 236 "vm:libdart_vm",
169 "third_party/double-conversion/src:libdouble_conversion",
170 ":generate_version_cc_file",
171 ]
172 include_dirs = [
173 ".",
174 ]
175 public_configs = [":dart_public_config"]
176 sources = [
177 "include/dart_api.h",
178 "include/dart_mirrors_api.h",
179 "include/dart_native_api.h",
180 "include/dart_tools_api.h",
181 "vm/dart_api_impl.cc",
182 "vm/debugger_api_impl.cc",
183 "vm/mirrors_api_impl.cc",
184 "vm/native_api_impl.cc",
185 "vm/version.h",
186 "$target_gen_dir/version.cc",
187 ] 237 ]
188 } 238 }
189 239
240 libdart_library("libdart_precompiled_runtime") {
241 extra_configs = [
242 ":dart_precompiled_runtime_config"
243 ]
244 extra_deps = [
245 "vm:libdart_lib_precompiled_runtime",
246 "vm:libdart_vm_precompiled_runtime",
247 ]
248 }
249
250 libdart_library("libdart_nosnapshot") {
251 extra_configs = [
252 ":dart_no_snapshot_config",
253 ":dart_maybe_precompiled_runtime_config"
254 ]
255 extra_deps = [
256 "vm:libdart_lib_nosnapshot",
257 "vm:libdart_vm_nosnapshot",
258 ]
259 }
260
261 libdart_library("libdart_nosnapshot_precompiled_runtime") {
262 extra_configs = [
263 ":dart_no_snapshot_config",
264 ":dart_precompiled_runtime_config"
265 ]
266 extra_deps = [
267 "vm:libdart_lib_nosnapshot_precompiled_runtime",
268 "vm:libdart_vm_nosnapshot_precompiled_runtime",
269 ]
270 }
271
272 libdart_library("libdart_nosnapshot_with_precompiler") {
273 extra_configs = [
274 ":dart_no_snapshot_config",
275 ":dart_precompiler_config",
276 ]
277 extra_deps = [
278 "vm:libdart_lib_nosnapshot_with_precompiler",
279 "vm:libdart_vm_nosnapshot_with_precompiler",
280 ]
281 }
282
190 action("generate_version_cc_file") { 283 action("generate_version_cc_file") {
191 deps = [ 284 deps = [
192 ":libdart_dependency_helper", 285 ":libdart_dependency_helper",
193 ] 286 ]
194 inputs = [ 287 inputs = [
195 "../tools/utils.py", 288 "../tools/utils.py",
196 "../tools/print_version.py", 289 "../tools/print_version.py",
197 "../tools/VERSION", 290 "../tools/VERSION",
198 "vm/version_in.cc", 291 "vm/version_in.cc",
199 ] 292 ]
200 output = "$target_gen_dir/version.cc" 293 output = "$target_gen_dir/version.cc"
201 outputs = [ output, ] 294 outputs = [ output, ]
202 295
203 script = "../tools/make_version.py" 296 script = "../tools/make_version.py"
204 args = [ 297 args = [
205 "--quiet", 298 "--quiet",
206 "--output", rebase_path(output, root_build_dir), 299 "--output", rebase_path(output, root_build_dir),
207 "--input", rebase_path("vm/version_in.cc", root_build_dir), 300 "--input", rebase_path("vm/version_in.cc", root_build_dir),
208 ] 301 ]
209 } 302 }
210 303
211 304
212 executable("libdart_dependency_helper") { 305 executable("libdart_dependency_helper") {
213 configs += [":dart_config", 306 configs += [":dart_config",
214 ":dart_product_config", 307 ":dart_maybe_product_config"]
215 ":dart_precompiled_runtime_config"]
216 deps = [ 308 deps = [
217 "vm:libdart_lib_nosnapshot", 309 "vm:libdart_lib_nosnapshot",
218 "vm:libdart_lib", 310 "vm:libdart_lib",
219 "vm:libdart_vm", 311 "vm:libdart_vm",
220 "vm:libdart_platform", 312 "vm:libdart_platform",
221 "third_party/double-conversion/src:libdouble_conversion", 313 "third_party/double-conversion/src:libdouble_conversion",
222 ] 314 ]
223 sources = [ 315 sources = [
224 "vm/libdart_dependency_helper.cc", 316 "vm/libdart_dependency_helper.cc",
225 ] 317 ]
226 } 318 }
OLDNEW
« no previous file with comments | « build/toolchain/linux/BUILD.gn ('k') | runtime/bin/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698