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/sanitizers/sanitizers.gni")
10 import("//build/config/ui.gni")
11 import("//build/module_args/v8.gni")
14 # When set, turns off the (normally-on) iterator debugging and related stuff
15 # that is normally turned on for Debug builds. These are generally useful for
16 # catching bugs but in some cases may cause conflicts or excessive slowness.
17 disable_iterator_debugging = false
19 # Set to true to not store any build metadata, e.g. ifdef out all __DATE__
20 # and __TIME__. Set to 0 to reenable the use of these macros in the code
21 # base. See http://crbug.com/314403.
23 # Continue to embed build meta data in Official builds, basically the
25 # TODO(maruel): This decision should be revisited because having an
26 # official deterministic build has high value too but MSVC toolset can't
27 # generate anything deterministic with WPO enabled AFAIK.
28 dont_embed_build_metadata = !is_official_build
30 # Set to true to enable dcheck in Release builds.
31 dcheck_always_on = false
33 # Set to true to compile with the OpenGL ES 2.0 conformance tests.
34 internal_gles2_conform_tests = false
37 # TODO(brettw) Most of these should be removed. Instead of global feature
38 # flags, we should have more modular flags that apply only to a target and its
39 # dependents. For example, depending on the "x11" meta-target should define
40 # USE_X11 for all dependents so that everything that could use X11 gets the
41 # define, but anything that doesn't depend on X11 doesn't see it.
43 # For now we define these globally to match the current GYP build.
44 config("feature_flags") {
45 # TODO(brettw) this probably needs to be parameterized.
46 defines = [ "V8_DEPRECATION_WARNINGS" ] # Don't use deprecated V8 APIs anywhere.
48 if (cld_version > 0) {
49 defines += [ "CLD_VERSION=$cld_version" ]
52 defines += [ "ENABLE_MDNS=1" ]
54 if (enable_notifications) {
55 defines += [ "ENABLE_NOTIFICATIONS" ]
57 if (enable_pepper_cdms) {
58 # TODO(brettw) should probably be "=1"
59 defines += [ "ENABLE_PEPPER_CDMS" ]
61 if (enable_browser_cdms) {
62 # TODO(brettw) should probably be "=1"
63 defines += [ "ENABLE_BROWSER_CDMS" ]
66 defines += [ "ENABLE_PLUGINS=1" ]
68 if (enable_basic_printing || enable_print_preview) {
69 # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW.
70 defines += [ "ENABLE_PRINTING=1" ]
71 if (enable_basic_printing) {
72 # Enable basic printing support and UI.
73 defines += [ "ENABLE_BASIC_PRINTING=1" ]
75 if (enable_print_preview) {
76 # Enable printing with print preview.
77 # Can be defined without ENABLE_BASIC_PRINTING.
78 defines += [ "ENABLE_PRINT_PREVIEW=1" ]
81 if (enable_spellcheck) {
82 defines += [ "ENABLE_SPELLCHECK=1" ]
84 if (use_platform_spellchecker) {
85 defines += [ "USE_PLATFORM_SPELLCHECKER=1" ]
87 if (dont_embed_build_metadata) {
88 defines += [ "DONT_EMBED_BUILD_METADATA" ]
90 if (dcheck_always_on) {
91 defines += [ "DCHECK_ALWAYS_ON=1" ]
94 # TODO(brettw) should probably be "=1".
95 defines += [ "USE_UDEV" ]
97 if (ui_compositor_image_transport) {
98 # TODO(brettw) should probably be "=1".
99 defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
102 defines += [ "USE_ASH=1" ]
105 defines += [ "USE_AURA=1" ]
108 defines += [ "USE_PANGO=1" ]
111 defines += [ "USE_CAIRO=1" ]
113 if (use_clipboard_aurax11) {
114 defines += [ "USE_CLIPBOARD_AURAX11=1" ]
116 if (use_default_render_theme) {
117 defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
120 defines += [ "USE_GLIB=1" ]
123 defines += [ "USE_OPENSSL=1" ]
125 if (use_openssl_certs) {
126 defines += [ "USE_OPENSSL_CERTS=1" ]
129 defines += [ "USE_NSS_CERTS=1" ]
132 defines += [ "USE_OZONE=1" ]
135 defines += [ "USE_X11=1" ]
137 if (use_allocator != "tcmalloc") {
138 defines += [ "NO_TCMALLOC" ]
140 if (is_asan || is_lsan || is_tsan || is_msan) {
142 "MEMORY_TOOL_REPLACES_ALLOCATOR",
143 "MEMORY_SANITIZER_INITIAL_SIZE",
147 defines += [ "ADDRESS_SANITIZER" ]
152 "WTF_USE_LEAK_SANITIZER=1",
158 "DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1",
159 "WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1",
163 defines += [ "MEMORY_SANITIZER" ]
166 defines += [ "ENABLE_WEBRTC=1" ]
168 if (disable_ftp_support) {
169 defines += [ "DISABLE_FTP_SUPPORT=1" ]
172 defines += [ "DISABLE_NACL" ]
174 if (enable_extensions) {
175 defines += [ "ENABLE_EXTENSIONS=1" ]
177 if (enable_configuration_policy) {
178 defines += [ "ENABLE_CONFIGURATION_POLICY" ]
180 if (enable_task_manager) {
181 defines += [ "ENABLE_TASK_MANAGER=1" ]
184 defines += [ "ENABLE_THEMES=1" ]
186 if (enable_captive_portal_detection) {
187 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
189 if (enable_session_service) {
190 defines += [ "ENABLE_SESSION_SERVICE=1" ]
193 defines += [ "ENABLE_RLZ" ]
195 if (enable_plugin_installation) {
196 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
198 if (enable_app_list) {
199 defines += [ "ENABLE_APP_LIST=1" ]
201 if (enable_settings_app) {
202 defines += [ "ENABLE_SETTINGS_APP=1" ]
204 if (enable_supervised_users) {
205 defines += [ "ENABLE_SUPERVISED_USERS=1" ]
207 if (enable_service_discovery) {
208 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
210 if (enable_autofill_dialog) {
211 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
213 if (enable_wifi_bootstrapping) {
214 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
216 if (enable_image_loader_extension) {
217 defines += [ "IMAGE_LOADER_EXTENSION=1" ]
219 if (enable_remoting) {
220 defines += [ "ENABLE_REMOTING=1" ]
222 if (enable_google_now) {
223 defines += [ "ENABLE_GOOGLE_NOW=1" ]
225 if (enable_one_click_signin) {
226 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
229 defines += [ "ENABLE_HIDPI=1" ]
231 if (enable_topchrome_md) {
232 defines += [ "ENABLE_TOPCHROME_MD=1" ]
234 if (proprietary_codecs) {
235 defines += [ "USE_PROPRIETARY_CODECS" ]
237 if (enable_hangout_services_extension) {
238 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
240 if (v8_use_external_startup_data) {
241 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
243 if (enable_background) {
244 defines += [ "ENABLE_BACKGROUND=1" ]
246 if (enable_pre_sync_backup) {
247 defines += [ "ENABLE_PRE_SYNC_BACKUP" ]
249 if (enable_video_hole) {
250 defines += [ "VIDEO_HOLE=1" ]
252 if (safe_browsing_mode == 1) {
253 defines += [ "FULL_SAFE_BROWSING" ]
254 defines += [ "SAFE_BROWSING_CSD" ]
255 defines += [ "SAFE_BROWSING_DB_LOCAL" ]
256 defines += [ "SAFE_BROWSING_SERVICE" ]
257 } else if (safe_browsing_mode == 2) {
258 defines += [ "MOBILE_SAFE_BROWSING" ]
259 defines += [ "SAFE_BROWSING_SERVICE" ]
260 } else if (safe_browsing_mode == 3) {
261 defines += [ "MOBILE_SAFE_BROWSING" ]
262 defines += [ "SAFE_BROWSING_DB_REMOTE" ]
263 defines += [ "SAFE_BROWSING_SERVICE" ]
265 if (is_official_build) {
266 defines += [ "OFFICIAL_BUILD" ]
268 if (is_chrome_branded) {
269 defines += [ "GOOGLE_CHROME_BUILD" ]
271 defines += [ "CHROMIUM_BUILD" ]
273 if (enable_media_router) {
274 defines += [ "ENABLE_MEDIA_ROUTER=1" ]
277 defines += [ "ENABLE_WEBVR" ]
282 "MEMORY_TOOL_REPLACES_ALLOCATOR",
283 "MEMORY_SANITIZER_INITIAL_SIZE",
288 # Debug/release ----------------------------------------------------------------
293 "DYNAMIC_ANNOTATIONS_ENABLED=1",
294 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
298 defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ]
302 if (disable_iterator_debugging) {
303 # Iterator debugging is enabled by the compiler on debug builds, and we
304 # have to tell it to turn it off.
305 defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
307 } else if (is_linux && !is_android && current_cpu == "x64" &&
308 !disable_iterator_debugging) {
309 # Enable libstdc++ debugging facilities to help catch problems early, see
310 # http://crbug.com/65151 .
311 # TODO(phajdan.jr): Should we enable this for all of POSIX?
312 defines += [ "_GLIBCXX_DEBUG=1" ]
317 defines = [ "NDEBUG" ]
320 # TODO(GYP) The GYP build has "release_valgrind_build == 0" for this
321 # condition. When Valgrind is set up, we need to do the same here.
324 "DYNAMIC_ANNOTATIONS_ENABLED=1",
325 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
328 defines += [ "NVALGRIND" ]
330 # NaCl always enables dynamic annotations. Currently this value is set to
332 defines += [ "DYNAMIC_ANNOTATIONS_ENABLED=0" ]
337 # Default libraries ------------------------------------------------------------
339 # This config defines the default libraries applied to all targets.
340 config("default_libs") {
342 # TODO(brettw) this list of defaults should probably be smaller, and
343 # instead the targets that use the less common ones (e.g. wininet or
344 # winspool) should include those explicitly.
370 # Please don't add more stuff here. We should actually be making this
371 # list smaller, since all common things should be covered. If you need
372 # some extra libraries, please just add a libs = [ "foo.lib" ] to your
373 # target that needs it.
375 } else if (is_android) {
376 # Android uses -nostdlib so we need to add even libc here.
378 # TODO(brettw) write a version of this, hopefully we can express this
379 # without forking out to GCC just to get the library name. The android
380 # toolchain directory should probably be extracted into a .gni file that
381 # this file and the android toolchain .gn file can share.
382 # # Manually link the libgcc.a that the cross compiler uses.
383 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
391 "ApplicationServices.framework",
393 "CoreFoundation.framework",
394 "Foundation.framework",
396 "Security.framework",
400 "CoreFoundation.framework",
401 "CoreGraphics.framework",
402 "CoreText.framework",
403 "Foundation.framework",
406 } else if (is_linux) {
411 # Add this config to your target to enable precompiled headers.
413 # On Windows, precompiled headers are done on a per-target basis. If you have
414 # just a couple of files, the time it takes to precompile (~2 seconds) can
415 # actually be longer than the time saved. On a Z620, a 100 file target compiles
416 # about 2 seconds faster with precompiled headers, with greater savings for
419 # Recommend precompiled headers for targets with more than 50 .cc files.
420 config("precompiled_headers") {
421 # TODO(brettw) enable this when GN support in the binary has been rolled.
424 # This is a string rather than a file GN knows about. It has to match
425 # exactly what's in the /FI flag below, and what might appear in the source
426 # code in quotes for an #include directive.
427 precompiled_header = "build/precompile.h"
429 # This is a file that GN will compile with the above header. It will be
430 # implicitly added to the sources (potentially multiple times, with one
431 # variant for each language used in the target).
432 precompiled_source = "//build/precompile.cc"
434 # Force include the header.
435 cflags = [ "/FI$precompiled_header" ]