OLD | NEW |
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 | 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, | 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 | 7 # since the GN build only happens as part of a Mojo build there is no need for |
8 # the indirection. | 8 # the indirection. |
9 declare_args() { | 9 declare_args() { |
10 # Instead of using is_debug, we introduce a different flag for specifying a | 10 # 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 | 11 # Debug build of Dart so that clients can still use a Release build of Dart |
12 # while themselves doing a Debug build. | 12 # while themselves doing a Debug build. |
13 dart_debug = false | 13 dart_debug = false |
14 | 14 |
15 # Product mode drops many features (e.g. debugger, profiler, etc) in order to | 15 # Set the runtime mode. This affects how the runtime is built and what |
16 # shrink download size and decrease memory and cpu usage. | 16 # features it has. Valid values are: |
17 dart_product = false | 17 # 'develop' (the default) - VM is built to run as a JIT with all development |
| 18 # features enabled. |
| 19 # 'profile' - The VM is built to run with AOT compiled code with only the |
| 20 # CPU profiling features enabled. |
| 21 # 'release' - The VM is built to run with AOT compiled code with no developer |
| 22 # features enabled. |
| 23 dart_runtime_mode = "develop" |
| 24 |
| 25 # Controls whether or not the Dart AOT compiler is part of the built runtime. |
| 26 dart_include_aot_compiler = false |
18 | 27 |
19 # Explicitly set the target architecture in case of precompilation. Leaving | 28 # Explicitly set the target architecture in case of precompilation. Leaving |
20 # this unspecified results in automatic target architecture detection. | 29 # this unspecified results in automatic target architecture detection. |
21 # Available options are: arm, arm64, mips, x64 and ia32 | 30 # Available options are: arm, arm64, mips, x64 and ia32 |
22 dart_target_arch = "" | 31 dart_target_arch = "" |
23 } | 32 } |
24 | 33 |
25 config("dart_public_config") { | 34 config("dart_public_config") { |
26 include_dirs = [ | 35 include_dirs = [ |
27 ".", | 36 ".", |
28 ] | 37 ] |
29 } | 38 } |
30 | 39 |
31 config("dart_config") { | 40 config("dart_config") { |
32 defines = [] | 41 defines = [] |
33 | 42 |
34 if (dart_target_arch != "") { | 43 if ((dart_runtime_mode != "develop") && |
35 if (dart_target_arch == "arm") { | 44 (dart_runtime_mode != "profile") && |
36 defines += [ "TARGET_ARCH_ARM" ] | 45 (dart_runtime_mode != "release")) { |
37 } else if (dart_target_arch == "arm64") { | 46 print("Invalid |dart_runtime_mode|") |
38 defines += [ "TARGET_ARCH_ARM64" ] | 47 assert(false) |
39 } else if (dart_target_arch == "mips") { | |
40 defines += [ "TARGET_ARCH_MIPS" ] | |
41 } else if (dart_target_arch == "x64") { | |
42 defines += [ "TARGET_ARCH_X64" ] | |
43 } else if (dart_target_arch == "ia32") { | |
44 defines += [ "TARGET_ARCH_IA32" ] | |
45 } else { | |
46 print("Invalid |dart_target_arch|") | |
47 assert(false) | |
48 } | |
49 } | 48 } |
50 | 49 |
51 if (dart_debug) { | 50 if (dart_runtime_mode == "release") { |
52 defines += ["DEBUG"] | 51 if (dart_debug) { |
53 } else { | 52 print("Debug and release mode are mutually exclusive.") |
54 defines += ["NDEBUG"] | 53 } |
| 54 assert(!dart_debug) |
| 55 defines += ["DART_PRECOMPILED_RUNTIME"] |
| 56 defines += ["PRODUCT"] |
| 57 } else if (dart_runtime_mode == "profile") { |
| 58 if (dart_debug) { |
| 59 print("Debug and profile mode are mutually exclusive.") |
| 60 } |
| 61 assert(!dart_debug) |
| 62 defines += ["DART_PRECOMPILED_RUNTIME"] |
55 } | 63 } |
56 | 64 |
57 if (dart_product) { | 65 if (dart_include_aot_compiler) { |
58 if (dart_debug) { | 66 defines += ["DART_PRECOMPILER"] |
59 print("Debug and product mode are mutually exclusive.") | |
60 } | |
61 assert(!dart_debug) | |
62 defines += ["PRODUCT"] | |
63 } | 67 } |
64 | 68 |
65 # Ideally this would only be enabled for gen_snapshot | |
66 defines += ["DART_PRECOMPILER"] | |
67 | |
68 cflags = [ | |
69 "-Werror", | |
70 "-Wall", | |
71 "-Wextra", # Also known as -W. | |
72 "-Wno-unused-parameter", | |
73 "-Wnon-virtual-dtor", | |
74 "-Wvla", | |
75 "-Wno-conversion-null", | |
76 "-Woverloaded-virtual", | |
77 "-g3", | |
78 "-ggdb3", | |
79 "-fno-rtti", | |
80 "-fno-exceptions", | |
81 ] | |
82 | |
83 if (dart_debug) { | |
84 cflags += [ | |
85 "-O1", | |
86 ] | |
87 } else { | |
88 cflags += [ | |
89 "-O3", | |
90 ] | |
91 } | |
92 | |
93 if (is_asan) { | |
94 ldflags = [ | |
95 "-Wl,-u_sanitizer_options_link_helper", | |
96 "-fsanitize=address", | |
97 ] | |
98 } | |
99 } | |
100 | |
101 config("dart_config_no_precompiler") { | |
102 defines = [] | |
103 | |
104 if (dart_target_arch != "") { | 69 if (dart_target_arch != "") { |
105 if (dart_target_arch == "arm") { | 70 if (dart_target_arch == "arm") { |
106 defines += [ "TARGET_ARCH_ARM" ] | 71 defines += [ "TARGET_ARCH_ARM" ] |
107 } else if (dart_target_arch == "arm64") { | 72 } else if (dart_target_arch == "arm64") { |
108 defines += [ "TARGET_ARCH_ARM64" ] | 73 defines += [ "TARGET_ARCH_ARM64" ] |
109 } else if (dart_target_arch == "mips") { | 74 } else if (dart_target_arch == "mips") { |
110 defines += [ "TARGET_ARCH_MIPS" ] | 75 defines += [ "TARGET_ARCH_MIPS" ] |
111 } else if (dart_target_arch == "x64") { | 76 } else if (dart_target_arch == "x64") { |
112 defines += [ "TARGET_ARCH_X64" ] | 77 defines += [ "TARGET_ARCH_X64" ] |
113 } else if (dart_target_arch == "ia32") { | 78 } else if (dart_target_arch == "ia32") { |
114 defines += [ "TARGET_ARCH_IA32" ] | 79 defines += [ "TARGET_ARCH_IA32" ] |
115 } else { | 80 } else { |
116 print("Invalid |dart_target_arch|") | 81 print("Invalid |dart_target_arch|") |
117 assert(false) | 82 assert(false) |
118 } | 83 } |
119 } | 84 } |
120 | 85 |
121 if (dart_debug) { | 86 if (dart_debug) { |
122 defines += ["DEBUG"] | 87 defines += ["DEBUG"] |
123 } else { | 88 } else { |
124 defines += ["NDEBUG"] | 89 defines += ["NDEBUG"] |
125 } | 90 } |
126 | 91 |
127 if (dart_product) { | |
128 if (dart_debug) { | |
129 print("Debug and product mode are mutually exclusive.") | |
130 } | |
131 assert(!dart_debug) | |
132 defines += ["PRODUCT"] | |
133 } | |
134 | |
135 cflags = [ | 92 cflags = [ |
136 "-Werror", | 93 "-Werror", |
137 "-Wall", | 94 "-Wall", |
138 "-Wextra", # Also known as -W. | 95 "-Wextra", # Also known as -W. |
139 "-Wno-unused-parameter", | 96 "-Wno-unused-parameter", |
140 "-Wnon-virtual-dtor", | 97 "-Wnon-virtual-dtor", |
141 "-Wvla", | 98 "-Wvla", |
142 "-Wno-conversion-null", | 99 "-Wno-conversion-null", |
143 "-Woverloaded-virtual", | 100 "-Woverloaded-virtual", |
144 "-g3", | 101 "-g3", |
(...skipping 13 matching lines...) Expand all Loading... |
158 } | 115 } |
159 | 116 |
160 if (is_asan) { | 117 if (is_asan) { |
161 ldflags = [ | 118 ldflags = [ |
162 "-Wl,-u_sanitizer_options_link_helper", | 119 "-Wl,-u_sanitizer_options_link_helper", |
163 "-fsanitize=address", | 120 "-fsanitize=address", |
164 ] | 121 ] |
165 } | 122 } |
166 } | 123 } |
167 | 124 |
168 | |
169 static_library("libdart") { | 125 static_library("libdart") { |
170 configs += [":dart_config"] | 126 configs += [":dart_config"] |
171 deps = [ | 127 deps = [ |
172 "vm:libdart_lib", | 128 "vm:libdart_lib", |
173 "vm:libdart_vm", | 129 "vm:libdart_vm", |
174 "third_party/double-conversion/src:libdouble_conversion", | 130 "third_party/double-conversion/src:libdouble_conversion", |
175 ":generate_version_cc_file", | 131 ":generate_version_cc_file", |
176 ] | 132 ] |
177 include_dirs = [ | 133 include_dirs = [ |
178 ".", | 134 ".", |
179 ] | 135 ] |
180 public_configs = [":dart_public_config"] | 136 public_configs = [":dart_public_config"] |
181 sources = [ | 137 sources = [ |
182 "include/dart_api.h", | 138 "include/dart_api.h", |
183 "include/dart_mirrors_api.h", | 139 "include/dart_mirrors_api.h", |
184 "include/dart_native_api.h", | 140 "include/dart_native_api.h", |
185 "include/dart_tools_api.h", | 141 "include/dart_tools_api.h", |
186 "vm/dart_api_impl.cc", | 142 "vm/dart_api_impl.cc", |
187 "vm/debugger_api_impl.cc", | 143 "vm/debugger_api_impl.cc", |
188 "vm/mirrors_api_impl.cc", | 144 "vm/mirrors_api_impl.cc", |
189 "vm/native_api_impl.cc", | 145 "vm/native_api_impl.cc", |
190 "vm/version.h", | 146 "vm/version.h", |
191 "$target_gen_dir/version.cc", | 147 "$target_gen_dir/version.cc", |
192 ] | 148 ] |
193 } | 149 } |
194 | 150 |
195 | 151 |
196 static_library("libdart_precompiled_runtime") { | |
197 configs += [":dart_config_no_precompiler"] | |
198 deps = [ | |
199 "vm:libdart_lib_precompiled_runtime", | |
200 "vm:libdart_vm_precompiled_runtime", | |
201 "third_party/double-conversion/src:libdouble_conversion", | |
202 ":generate_version_cc_file", | |
203 ] | |
204 include_dirs = [ | |
205 ".", | |
206 ] | |
207 public_configs = [":dart_public_config"] | |
208 sources = [ | |
209 "include/dart_api.h", | |
210 "include/dart_mirrors_api.h", | |
211 "include/dart_native_api.h", | |
212 "include/dart_tools_api.h", | |
213 "vm/dart_api_impl.cc", | |
214 "vm/debugger_api_impl.cc", | |
215 "vm/mirrors_api_impl.cc", | |
216 "vm/native_api_impl.cc", | |
217 "vm/version.h", | |
218 "$target_gen_dir/version.cc", | |
219 ] | |
220 defines = [ | |
221 "DART_PRECOMPILED_RUNTIME", | |
222 ] | |
223 } | |
224 | |
225 | |
226 action("generate_version_cc_file") { | 152 action("generate_version_cc_file") { |
227 deps = [ | 153 deps = [ |
228 ":libdart_dependency_helper", | 154 ":libdart_dependency_helper", |
229 ] | 155 ] |
230 inputs = [ | 156 inputs = [ |
231 "../tools/utils.py", | 157 "../tools/utils.py", |
232 "../tools/print_version.py", | 158 "../tools/print_version.py", |
233 "../tools/VERSION", | 159 "../tools/VERSION", |
234 "vm/version_in.cc", | 160 "vm/version_in.cc", |
235 ] | 161 ] |
(...skipping 16 matching lines...) Expand all Loading... |
252 "vm:libdart_lib_nosnapshot", | 178 "vm:libdart_lib_nosnapshot", |
253 "vm:libdart_lib", | 179 "vm:libdart_lib", |
254 "vm:libdart_vm", | 180 "vm:libdart_vm", |
255 "vm:libdart_platform", | 181 "vm:libdart_platform", |
256 "third_party/double-conversion/src:libdouble_conversion", | 182 "third_party/double-conversion/src:libdouble_conversion", |
257 ] | 183 ] |
258 sources = [ | 184 sources = [ |
259 "vm/libdart_dependency_helper.cc", | 185 "vm/libdart_dependency_helper.cc", |
260 ] | 186 ] |
261 } | 187 } |
OLD | NEW |