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")
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.
22 # Continue to embed build meta data in Official builds, basically the
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" ]
51 defines += [ "ENABLE_MDNS=1" ]
53 if (enable_notifications) {
54 defines += [ "ENABLE_NOTIFICATIONS" ]
56 if (enable_pepper_cdms) {
57 # TODO(brettw) should probably be "=1"
58 defines += [ "ENABLE_PEPPER_CDMS" ]
60 if (enable_browser_cdms) {
61 # TODO(brettw) should probably be "=1"
62 defines += [ "ENABLE_BROWSER_CDMS" ]
65 defines += [ "ENABLE_PLUGINS=1" ]
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" ]
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" ]
80 if (enable_spellcheck) {
81 defines += [ "ENABLE_SPELLCHECK=1" ]
83 if (dont_embed_build_metadata) {
84 defines += [ "DONT_EMBED_BUILD_METADATA" ]
86 if (dcheck_always_on) {
87 defines += [ "DCHECK_ALWAYS_ON=1" ]
90 # TODO(brettw) should probably be "=1".
91 defines += [ "USE_UDEV" ]
94 defines += [ "TOOLKIT_VIEWS=1" ]
96 if (ui_compositor_image_transport) {
97 # TODO(brettw) should probably be "=1".
98 defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
101 defines += [ "USE_ASH=1" ]
104 defines += [ "USE_AURA=1" ]
107 defines += [ "USE_PANGO=1" ]
110 defines += [ "USE_CAIRO=1" ]
112 if (use_clipboard_aurax11) {
113 defines += [ "USE_CLIPBOARD_AURAX11=1" ]
115 if (use_default_render_theme) {
116 defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
119 defines += [ "USE_GLIB=1" ]
122 defines += [ "USE_OPENSSL=1" ]
124 if (use_openssl_certs) {
125 defines += [ "USE_OPENSSL_CERTS=1" ]
128 defines += [ "USE_NSS_CERTS=1" ]
131 defines += [ "USE_OZONE=1" ]
134 defines += [ "USE_X11=1" ]
136 if (use_allocator != "tcmalloc") {
137 defines += [ "NO_TCMALLOC" ]
139 if (is_asan || is_lsan || is_tsan || is_msan) {
141 "MEMORY_TOOL_REPLACES_ALLOCATOR",
142 "MEMORY_SANITIZER_INITIAL_SIZE",
146 defines += [ "ADDRESS_SANITIZER" ]
151 "WTF_USE_LEAK_SANITIZER=1",
157 "DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1",
158 "WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1",
162 defines += [ "MEMORY_SANITIZER" ]
165 defines += [ "ENABLE_WEBRTC=1" ]
167 if (disable_ftp_support) {
168 defines += [ "DISABLE_FTP_SUPPORT=1" ]
171 defines += [ "DISABLE_NACL" ]
173 if (enable_extensions) {
174 defines += [ "ENABLE_EXTENSIONS=1" ]
176 if (enable_configuration_policy) {
177 defines += [ "ENABLE_CONFIGURATION_POLICY" ]
179 if (enable_task_manager) {
180 defines += [ "ENABLE_TASK_MANAGER=1" ]
183 defines += [ "ENABLE_THEMES=1" ]
185 if (enable_captive_portal_detection) {
186 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
188 if (enable_session_service) {
189 defines += [ "ENABLE_SESSION_SERVICE=1" ]
192 defines += [ "ENABLE_RLZ" ]
194 if (enable_plugin_installation) {
195 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
197 if (enable_app_list) {
198 defines += [ "ENABLE_APP_LIST=1" ]
200 if (enable_settings_app) {
201 defines += [ "ENABLE_SETTINGS_APP=1" ]
203 if (enable_supervised_users) {
204 defines += [ "ENABLE_SUPERVISED_USERS=1" ]
206 if (enable_service_discovery) {
207 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
209 if (enable_autofill_dialog) {
210 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
212 if (enable_wifi_bootstrapping) {
213 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
215 if (enable_image_loader_extension) {
216 defines += [ "IMAGE_LOADER_EXTENSION=1" ]
218 if (enable_remoting) {
219 defines += [ "ENABLE_REMOTING=1" ]
221 if (enable_google_now) {
222 defines += [ "ENABLE_GOOGLE_NOW=1" ]
224 if (enable_one_click_signin) {
225 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
228 defines += [ "ENABLE_HIDPI=1" ]
230 if (enable_topchrome_md) {
231 defines += [ "ENABLE_TOPCHRME_MD=1" ]
233 if (proprietary_codecs) {
234 defines += [ "USE_PROPRIETARY_CODECS" ]
236 if (enable_hangout_services_extension) {
237 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
239 if (v8_use_external_startup_data) {
240 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
242 if (enable_background) {
243 defines += [ "ENABLE_BACKGROUND=1" ]
245 if (enable_pre_sync_backup) {
246 defines += [ "ENABLE_PRE_SYNC_BACKUP" ]
248 if (enable_video_hole) {
249 defines += [ "VIDEO_HOLE=1" ]
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" ]
264 if (is_official_build) {
265 defines += [ "OFFICIAL_BUILD" ]
267 if (is_chrome_branded) {
268 defines += [ "GOOGLE_CHROME_BUILD" ]
270 defines += [ "CHROMIUM_BUILD" ]
272 if (enable_media_router) {
273 defines += [ "ENABLE_MEDIA_ROUTER=1" ]
277 # Debug/release ----------------------------------------------------------------
282 "DYNAMIC_ANNOTATIONS_ENABLED=1",
283 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
287 defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ]
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" ]
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" ]
306 defines = [ "NDEBUG" ]
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.
313 "DYNAMIC_ANNOTATIONS_ENABLED=1",
314 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
317 defines += [ "NVALGRIND" ]
319 # NaCl always enables dynamic annotations. Currently this value is set to
321 defines += [ "DYNAMIC_ANNOTATIONS_ENABLED=0" ]
326 # Default libraries ------------------------------------------------------------
328 # This config defines the default libraries applied to all targets.
329 config("default_libs") {
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.
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.
364 } else if (is_android) {
365 # Android uses -nostdlib so we need to add even libc here.
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)',
380 "ApplicationServices.framework",
382 "CoreFoundation.framework",
383 "Foundation.framework",
385 "Security.framework",
389 "CoreFoundation.framework",
390 "CoreGraphics.framework",
391 "CoreText.framework",
392 "Foundation.framework",
395 } else if (is_linux) {