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/crypto.gni")
7 import("//build/config/features.gni")
8 import("//build/config/ui.gni")
9 import("//build/module_args/v8.gni")
12 # When set, turns off the (normally-on) iterator debugging and related stuff
13 # that is normally turned on for Debug builds. These are generally useful for
14 # catching bugs but in some cases may cause conflicts or excessive slowness.
15 disable_iterator_debugging = false
17 # Set to true to not store any build metadata (this isn't working yet but
18 # this flag will help us to get there). See http://crbug.com/314403.
19 # TODO(sebmarchand): Update this comment once this flag guarantee that
20 # there's no build metadata in the build artifacts.
21 dont_embed_build_metadata = false
23 # Set to true to enable dcheck in Release builds.
24 dcheck_always_on = false
27 # TODO(brettw) Most of these should be removed. Instead of global feature
28 # flags, we should have more modular flags that apply only to a target and its
29 # dependents. For example, depending on the "x11" meta-target should define
30 # USE_X11 for all dependents so that everything that could use X11 gets the
31 # define, but anything that doesn't depend on X11 doesn't see it.
33 # For now we define these globally to match the current GYP build.
34 config("feature_flags") {
35 # TODO(brettw) most of these need to be parameterized.
38 "V8_DEPRECATION_WARNINGS", # Don't use deprecated V8 APIs anywhere.
41 if (cld_version > 0) {
42 defines += [ "CLD_VERSION=$cld_version" ]
45 defines += [ "ENABLE_MDNS=1" ]
47 if (enable_notifications) {
48 defines += [ "ENABLE_NOTIFICATIONS" ]
50 if (enable_pepper_cdms) {
51 # TODO(brettw) should probably be "=1"
52 defines += [ "ENABLE_PEPPER_CDMS" ]
54 if (enable_browser_cdms) {
55 # TODO(brettw) should probably be "=1"
56 defines += [ "ENABLE_BROWSER_CDMS" ]
59 defines += [ "ENABLE_PLUGINS=1" ]
61 if (enable_basic_printing || enable_print_preview) {
62 # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW.
63 defines += [ "ENABLE_PRINTING=1" ]
64 if (enable_basic_printing) {
65 # Enable basic printing support and UI.
66 defines += [ "ENABLE_BASIC_PRINTING=1" ]
68 if (enable_print_preview) {
69 # Enable printing with print preview.
70 # Can be defined without ENABLE_BASIC_PRINTING.
71 defines += [ "ENABLE_PRINT_PREVIEW=1" ]
74 if (enable_spellcheck) {
75 defines += [ "ENABLE_SPELLCHECK=1" ]
77 if (dont_embed_build_metadata) {
78 defines += [ "DONT_EMBED_BUILD_METADATA" ]
80 if (dcheck_always_on) {
81 defines += [ "DCHECK_ALWAYS_ON=1" ]
84 # TODO(brettw) should probably be "=1".
85 defines += [ "USE_UDEV" ]
88 defines += [ "TOOLKIT_VIEWS=1" ]
90 if (ui_compositor_image_transport) {
91 # TODO(brettw) should probably be "=1".
92 defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
95 defines += [ "USE_ASH=1" ]
98 defines += [ "USE_AURA=1" ]
101 defines += [ "USE_PANGO=1" ]
104 defines += [ "USE_CAIRO=1" ]
106 if (use_clipboard_aurax11) {
107 defines += [ "USE_CLIPBOARD_AURAX11=1" ]
109 if (use_default_render_theme) {
110 defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
113 defines += [ "USE_GLIB=1" ]
116 defines += [ "USE_OPENSSL=1" ]
117 if (use_openssl_certs) {
118 defines += [ "USE_OPENSSL_CERTS=1" ]
120 } else if (use_nss_certs) {
121 # USE_NSS really means "use nss for certificate validation and storage"
122 # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
123 # to rename this but we're hoping to transition away from NSS.
124 defines += [ "USE_NSS=1" ]
127 defines += [ "USE_OZONE=1" ]
130 defines += [ "USE_X11=1" ]
132 if (use_allocator != "tcmalloc") {
133 defines += [ "NO_TCMALLOC" ]
138 "MEMORY_TOOL_REPLACES_ALLOCATOR",
139 "MEMORY_SANITIZER_INITIAL_SIZE",
143 defines += [ "ENABLE_WEBRTC=1" ]
145 if (disable_ftp_support) {
146 defines += [ "DISABLE_FTP_SUPPORT=1" ]
149 defines += [ "DISABLE_NACL" ]
151 if (enable_extensions) {
152 defines += [ "ENABLE_EXTENSIONS=1" ]
154 if (enable_configuration_policy) {
155 defines += [ "ENABLE_CONFIGURATION_POLICY" ]
157 if (enable_task_manager) {
158 defines += [ "ENABLE_TASK_MANAGER=1" ]
161 defines += [ "ENABLE_THEMES=1" ]
163 if (enable_captive_portal_detection) {
164 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
166 if (enable_session_service) {
167 defines += [ "ENABLE_SESSION_SERVICE=1" ]
170 defines += [ "ENABLE_RLZ" ]
172 if (enable_plugin_installation) {
173 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
175 if (enable_app_list) {
176 defines += [ "ENABLE_APP_LIST=1" ]
178 if (enable_settings_app) {
179 defines += [ "ENABLE_SETTINGS_APP=1" ]
181 if (enable_supervised_users) {
182 defines += [ "ENABLE_SUPERVISED_USERS=1" ]
184 if (enable_service_discovery) {
185 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
187 if (enable_autofill_dialog) {
188 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
190 if (enable_wifi_bootstrapping) {
191 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
193 if (enable_image_loader_extension) {
194 defines += [ "IMAGE_LOADER_EXTENSION=1" ]
196 if (enable_remoting) {
197 defines += [ "ENABLE_REMOTING=1" ]
199 if (enable_google_now) {
200 defines += [ "ENABLE_GOOGLE_NOW=1" ]
202 if (enable_one_click_signin) {
203 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
206 defines += [ "ENABLE_HIDPI=1" ]
208 if (proprietary_codecs) {
209 defines += [ "USE_PROPRIETARY_CODECS" ]
211 if (enable_hangout_services_extension) {
212 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
214 if (v8_use_external_startup_data) {
215 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
219 # Debug/release ----------------------------------------------------------------
224 "DYNAMIC_ANNOTATIONS_ENABLED=1",
225 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
229 if (disable_iterator_debugging) {
230 # Iterator debugging is enabled by the compiler on debug builds, and we
231 # have to tell it to turn it off.
232 defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
234 } else if (is_linux && !is_android && current_cpu == "x64" &&
235 !disable_iterator_debugging) {
236 # Enable libstdc++ debugging facilities to help catch problems early, see
237 # http://crbug.com/65151 .
238 # TODO(phajdan.jr): Should we enable this for all of POSIX?
239 defines += [ "_GLIBCXX_DEBUG=1" ]
244 defines = [ "NDEBUG" ]
247 # Default libraries ------------------------------------------------------------
249 # This config defines the default libraries applied to all targets.
250 config("default_libs") {
252 # TODO(brettw) this list of defaults should probably be smaller, and
253 # instead the targets that use the less common ones (e.g. wininet or
254 # winspool) should include those explicitly.
280 # Please don't add more stuff here. We should actually be making this
281 # list smaller, since all common things should be covered. If you need
282 # some extra libraries, please just add a libs = [ "foo.lib" ] to your
283 # target that needs it.
285 } else if (is_android) {
286 # Android uses -nostdlib so we need to add even libc here.
288 # TODO(brettw) write a version of this, hopefully we can express this
289 # without forking out to GCC just to get the library name. The android
290 # toolchain directory should probably be extracted into a .gni file that
291 # this file and the android toolchain .gn file can share.
292 # # Manually link the libgcc.a that the cross compiler uses.
293 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
301 "ApplicationServices.framework",
303 "CoreFoundation.framework",
304 "Foundation.framework",
306 "Security.framework",
310 "CoreFoundation.framework",
311 "CoreGraphics.framework",
312 "CoreText.framework",
313 "Foundation.framework",
316 } else if (is_linux) {