aura: Remove more code related to layerless windows.
[chromium-blink-merge.git] / build / config / BUILD.gn
blobba165ed9657a9a5e5314be1b4de67ee35c7cbe4f
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
3 # found in the LICENSE file.
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")
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
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
29   # Set to true to enable dcheck in Release builds.
30   dcheck_always_on = false
32   # Set to true to compile with the OpenGL ES 2.0 conformance tests.
33   internal_gles2_conform_tests = false
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.
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 anywhere.
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 (dont_embed_build_metadata) {
84     defines += [ "DONT_EMBED_BUILD_METADATA" ]
85   }
86   if (dcheck_always_on) {
87     defines += [ "DCHECK_ALWAYS_ON=1" ]
88   }
89   if (use_udev) {
90     # TODO(brettw) should probably be "=1".
91     defines += [ "USE_UDEV" ]
92   }
93   if (ui_compositor_image_transport) {
94     # TODO(brettw) should probably be "=1".
95     defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
96   }
97   if (use_ash) {
98     defines += [ "USE_ASH=1" ]
99   }
100   if (use_aura) {
101     defines += [ "USE_AURA=1" ]
102   }
103   if (use_pango) {
104     defines += [ "USE_PANGO=1" ]
105   }
106   if (use_cairo) {
107     defines += [ "USE_CAIRO=1" ]
108   }
109   if (use_clipboard_aurax11) {
110     defines += [ "USE_CLIPBOARD_AURAX11=1" ]
111   }
112   if (use_default_render_theme) {
113     defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
114   }
115   if (use_glib) {
116     defines += [ "USE_GLIB=1" ]
117   }
118   if (use_openssl) {
119     defines += [ "USE_OPENSSL=1" ]
120   }
121   if (use_openssl_certs) {
122     defines += [ "USE_OPENSSL_CERTS=1" ]
123   }
124   if (use_nss_certs) {
125     defines += [ "USE_NSS_CERTS=1" ]
126   }
127   if (use_ozone) {
128     defines += [ "USE_OZONE=1" ]
129   }
130   if (use_x11) {
131     defines += [ "USE_X11=1" ]
132   }
133   if (use_allocator != "tcmalloc") {
134     defines += [ "NO_TCMALLOC" ]
135   }
136   if (is_asan || is_lsan || is_tsan || is_msan) {
137     defines += [
138       "MEMORY_TOOL_REPLACES_ALLOCATOR",
139       "MEMORY_SANITIZER_INITIAL_SIZE",
140     ]
141   }
142   if (is_asan) {
143     defines += [ "ADDRESS_SANITIZER" ]
144   }
145   if (is_lsan) {
146     defines += [
147       "LEAK_SANITIZER",
148       "WTF_USE_LEAK_SANITIZER=1",
149     ]
150   }
151   if (is_tsan) {
152     defines += [
153       "THREAD_SANITIZER",
154       "DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1",
155       "WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1",
156     ]
157   }
158   if (is_msan) {
159     defines += [ "MEMORY_SANITIZER" ]
160   }
161   if (enable_webrtc) {
162     defines += [ "ENABLE_WEBRTC=1" ]
163   }
164   if (disable_ftp_support) {
165     defines += [ "DISABLE_FTP_SUPPORT=1" ]
166   }
167   if (!enable_nacl) {
168     defines += [ "DISABLE_NACL" ]
169   }
170   if (enable_extensions) {
171     defines += [ "ENABLE_EXTENSIONS=1" ]
172   }
173   if (enable_configuration_policy) {
174     defines += [ "ENABLE_CONFIGURATION_POLICY" ]
175   }
176   if (enable_task_manager) {
177     defines += [ "ENABLE_TASK_MANAGER=1" ]
178   }
179   if (enable_themes) {
180     defines += [ "ENABLE_THEMES=1" ]
181   }
182   if (enable_captive_portal_detection) {
183     defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
184   }
185   if (enable_session_service) {
186     defines += [ "ENABLE_SESSION_SERVICE=1" ]
187   }
188   if (enable_rlz) {
189     defines += [ "ENABLE_RLZ" ]
190   }
191   if (enable_plugin_installation) {
192     defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
193   }
194   if (enable_app_list) {
195     defines += [ "ENABLE_APP_LIST=1" ]
196   }
197   if (enable_settings_app) {
198     defines += [ "ENABLE_SETTINGS_APP=1" ]
199   }
200   if (enable_supervised_users) {
201     defines += [ "ENABLE_SUPERVISED_USERS=1" ]
202   }
203   if (enable_service_discovery) {
204     defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
205   }
206   if (enable_autofill_dialog) {
207     defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
208   }
209   if (enable_wifi_bootstrapping) {
210     defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
211   }
212   if (enable_image_loader_extension) {
213     defines += [ "IMAGE_LOADER_EXTENSION=1" ]
214   }
215   if (enable_remoting) {
216     defines += [ "ENABLE_REMOTING=1" ]
217   }
218   if (enable_google_now) {
219     defines += [ "ENABLE_GOOGLE_NOW=1" ]
220   }
221   if (enable_one_click_signin) {
222     defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
223   }
224   if (enable_hidpi) {
225     defines += [ "ENABLE_HIDPI=1" ]
226   }
227   if (enable_topchrome_md) {
228     defines += [ "ENABLE_TOPCHROME_MD=1" ]
229   }
230   if (proprietary_codecs) {
231     defines += [ "USE_PROPRIETARY_CODECS" ]
232   }
233   if (enable_hangout_services_extension) {
234     defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
235   }
236   if (v8_use_external_startup_data) {
237     defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
238   }
239   if (enable_background) {
240     defines += [ "ENABLE_BACKGROUND=1" ]
241   }
242   if (enable_pre_sync_backup) {
243     defines += [ "ENABLE_PRE_SYNC_BACKUP" ]
244   }
245   if (enable_video_hole) {
246     defines += [ "VIDEO_HOLE=1" ]
247   }
248   if (safe_browsing_mode == 1) {
249     defines += [ "FULL_SAFE_BROWSING" ]
250     defines += [ "SAFE_BROWSING_CSD" ]
251     defines += [ "SAFE_BROWSING_DB_LOCAL" ]
252     defines += [ "SAFE_BROWSING_SERVICE" ]
253   } else if (safe_browsing_mode == 2) {
254     defines += [ "MOBILE_SAFE_BROWSING" ]
255     defines += [ "SAFE_BROWSING_SERVICE" ]
256   } else if (safe_browsing_mode == 3) {
257     defines += [ "MOBILE_SAFE_BROWSING" ]
258     defines += [ "SAFE_BROWSING_DB_REMOTE" ]
259     defines += [ "SAFE_BROWSING_SERVICE" ]
260   }
261   if (is_official_build) {
262     defines += [ "OFFICIAL_BUILD" ]
263   }
264   if (is_chrome_branded) {
265     defines += [ "GOOGLE_CHROME_BUILD" ]
266   } else {
267     defines += [ "CHROMIUM_BUILD" ]
268   }
269   if (enable_media_router) {
270     defines += [ "ENABLE_MEDIA_ROUTER=1" ]
271   }
272   if (enable_webvr) {
273     defines += [ "ENABLE_WEBVR" ]
274   }
277 # Debug/release ----------------------------------------------------------------
279 config("debug") {
280   defines = [
281     "_DEBUG",
282     "DYNAMIC_ANNOTATIONS_ENABLED=1",
283     "WTF_USE_DYNAMIC_ANNOTATIONS=1",
284   ]
286   if (is_nacl) {
287     defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ]
288   }
290   if (is_win) {
291     if (disable_iterator_debugging) {
292       # Iterator debugging is enabled by the compiler on debug builds, and we
293       # have to tell it to turn it off.
294       defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
295     }
296   } else if (is_linux && !is_android && current_cpu == "x64" &&
297              !disable_iterator_debugging) {
298     # Enable libstdc++ debugging facilities to help catch problems early, see
299     # http://crbug.com/65151 .
300     # TODO(phajdan.jr): Should we enable this for all of POSIX?
301     defines += [ "_GLIBCXX_DEBUG=1" ]
302   }
305 config("release") {
306   defines = [ "NDEBUG" ]
308   # Sanitizers.
309   # TODO(GYP) The GYP build has "release_valgrind_build == 0" for this
310   # condition. When Valgrind is set up, we need to do the same here.
311   if (is_tsan) {
312     defines += [
313       "DYNAMIC_ANNOTATIONS_ENABLED=1",
314       "WTF_USE_DYNAMIC_ANNOTATIONS=1",
315     ]
316   } else {
317     defines += [ "NVALGRIND" ]
318     if (!is_nacl) {
319       # NaCl always enables dynamic annotations. Currently this value is set to
320       # 1 for all .nexes.
321       defines += [ "DYNAMIC_ANNOTATIONS_ENABLED=0" ]
322     }
323   }
326 # Default libraries ------------------------------------------------------------
328 # This config defines the default libraries applied to all targets.
329 config("default_libs") {
330   if (is_win) {
331     # TODO(brettw) this list of defaults should probably be smaller, and
332     # instead the targets that use the less common ones (e.g. wininet or
333     # winspool) should include those explicitly.
334     libs = [
335       "advapi32.lib",
336       "comdlg32.lib",
337       "dbghelp.lib",
338       "delayimp.lib",
339       "dnsapi.lib",
340       "gdi32.lib",
341       "kernel32.lib",
342       "msimg32.lib",
343       "odbc32.lib",
344       "odbccp32.lib",
345       "ole32.lib",
346       "oleaut32.lib",
347       "psapi.lib",
348       "shell32.lib",
349       "shlwapi.lib",
350       "user32.lib",
351       "usp10.lib",
352       "uuid.lib",
353       "version.lib",
354       "wininet.lib",
355       "winmm.lib",
356       "winspool.lib",
357       "ws2_32.lib",
359       # Please don't add more stuff here. We should actually be making this
360       # list smaller, since all common things should be covered. If you need
361       # some extra libraries, please just add a libs = [ "foo.lib" ] to your
362       # target that needs it.
363     ]
364   } else if (is_android) {
365     # Android uses -nostdlib so we need to add even libc here.
366     libs = [
367       # TODO(brettw) write a version of this, hopefully we can express this
368       # without forking out to GCC just to get the library name. The android
369       # toolchain directory should probably be extracted into a .gni file that
370       # this file and the android toolchain .gn file can share.
371       #   # Manually link the libgcc.a that the cross compiler uses.
372       #   '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
373       "c",
374       "dl",
375       "m",
376     ]
377   } else if (is_mac) {
378     libs = [
379       "AppKit.framework",
380       "ApplicationServices.framework",
381       "Carbon.framework",
382       "CoreFoundation.framework",
383       "Foundation.framework",
384       "IOKit.framework",
385       "Security.framework",
386     ]
387   } else if (is_ios) {
388     libs = [
389       "CoreFoundation.framework",
390       "CoreGraphics.framework",
391       "CoreText.framework",
392       "Foundation.framework",
393       "UIKit.framework",
394     ]
395   } else if (is_linux) {
396     libs = [ "dl" ]
397   }
400 # Add this config to your target to enable precompiled headers.
402 # On Windows, precompiled headers are done on a per-target basis. If you have
403 # just a couple of files, the time it takes to precompile (~2 seconds) can
404 # actually be longer than the time saved. On a Z620, a 100 file target compiles
405 # about 2 seconds faster with precompiled headers, with greater savings for
406 # larger targets.
408 # Recommend precompiled headers for targets with more than 50 .cc files.
409 config("precompiled_headers") {
410   # TODO(brettw) enable this when GN support in the binary has been rolled.
411   #if (is_win) {
412   if (false) {
413     # This is a string rather than a file GN knows about. It has to match
414     # exactly what's in the /FI flag below, and what might appear in the source
415     # code in quotes for an #include directive.
416     precompiled_header = "build/precompile.h"
418     # This is a file that GN will compile with the above header. It will be
419     # implicitly added to the sources (potentially multiple times, with one
420     # variant for each language used in the target).
421     precompiled_source = "//build/precompile.cc"
423     # Force include the header.
424     cflags = [ "/FI$precompiled_header" ]
425   }