OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/allocator.gni") | |
6 import("//build/config/chrome_build.gni") | |
7 import("//build/config/crypto.gni") | |
8 import("//build/config/features.gni") | |
9 import("//build/config/ui.gni") | |
10 import("//build/module_args/v8.gni") | |
11 | |
12 declare_args() { | |
13 # When set, turns off the (normally-on) iterator debugging and related stuff | |
14 # that is normally turned on for Debug builds. These are generally useful for | |
15 # catching bugs but in some cases may cause conflicts or excessive slowness. | |
16 disable_iterator_debugging = false | |
17 | |
18 # Set to true to not store any build metadata, e.g. ifdef out all __DATE__ | |
19 # and __TIME__. Set to 0 to reenable the use of these macros in the code | |
20 # base. See http://crbug.com/314403. | |
21 # | |
22 # Continue to embed build meta data in Official builds, basically the | |
23 # time it was built. | |
24 # TODO(maruel): This decision should be revisited because having an | |
25 # official deterministic build has high value too but MSVC toolset can't | |
26 # generate anything deterministic with WPO enabled AFAIK. | |
27 dont_embed_build_metadata = !is_official_build | |
28 | |
29 # Set to true to enable dcheck in Release builds. | |
30 dcheck_always_on = false | |
31 | |
32 # Set to true to compile with the OpenGL ES 2.0 conformance tests. | |
33 internal_gles2_conform_tests = false | |
34 } | |
35 | |
36 # TODO(brettw) Most of these should be removed. Instead of global feature | |
37 # flags, we should have more modular flags that apply only to a target and its | |
38 # dependents. For example, depending on the "x11" meta-target should define | |
39 # USE_X11 for all dependents so that everything that could use X11 gets the | |
40 # define, but anything that doesn't depend on X11 doesn't see it. | |
41 # | |
42 # For now we define these globally to match the current GYP build. | |
43 config("feature_flags") { | |
44 # TODO(brettw) this probably needs to be parameterized. | |
45 defines = [ "V8_DEPRECATION_WARNINGS" ] # Don't use deprecated V8 APIs anywhe
re. | |
46 | |
47 if (cld_version > 0) { | |
48 defines += [ "CLD_VERSION=$cld_version" ] | |
49 } | |
50 if (enable_mdns) { | |
51 defines += [ "ENABLE_MDNS=1" ] | |
52 } | |
53 if (enable_notifications) { | |
54 defines += [ "ENABLE_NOTIFICATIONS" ] | |
55 } | |
56 if (enable_pepper_cdms) { | |
57 # TODO(brettw) should probably be "=1" | |
58 defines += [ "ENABLE_PEPPER_CDMS" ] | |
59 } | |
60 if (enable_browser_cdms) { | |
61 # TODO(brettw) should probably be "=1" | |
62 defines += [ "ENABLE_BROWSER_CDMS" ] | |
63 } | |
64 if (enable_plugins) { | |
65 defines += [ "ENABLE_PLUGINS=1" ] | |
66 } | |
67 if (enable_basic_printing || enable_print_preview) { | |
68 # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW. | |
69 defines += [ "ENABLE_PRINTING=1" ] | |
70 if (enable_basic_printing) { | |
71 # Enable basic printing support and UI. | |
72 defines += [ "ENABLE_BASIC_PRINTING=1" ] | |
73 } | |
74 if (enable_print_preview) { | |
75 # Enable printing with print preview. | |
76 # Can be defined without ENABLE_BASIC_PRINTING. | |
77 defines += [ "ENABLE_PRINT_PREVIEW=1" ] | |
78 } | |
79 } | |
80 if (enable_spellcheck) { | |
81 defines += [ "ENABLE_SPELLCHECK=1" ] | |
82 } | |
83 if (use_platform_spellchecker) { | |
84 defines += [ "USE_PLATFORM_SPELLCHECKER=1" ] | |
85 } | |
86 if (dont_embed_build_metadata) { | |
87 defines += [ "DONT_EMBED_BUILD_METADATA" ] | |
88 } | |
89 if (dcheck_always_on) { | |
90 defines += [ "DCHECK_ALWAYS_ON=1" ] | |
91 } | |
92 if (use_udev) { | |
93 # TODO(brettw) should probably be "=1". | |
94 defines += [ "USE_UDEV" ] | |
95 } | |
96 if (ui_compositor_image_transport) { | |
97 # TODO(brettw) should probably be "=1". | |
98 defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ] | |
99 } | |
100 if (use_ash) { | |
101 defines += [ "USE_ASH=1" ] | |
102 } | |
103 if (use_aura) { | |
104 defines += [ "USE_AURA=1" ] | |
105 } | |
106 if (use_glfw) { | |
107 defines += [ "USE_GLFW=1" ] | |
108 } | |
109 if (use_pango) { | |
110 defines += [ "USE_PANGO=1" ] | |
111 } | |
112 if (use_cairo) { | |
113 defines += [ "USE_CAIRO=1" ] | |
114 } | |
115 if (use_clipboard_aurax11) { | |
116 defines += [ "USE_CLIPBOARD_AURAX11=1" ] | |
117 } | |
118 if (use_default_render_theme) { | |
119 defines += [ "USE_DEFAULT_RENDER_THEME=1" ] | |
120 } | |
121 if (use_openssl) { | |
122 defines += [ "USE_OPENSSL=1" ] | |
123 } | |
124 if (use_openssl_certs) { | |
125 defines += [ "USE_OPENSSL_CERTS=1" ] | |
126 } | |
127 if (use_nss_certs) { | |
128 defines += [ "USE_NSS_CERTS=1" ] | |
129 } | |
130 if (use_ozone) { | |
131 defines += [ "USE_OZONE=1" ] | |
132 } | |
133 if (use_x11) { | |
134 defines += [ "USE_X11=1" ] | |
135 } | |
136 if (use_allocator != "tcmalloc") { | |
137 defines += [ "NO_TCMALLOC" ] | |
138 } | |
139 if (is_asan || is_lsan || is_tsan || is_msan || is_ios) { | |
140 defines += [ | |
141 "MEMORY_TOOL_REPLACES_ALLOCATOR", | |
142 "MEMORY_SANITIZER_INITIAL_SIZE", | |
143 ] | |
144 } | |
145 if (is_asan) { | |
146 defines += [ "ADDRESS_SANITIZER" ] | |
147 } | |
148 if (is_lsan) { | |
149 defines += [ | |
150 "LEAK_SANITIZER", | |
151 "WTF_USE_LEAK_SANITIZER=1", | |
152 ] | |
153 } | |
154 if (is_tsan) { | |
155 defines += [ | |
156 "THREAD_SANITIZER", | |
157 "DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1", | |
158 "WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1", | |
159 ] | |
160 } | |
161 if (is_msan) { | |
162 defines += [ "MEMORY_SANITIZER" ] | |
163 } | |
164 if (enable_webrtc) { | |
165 defines += [ "ENABLE_WEBRTC=1" ] | |
166 } | |
167 if (disable_ftp_support) { | |
168 defines += [ "DISABLE_FTP_SUPPORT=1" ] | |
169 } | |
170 if (!enable_nacl) { | |
171 defines += [ "DISABLE_NACL" ] | |
172 } | |
173 if (enable_extensions) { | |
174 defines += [ "ENABLE_EXTENSIONS=1" ] | |
175 } | |
176 if (enable_configuration_policy) { | |
177 defines += [ "ENABLE_CONFIGURATION_POLICY" ] | |
178 } | |
179 if (enable_task_manager) { | |
180 defines += [ "ENABLE_TASK_MANAGER=1" ] | |
181 } | |
182 if (enable_themes) { | |
183 defines += [ "ENABLE_THEMES=1" ] | |
184 } | |
185 if (enable_captive_portal_detection) { | |
186 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ] | |
187 } | |
188 if (enable_session_service) { | |
189 defines += [ "ENABLE_SESSION_SERVICE=1" ] | |
190 } | |
191 if (enable_rlz) { | |
192 defines += [ "ENABLE_RLZ" ] | |
193 } | |
194 if (enable_plugin_installation) { | |
195 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ] | |
196 } | |
197 if (enable_app_list) { | |
198 defines += [ "ENABLE_APP_LIST=1" ] | |
199 } | |
200 if (enable_settings_app) { | |
201 defines += [ "ENABLE_SETTINGS_APP=1" ] | |
202 } | |
203 if (enable_supervised_users) { | |
204 defines += [ "ENABLE_SUPERVISED_USERS=1" ] | |
205 } | |
206 if (enable_service_discovery) { | |
207 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ] | |
208 } | |
209 if (enable_autofill_dialog) { | |
210 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ] | |
211 } | |
212 if (enable_wifi_bootstrapping) { | |
213 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ] | |
214 } | |
215 if (enable_image_loader_extension) { | |
216 defines += [ "IMAGE_LOADER_EXTENSION=1" ] | |
217 } | |
218 if (enable_remoting) { | |
219 defines += [ "ENABLE_REMOTING=1" ] | |
220 } | |
221 if (enable_google_now) { | |
222 defines += [ "ENABLE_GOOGLE_NOW=1" ] | |
223 } | |
224 if (enable_one_click_signin) { | |
225 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ] | |
226 } | |
227 if (enable_hidpi) { | |
228 defines += [ "ENABLE_HIDPI=1" ] | |
229 } | |
230 if (enable_topchrome_md) { | |
231 defines += [ "ENABLE_TOPCHROME_MD=1" ] | |
232 } | |
233 if (proprietary_codecs) { | |
234 defines += [ "USE_PROPRIETARY_CODECS" ] | |
235 } | |
236 if (enable_hangout_services_extension) { | |
237 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ] | |
238 } | |
239 if (v8_use_external_startup_data) { | |
240 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ] | |
241 } | |
242 if (enable_background) { | |
243 defines += [ "ENABLE_BACKGROUND=1" ] | |
244 } | |
245 if (enable_pre_sync_backup) { | |
246 defines += [ "ENABLE_PRE_SYNC_BACKUP" ] | |
247 } | |
248 if (enable_video_hole) { | |
249 defines += [ "VIDEO_HOLE=1" ] | |
250 } | |
251 if (safe_browsing_mode == 1) { | |
252 defines += [ "FULL_SAFE_BROWSING" ] | |
253 defines += [ "SAFE_BROWSING_CSD" ] | |
254 defines += [ "SAFE_BROWSING_DB_LOCAL" ] | |
255 defines += [ "SAFE_BROWSING_SERVICE" ] | |
256 } else if (safe_browsing_mode == 2) { | |
257 defines += [ "MOBILE_SAFE_BROWSING" ] | |
258 defines += [ "SAFE_BROWSING_SERVICE" ] | |
259 } else if (safe_browsing_mode == 3) { | |
260 defines += [ "MOBILE_SAFE_BROWSING" ] | |
261 defines += [ "SAFE_BROWSING_DB_REMOTE" ] | |
262 defines += [ "SAFE_BROWSING_SERVICE" ] | |
263 } | |
264 if (is_official_build) { | |
265 defines += [ "OFFICIAL_BUILD" ] | |
266 } | |
267 if (is_chrome_branded) { | |
268 defines += [ "GOOGLE_CHROME_BUILD" ] | |
269 } else { | |
270 defines += [ "CHROMIUM_BUILD" ] | |
271 } | |
272 if (enable_media_router) { | |
273 defines += [ "ENABLE_MEDIA_ROUTER=1" ] | |
274 } | |
275 if (enable_webvr) { | |
276 defines += [ "ENABLE_WEBVR" ] | |
277 } | |
278 if (is_fnl) { | |
279 defines += [ "HAVE_SYS_QUEUE_H_=0" ] | |
280 } | |
281 } | |
282 | |
283 # Debug/release ---------------------------------------------------------------- | 5 # Debug/release ---------------------------------------------------------------- |
284 | 6 |
285 config("debug") { | 7 config("debug") { |
286 defines = [ | 8 defines = [ |
287 "_DEBUG", | 9 "DEBUG", |
288 "DYNAMIC_ANNOTATIONS_ENABLED=1", | |
289 "WTF_USE_DYNAMIC_ANNOTATIONS=1", | |
290 ] | 10 ] |
291 | |
292 if (is_nacl) { | |
293 defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ] | |
294 } | |
295 | |
296 if (is_win) { | |
297 if (disable_iterator_debugging) { | |
298 # Iterator debugging is enabled by the compiler on debug builds, and we | |
299 # have to tell it to turn it off. | |
300 defines += [ "_HAS_ITERATOR_DEBUGGING=0" ] | |
301 } | |
302 } else if (is_linux && !is_android && current_cpu == "x64" && | |
303 !disable_iterator_debugging) { | |
304 # Enable libstdc++ debugging facilities to help catch problems early, see | |
305 # http://crbug.com/65151 . | |
306 # TODO(phajdan.jr): Should we enable this for all of POSIX? | |
307 defines += [ "_GLIBCXX_DEBUG=1" ] | |
308 } | |
309 } | 11 } |
310 | 12 |
311 config("release") { | 13 config("release") { |
312 defines = [ "NDEBUG" ] | 14 defines = [ |
313 | 15 "NDEBUG" |
314 # Sanitizers. | 16 ] |
315 # TODO(GYP) The GYP build has "release_valgrind_build == 0" for this | |
316 # condition. When Valgrind is set up, we need to do the same here. | |
317 if (is_tsan) { | |
318 defines += [ | |
319 "DYNAMIC_ANNOTATIONS_ENABLED=1", | |
320 "WTF_USE_DYNAMIC_ANNOTATIONS=1", | |
321 ] | |
322 } else { | |
323 defines += [ "NVALGRIND" ] | |
324 if (!is_nacl) { | |
325 # NaCl always enables dynamic annotations. Currently this value is set to | |
326 # 1 for all .nexes. | |
327 defines += [ "DYNAMIC_ANNOTATIONS_ENABLED=0" ] | |
328 } | |
329 } | |
330 } | 17 } |
331 | 18 |
332 # Default libraries ------------------------------------------------------------ | 19 config("product") { |
333 | 20 defines = [ |
334 # This config defines the default libraries applied to all targets. | 21 "NDEBUG", |
335 config("default_libs") { | 22 "PRODUCT", |
336 if (is_win) { | 23 ] |
337 # TODO(brettw) this list of defaults should probably be smaller, and | |
338 # instead the targets that use the less common ones (e.g. wininet or | |
339 # winspool) should include those explicitly. | |
340 libs = [ | |
341 "advapi32.lib", | |
342 "comdlg32.lib", | |
343 "dbghelp.lib", | |
344 "delayimp.lib", | |
345 "dnsapi.lib", | |
346 "gdi32.lib", | |
347 "kernel32.lib", | |
348 "msimg32.lib", | |
349 "odbc32.lib", | |
350 "odbccp32.lib", | |
351 "ole32.lib", | |
352 "oleaut32.lib", | |
353 "psapi.lib", | |
354 "shell32.lib", | |
355 "shlwapi.lib", | |
356 "user32.lib", | |
357 "usp10.lib", | |
358 "uuid.lib", | |
359 "version.lib", | |
360 "wininet.lib", | |
361 "winmm.lib", | |
362 "winspool.lib", | |
363 "ws2_32.lib", | |
364 | |
365 # Please don't add more stuff here. We should actually be making this | |
366 # list smaller, since all common things should be covered. If you need | |
367 # some extra libraries, please just add a libs = [ "foo.lib" ] to your | |
368 # target that needs it. | |
369 ] | |
370 } else if (is_android) { | |
371 # Android uses -nostdlib so we need to add even libc here. | |
372 libs = [ | |
373 # TODO(brettw) write a version of this, hopefully we can express this | |
374 # without forking out to GCC just to get the library name. The android | |
375 # toolchain directory should probably be extracted into a .gni file that | |
376 # this file and the android toolchain .gn file can share. | |
377 # # Manually link the libgcc.a that the cross compiler uses. | |
378 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)', | |
379 "c", | |
380 "dl", | |
381 "m", | |
382 ] | |
383 } else if (is_mac) { | |
384 libs = [ | |
385 "AppKit.framework", | |
386 "ApplicationServices.framework", | |
387 "Carbon.framework", | |
388 "CoreFoundation.framework", | |
389 "Foundation.framework", | |
390 "IOKit.framework", | |
391 "Security.framework", | |
392 "OpenGL.framework", | |
393 ] | |
394 } else if (is_ios) { | |
395 # The libraries listed here will be specified for both the target and the | |
396 # host. Only the common ones should be listed here. | |
397 libs = [ | |
398 "CoreFoundation.framework", | |
399 "CoreGraphics.framework", | |
400 "CoreText.framework", | |
401 "Foundation.framework", | |
402 ] | |
403 } else if (is_linux) { | |
404 libs = [ "dl" ] | |
405 } | |
406 } | 24 } |
407 | |
408 # Add this config to your target to enable precompiled headers. | |
409 # | |
410 # On Windows, precompiled headers are done on a per-target basis. If you have | |
411 # just a couple of files, the time it takes to precompile (~2 seconds) can | |
412 # actually be longer than the time saved. On a Z620, a 100 file target compiles | |
413 # about 2 seconds faster with precompiled headers, with greater savings for | |
414 # larger targets. | |
415 # | |
416 # Recommend precompiled headers for targets with more than 50 .cc files. | |
417 config("precompiled_headers") { | |
418 # TODO(brettw) enable this when GN support in the binary has been rolled. | |
419 #if (is_win) { | |
420 if (false) { | |
421 # This is a string rather than a file GN knows about. It has to match | |
422 # exactly what's in the /FI flag below, and what might appear in the source | |
423 # code in quotes for an #include directive. | |
424 precompiled_header = "build/precompile.h" | |
425 | |
426 # This is a file that GN will compile with the above header. It will be | |
427 # implicitly added to the sources (potentially multiple times, with one | |
428 # variant for each language used in the target). | |
429 precompiled_source = "//build/precompile.cc" | |
430 | |
431 # Force include the header. | |
432 cflags = [ "/FI$precompiled_header" ] | |
433 } | |
434 } | |
OLD | NEW |