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) most of these need to be parameterized.
47 "V8_DEPRECATION_WARNINGS", # Don't use deprecated V8 APIs anywhere.
50 if (cld_version > 0) {
51 defines += [ "CLD_VERSION=$cld_version" ]
54 defines += [ "ENABLE_MDNS=1" ]
56 if (enable_notifications) {
57 defines += [ "ENABLE_NOTIFICATIONS" ]
59 if (enable_pepper_cdms) {
60 # TODO(brettw) should probably be "=1"
61 defines += [ "ENABLE_PEPPER_CDMS" ]
63 if (enable_browser_cdms) {
64 # TODO(brettw) should probably be "=1"
65 defines += [ "ENABLE_BROWSER_CDMS" ]
68 defines += [ "ENABLE_PLUGINS=1" ]
70 if (enable_basic_printing || enable_print_preview) {
71 # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW.
72 defines += [ "ENABLE_PRINTING=1" ]
73 if (enable_basic_printing) {
74 # Enable basic printing support and UI.
75 defines += [ "ENABLE_BASIC_PRINTING=1" ]
77 if (enable_print_preview) {
78 # Enable printing with print preview.
79 # Can be defined without ENABLE_BASIC_PRINTING.
80 defines += [ "ENABLE_PRINT_PREVIEW=1" ]
83 if (enable_spellcheck) {
84 defines += [ "ENABLE_SPELLCHECK=1" ]
86 if (dont_embed_build_metadata) {
87 defines += [ "DONT_EMBED_BUILD_METADATA" ]
89 if (dcheck_always_on) {
90 defines += [ "DCHECK_ALWAYS_ON=1" ]
93 # TODO(brettw) should probably be "=1".
94 defines += [ "USE_UDEV" ]
97 defines += [ "TOOLKIT_VIEWS=1" ]
99 if (ui_compositor_image_transport) {
100 # TODO(brettw) should probably be "=1".
101 defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
104 defines += [ "USE_ASH=1" ]
107 defines += [ "USE_AURA=1" ]
110 defines += [ "USE_PANGO=1" ]
113 defines += [ "USE_CAIRO=1" ]
115 if (use_clipboard_aurax11) {
116 defines += [ "USE_CLIPBOARD_AURAX11=1" ]
118 if (use_default_render_theme) {
119 defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
122 defines += [ "USE_GLIB=1" ]
125 defines += [ "USE_OPENSSL=1" ]
127 if (use_openssl_certs) {
128 defines += [ "USE_OPENSSL_CERTS=1" ]
131 defines += [ "USE_NSS_CERTS=1" ]
134 defines += [ "USE_OZONE=1" ]
137 defines += [ "USE_X11=1" ]
139 if (use_allocator != "tcmalloc") {
140 defines += [ "NO_TCMALLOC" ]
145 "MEMORY_TOOL_REPLACES_ALLOCATOR",
146 "MEMORY_SANITIZER_INITIAL_SIZE",
150 defines += [ "ENABLE_WEBRTC=1" ]
152 if (disable_ftp_support) {
153 defines += [ "DISABLE_FTP_SUPPORT=1" ]
156 defines += [ "DISABLE_NACL" ]
158 if (enable_extensions) {
159 defines += [ "ENABLE_EXTENSIONS=1" ]
161 if (enable_configuration_policy) {
162 defines += [ "ENABLE_CONFIGURATION_POLICY" ]
164 if (enable_task_manager) {
165 defines += [ "ENABLE_TASK_MANAGER=1" ]
168 defines += [ "ENABLE_THEMES=1" ]
170 if (enable_captive_portal_detection) {
171 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
173 if (enable_session_service) {
174 defines += [ "ENABLE_SESSION_SERVICE=1" ]
177 defines += [ "ENABLE_RLZ" ]
179 if (enable_plugin_installation) {
180 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
182 if (enable_app_list) {
183 defines += [ "ENABLE_APP_LIST=1" ]
185 if (enable_settings_app) {
186 defines += [ "ENABLE_SETTINGS_APP=1" ]
188 if (enable_supervised_users) {
189 defines += [ "ENABLE_SUPERVISED_USERS=1" ]
191 if (enable_service_discovery) {
192 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
194 if (enable_autofill_dialog) {
195 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
197 if (enable_wifi_bootstrapping) {
198 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
200 if (enable_image_loader_extension) {
201 defines += [ "IMAGE_LOADER_EXTENSION=1" ]
203 if (enable_remoting) {
204 defines += [ "ENABLE_REMOTING=1" ]
206 if (enable_google_now) {
207 defines += [ "ENABLE_GOOGLE_NOW=1" ]
209 if (enable_one_click_signin) {
210 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
213 defines += [ "ENABLE_HIDPI=1" ]
215 if (proprietary_codecs) {
216 defines += [ "USE_PROPRIETARY_CODECS" ]
218 if (enable_hangout_services_extension) {
219 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
221 if (v8_use_external_startup_data) {
222 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
224 if (enable_background) {
225 defines += [ "ENABLE_BACKGROUND=1" ]
227 if (enable_pre_sync_backup) {
228 defines += [ "ENABLE_PRE_SYNC_BACKUP" ]
230 if (enable_video_hole) {
231 defines += [ "VIDEO_HOLE=1" ]
233 if (safe_browsing_mode == 1) {
234 defines += [ "FULL_SAFE_BROWSING" ]
235 defines += [ "SAFE_BROWSING_CSD" ]
236 defines += [ "SAFE_BROWSING_DB_LOCAL" ]
237 defines += [ "SAFE_BROWSING_SERVICE" ]
238 } else if (safe_browsing_mode == 2) {
239 defines += [ "MOBILE_SAFE_BROWSING" ]
240 defines += [ "SAFE_BROWSING_SERVICE" ]
244 # Debug/release ----------------------------------------------------------------
249 "DYNAMIC_ANNOTATIONS_ENABLED=1",
250 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
254 defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ]
258 if (disable_iterator_debugging) {
259 # Iterator debugging is enabled by the compiler on debug builds, and we
260 # have to tell it to turn it off.
261 defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
263 } else if (is_linux && !is_android && current_cpu == "x64" &&
264 !disable_iterator_debugging) {
265 # Enable libstdc++ debugging facilities to help catch problems early, see
266 # http://crbug.com/65151 .
267 # TODO(phajdan.jr): Should we enable this for all of POSIX?
268 defines += [ "_GLIBCXX_DEBUG=1" ]
273 defines = [ "NDEBUG" ]
276 # Default libraries ------------------------------------------------------------
278 # This config defines the default libraries applied to all targets.
279 config("default_libs") {
281 # TODO(brettw) this list of defaults should probably be smaller, and
282 # instead the targets that use the less common ones (e.g. wininet or
283 # winspool) should include those explicitly.
309 # Please don't add more stuff here. We should actually be making this
310 # list smaller, since all common things should be covered. If you need
311 # some extra libraries, please just add a libs = [ "foo.lib" ] to your
312 # target that needs it.
314 } else if (is_android) {
315 # Android uses -nostdlib so we need to add even libc here.
317 # TODO(brettw) write a version of this, hopefully we can express this
318 # without forking out to GCC just to get the library name. The android
319 # toolchain directory should probably be extracted into a .gni file that
320 # this file and the android toolchain .gn file can share.
321 # # Manually link the libgcc.a that the cross compiler uses.
322 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
330 "ApplicationServices.framework",
332 "CoreFoundation.framework",
333 "Foundation.framework",
335 "Security.framework",
339 "CoreFoundation.framework",
340 "CoreGraphics.framework",
341 "CoreText.framework",
342 "Foundation.framework",
345 } else if (is_linux) {