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
24 # TODO(brettw) Most of these should be removed. Instead of global feature
25 # flags, we should have more modular flags that apply only to a target and its
26 # dependents. For example, depending on the "x11" meta-target should define
27 # USE_X11 for all dependents so that everything that could use X11 gets the
28 # define, but anything that doesn't depend on X11 doesn't see it.
30 # For now we define these globally to match the current GYP build.
31 config("feature_flags") {
32 # TODO(brettw) most of these need to be parameterized.
35 "V8_DEPRECATION_WARNINGS", # Don't use deprecated V8 APIs anywhere.
38 if (cld_version > 0) {
39 defines += [ "CLD_VERSION=$cld_version" ]
42 defines += [ "ENABLE_MDNS=1" ]
44 if (enable_notifications) {
45 defines += [ "ENABLE_NOTIFICATIONS" ]
47 if (enable_pepper_cdms) {
48 # TODO(brettw) should probably be "=1"
49 defines += [ "ENABLE_PEPPER_CDMS" ]
51 if (enable_browser_cdms) {
52 # TODO(brettw) should probably be "=1"
53 defines += [ "ENABLE_BROWSER_CDMS" ]
56 defines += [ "ENABLE_PLUGINS=1" ]
58 if (enable_basic_printing || enable_print_preview) {
59 # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW.
60 defines += [ "ENABLE_PRINTING=1" ]
61 if (enable_basic_printing) {
62 # Enable basic printing support and UI.
63 defines += [ "ENABLE_BASIC_PRINTING=1" ]
65 if (enable_print_preview) {
66 # Enable printing with print preview.
67 # Can be defined without ENABLE_BASIC_PRINTING.
68 defines += [ "ENABLE_PRINT_PREVIEW=1" ]
71 if (enable_spellcheck) {
72 defines += [ "ENABLE_SPELLCHECK=1" ]
74 if (dont_embed_build_metadata) {
75 defines += [ "DONT_EMBED_BUILD_METADATA" ]
78 # TODO(brettw) should probably be "=1".
79 defines += [ "USE_UDEV" ]
82 defines += [ "TOOLKIT_VIEWS=1" ]
84 if (ui_compositor_image_transport) {
85 # TODO(brettw) should probably be "=1".
86 defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
89 defines += [ "USE_ASH=1" ]
92 defines += [ "USE_AURA=1" ]
95 defines += [ "USE_PANGO=1" ]
98 defines += [ "USE_CAIRO=1" ]
100 if (use_clipboard_aurax11) {
101 defines += [ "USE_CLIPBOARD_AURAX11=1" ]
103 if (use_default_render_theme) {
104 defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
107 defines += [ "USE_GLIB=1" ]
110 defines += [ "USE_OPENSSL=1" ]
111 if (use_openssl_certs) {
112 defines += [ "USE_OPENSSL_CERTS=1" ]
114 } else if (use_nss_certs) {
115 # USE_NSS really means "use nss for certificate validation and storage"
116 # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
117 # to rename this but we're hoping to transition away from NSS.
118 defines += [ "USE_NSS=1" ]
121 defines += [ "USE_OZONE=1" ]
124 defines += [ "USE_X11=1" ]
126 if (use_allocator != "tcmalloc") {
127 defines += [ "NO_TCMALLOC" ]
132 "MEMORY_TOOL_REPLACES_ALLOCATOR",
133 "MEMORY_SANITIZER_INITIAL_SIZE",
137 defines += [ "ENABLE_WEBRTC=1" ]
139 if (disable_ftp_support) {
140 defines += [ "DISABLE_FTP_SUPPORT=1" ]
143 defines += [ "DISABLE_NACL" ]
145 if (enable_extensions) {
146 defines += [ "ENABLE_EXTENSIONS=1" ]
148 if (enable_configuration_policy) {
149 defines += [ "ENABLE_CONFIGURATION_POLICY" ]
151 if (enable_task_manager) {
152 defines += [ "ENABLE_TASK_MANAGER=1" ]
155 defines += [ "ENABLE_THEMES=1" ]
157 if (enable_captive_portal_detection) {
158 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
160 if (enable_session_service) {
161 defines += [ "ENABLE_SESSION_SERVICE=1" ]
164 defines += [ "ENABLE_RLZ" ]
166 if (enable_plugin_installation) {
167 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
169 if (enable_app_list) {
170 defines += [ "ENABLE_APP_LIST=1" ]
172 if (enable_settings_app) {
173 defines += [ "ENABLE_SETTINGS_APP=1" ]
175 if (enable_supervised_users) {
176 defines += [ "ENABLE_SUPERVISED_USERS=1" ]
178 if (enable_service_discovery) {
179 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
181 if (enable_autofill_dialog) {
182 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
184 if (enable_wifi_bootstrapping) {
185 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
187 if (enable_image_loader_extension) {
188 defines += [ "IMAGE_LOADER_EXTENSION=1" ]
190 if (enable_remoting) {
191 defines += [ "ENABLE_REMOTING=1" ]
193 if (enable_google_now) {
194 defines += [ "ENABLE_GOOGLE_NOW=1" ]
196 if (enable_one_click_signin) {
197 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
200 defines += [ "USE_ATHENA=1" ]
203 defines += [ "ENABLE_HIDPI=1" ]
205 if (proprietary_codecs) {
206 defines += [ "USE_PROPRIETARY_CODECS" ]
208 if (enable_hangout_services_extension) {
209 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
211 if (v8_use_external_startup_data) {
212 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
216 # Debug/release ----------------------------------------------------------------
221 "DYNAMIC_ANNOTATIONS_ENABLED=1",
222 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
226 if (disable_iterator_debugging) {
227 # Iterator debugging is enabled by the compiler on debug builds, and we
228 # have to tell it to turn it off.
229 defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
231 } else if (is_linux && !is_android && cpu_arch == "x64" &&
232 !disable_iterator_debugging) {
233 # Enable libstdc++ debugging facilities to help catch problems early, see
234 # http://crbug.com/65151 .
235 # TODO(phajdan.jr): Should we enable this for all of POSIX?
236 defines += [ "_GLIBCXX_DEBUG=1" ]
241 defines = [ "NDEBUG" ]
244 # Default libraries ------------------------------------------------------------
246 # This config defines the default libraries applied to all targets.
247 config("default_libs") {
249 # TODO(brettw) this list of defaults should probably be smaller, and
250 # instead the targets that use the less common ones (e.g. wininet or
251 # winspool) should include those explicitly.
277 # Please don't add more stuff here. We should actually be making this
278 # list smaller, since all common things should be covered. If you need
279 # some extra libraries, please just add a libs = [ "foo.lib" ] to your
280 # target that needs it.
282 } else if (is_android) {
283 # Android uses -nostdlib so we need to add even libc here.
285 # TODO(brettw) write a version of this, hopefully we can express this
286 # without forking out to GCC just to get the library name. The android
287 # toolchain directory should probably be extracted into a .gni file that
288 # this file and the android toolchain .gn file can share.
289 # # Manually link the libgcc.a that the cross compiler uses.
290 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
298 "ApplicationServices.framework",
300 "CoreFoundation.framework",
301 "Foundation.framework",
303 "Security.framework",
307 "CoreFoundation.framework",
308 "CoreGraphics.framework",
309 "CoreText.framework",
310 "Foundation.framework",
313 } else if (is_linux) {