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" | |
18 | 24 |
19 # Explicitly set the target architecture in case of precompilation. Leaving | 25 # Explicitly set the target architecture in case of precompilation. Leaving |
20 # this unspecified results in automatic target architecture detection. | 26 # this unspecified results in automatic target architecture detection. |
21 # Available options are: arm, arm64, mips, x64 and ia32 | 27 # Available options are: arm, arm64, mips, x64 and ia32 |
22 dart_target_arch = "" | 28 dart_target_arch = "" |
23 } | 29 } |
24 | 30 |
25 config("dart_public_config") { | 31 config("dart_public_config") { |
26 include_dirs = [ | 32 include_dirs = [ |
27 ".", | 33 ".", |
28 ] | 34 ] |
29 } | 35 } |
30 | 36 |
31 config("dart_config") { | 37 config("dart_config") { |
32 defines = [] | 38 defines = [] |
33 | 39 |
34 if (dart_target_arch != "") { | 40 if ((dart_runtime_mode != "develop") && |
35 if (dart_target_arch == "arm") { | 41 (dart_runtime_mode != "profile") && |
36 defines += [ "TARGET_ARCH_ARM" ] | 42 (dart_runtime_mode != "release")) { |
37 } else if (dart_target_arch == "arm64") { | 43 print("Invalid |dart_runtime_mode|") |
38 defines += [ "TARGET_ARCH_ARM64" ] | 44 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 } | 45 } |
50 | 46 |
51 if (dart_debug) { | 47 if (dart_runtime_mode == "release") { |
52 defines += ["DEBUG"] | |
53 } else { | |
54 defines += ["NDEBUG"] | |
55 } | |
56 | |
57 if (dart_product) { | |
58 if (dart_debug) { | 48 if (dart_debug) { |
59 print("Debug and product mode are mutually exclusive.") | 49 print("Debug and release mode are mutually exclusive.") |
60 } | 50 } |
61 assert(!dart_debug) | 51 assert(!dart_debug) |
52 defines += ["DART_PRECOMPILED_RUNTIME"] | |
62 defines += ["PRODUCT"] | 53 defines += ["PRODUCT"] |
63 } | 54 } |
64 | 55 |
65 # Ideally this would only be enabled for gen_snapshot | 56 if (dart_runtime_mode == "profile") { |
Florian Schneider
2016/04/19 22:05:23
else if
| |
66 defines += ["DART_PRECOMPILER"] | 57 if (dart_debug) { |
67 | 58 print("Debug and profile mode are mutually exclusive.") |
68 cflags = [ | 59 } |
69 "-Werror", | 60 assert(!dart_debug) |
70 "-Wall", | 61 defines += ["DART_PRECOMPILED_RUNTIME"] |
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 } | 62 } |
92 | 63 |
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 != "") { | 64 if (dart_target_arch != "") { |
105 if (dart_target_arch == "arm") { | 65 if (dart_target_arch == "arm") { |
106 defines += [ "TARGET_ARCH_ARM" ] | 66 defines += [ "TARGET_ARCH_ARM" ] |
107 } else if (dart_target_arch == "arm64") { | 67 } else if (dart_target_arch == "arm64") { |
108 defines += [ "TARGET_ARCH_ARM64" ] | 68 defines += [ "TARGET_ARCH_ARM64" ] |
109 } else if (dart_target_arch == "mips") { | 69 } else if (dart_target_arch == "mips") { |
110 defines += [ "TARGET_ARCH_MIPS" ] | 70 defines += [ "TARGET_ARCH_MIPS" ] |
111 } else if (dart_target_arch == "x64") { | 71 } else if (dart_target_arch == "x64") { |
112 defines += [ "TARGET_ARCH_X64" ] | 72 defines += [ "TARGET_ARCH_X64" ] |
113 } else if (dart_target_arch == "ia32") { | 73 } else if (dart_target_arch == "ia32") { |
114 defines += [ "TARGET_ARCH_IA32" ] | 74 defines += [ "TARGET_ARCH_IA32" ] |
115 } else { | 75 } else { |
116 print("Invalid |dart_target_arch|") | 76 print("Invalid |dart_target_arch|") |
117 assert(false) | 77 assert(false) |
118 } | 78 } |
119 } | 79 } |
120 | 80 |
121 if (dart_debug) { | 81 if (dart_debug) { |
122 defines += ["DEBUG"] | 82 defines += ["DEBUG"] |
123 } else { | 83 } else { |
124 defines += ["NDEBUG"] | 84 defines += ["NDEBUG"] |
125 } | 85 } |
126 | 86 |
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 = [ | 87 cflags = [ |
136 "-Werror", | 88 "-Werror", |
137 "-Wall", | 89 "-Wall", |
138 "-Wextra", # Also known as -W. | 90 "-Wextra", # Also known as -W. |
139 "-Wno-unused-parameter", | 91 "-Wno-unused-parameter", |
140 "-Wnon-virtual-dtor", | 92 "-Wnon-virtual-dtor", |
141 "-Wvla", | 93 "-Wvla", |
142 "-Wno-conversion-null", | 94 "-Wno-conversion-null", |
143 "-Woverloaded-virtual", | 95 "-Woverloaded-virtual", |
144 "-g3", | 96 "-g3", |
(...skipping 13 matching lines...) Expand all Loading... | |
158 } | 110 } |
159 | 111 |
160 if (is_asan) { | 112 if (is_asan) { |
161 ldflags = [ | 113 ldflags = [ |
162 "-Wl,-u_sanitizer_options_link_helper", | 114 "-Wl,-u_sanitizer_options_link_helper", |
163 "-fsanitize=address", | 115 "-fsanitize=address", |
164 ] | 116 ] |
165 } | 117 } |
166 } | 118 } |
167 | 119 |
120 config("dart_gen_snapshot_config") { | |
121 defines = ["DART_PRECOMPILER"] | |
122 } | |
168 | 123 |
169 static_library("libdart") { | 124 static_library("libdart") { |
170 configs += [":dart_config"] | 125 configs += [":dart_config"] |
171 deps = [ | 126 deps = [ |
172 "vm:libdart_lib", | 127 "vm:libdart_lib", |
173 "vm:libdart_vm", | 128 "vm:libdart_vm", |
174 "third_party/double-conversion/src:libdouble_conversion", | 129 "third_party/double-conversion/src:libdouble_conversion", |
175 ":generate_version_cc_file", | 130 ":generate_version_cc_file", |
176 ] | 131 ] |
177 include_dirs = [ | 132 include_dirs = [ |
178 ".", | 133 ".", |
179 ] | 134 ] |
180 public_configs = [":dart_public_config"] | 135 public_configs = [":dart_public_config"] |
181 sources = [ | 136 sources = [ |
182 "include/dart_api.h", | 137 "include/dart_api.h", |
183 "include/dart_mirrors_api.h", | 138 "include/dart_mirrors_api.h", |
184 "include/dart_native_api.h", | 139 "include/dart_native_api.h", |
185 "include/dart_tools_api.h", | 140 "include/dart_tools_api.h", |
186 "vm/dart_api_impl.cc", | 141 "vm/dart_api_impl.cc", |
187 "vm/debugger_api_impl.cc", | 142 "vm/debugger_api_impl.cc", |
188 "vm/mirrors_api_impl.cc", | 143 "vm/mirrors_api_impl.cc", |
189 "vm/native_api_impl.cc", | 144 "vm/native_api_impl.cc", |
190 "vm/version.h", | 145 "vm/version.h", |
191 "$target_gen_dir/version.cc", | 146 "$target_gen_dir/version.cc", |
192 ] | 147 ] |
193 } | 148 } |
194 | 149 |
195 | 150 |
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") { | 151 action("generate_version_cc_file") { |
227 deps = [ | 152 deps = [ |
228 ":libdart_dependency_helper", | 153 ":libdart_dependency_helper", |
229 ] | 154 ] |
230 inputs = [ | 155 inputs = [ |
231 "../tools/utils.py", | 156 "../tools/utils.py", |
232 "../tools/print_version.py", | 157 "../tools/print_version.py", |
233 "../tools/VERSION", | 158 "../tools/VERSION", |
234 "vm/version_in.cc", | 159 "vm/version_in.cc", |
235 ] | 160 ] |
(...skipping 16 matching lines...) Expand all Loading... | |
252 "vm:libdart_lib_nosnapshot", | 177 "vm:libdart_lib_nosnapshot", |
253 "vm:libdart_lib", | 178 "vm:libdart_lib", |
254 "vm:libdart_vm", | 179 "vm:libdart_vm", |
255 "vm:libdart_platform", | 180 "vm:libdart_platform", |
256 "third_party/double-conversion/src:libdouble_conversion", | 181 "third_party/double-conversion/src:libdouble_conversion", |
257 ] | 182 ] |
258 sources = [ | 183 sources = [ |
259 "vm/libdart_dependency_helper.cc", | 184 "vm/libdart_dependency_helper.cc", |
260 ] | 185 ] |
261 } | 186 } |
OLD | NEW |