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, e.g. ifdef out all __DATE__
18 # and __TIME__. Set to 0 to reenable the use of these macros in the code
19 # base. See http://crbug.com/314403.
21 # Continue to embed build meta data in Official builds, basically the
23 # TODO(maruel): This decision should be revisited because having an
24 # official deterministic build has high value too but MSVC toolset can't
25 # generate anything deterministic with WPO enabled AFAIK.
26 dont_embed_build_metadata = is_official_build
28 # Set to true to enable dcheck in Release builds.
29 dcheck_always_on = false
31 # Set to true to compile with the OpenGL ES 2.0 conformance tests.
32 internal_gles2_conform_tests = false
35 # TODO(brettw) Most of these should be removed. Instead of global feature
36 # flags, we should have more modular flags that apply only to a target and its
37 # dependents. For example, depending on the "x11" meta-target should define
38 # USE_X11 for all dependents so that everything that could use X11 gets the
39 # define, but anything that doesn't depend on X11 doesn't see it.
41 # For now we define these globally to match the current GYP build.
42 config("feature_flags") {
43 # TODO(brettw) most of these need to be parameterized.
46 "V8_DEPRECATION_WARNINGS", # Don't use deprecated V8 APIs anywhere.
49 if (cld_version > 0) {
50 defines += [ "CLD_VERSION=$cld_version" ]
53 defines += [ "ENABLE_MDNS=1" ]
55 if (enable_notifications) {
56 defines += [ "ENABLE_NOTIFICATIONS" ]
58 if (enable_pepper_cdms) {
59 # TODO(brettw) should probably be "=1"
60 defines += [ "ENABLE_PEPPER_CDMS" ]
62 if (enable_browser_cdms) {
63 # TODO(brettw) should probably be "=1"
64 defines += [ "ENABLE_BROWSER_CDMS" ]
67 defines += [ "ENABLE_PLUGINS=1" ]
69 if (enable_basic_printing || enable_print_preview) {
70 # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW.
71 defines += [ "ENABLE_PRINTING=1" ]
72 if (enable_basic_printing) {
73 # Enable basic printing support and UI.
74 defines += [ "ENABLE_BASIC_PRINTING=1" ]
76 if (enable_print_preview) {
77 # Enable printing with print preview.
78 # Can be defined without ENABLE_BASIC_PRINTING.
79 defines += [ "ENABLE_PRINT_PREVIEW=1" ]
82 if (enable_spellcheck) {
83 defines += [ "ENABLE_SPELLCHECK=1" ]
85 if (dont_embed_build_metadata) {
86 defines += [ "DONT_EMBED_BUILD_METADATA" ]
88 if (dcheck_always_on) {
89 defines += [ "DCHECK_ALWAYS_ON=1" ]
92 # TODO(brettw) should probably be "=1".
93 defines += [ "USE_UDEV" ]
96 defines += [ "TOOLKIT_VIEWS=1" ]
98 if (ui_compositor_image_transport) {
99 # TODO(brettw) should probably be "=1".
100 defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
103 defines += [ "USE_ASH=1" ]
106 defines += [ "USE_AURA=1" ]
109 defines += [ "USE_PANGO=1" ]
112 defines += [ "USE_CAIRO=1" ]
114 if (use_clipboard_aurax11) {
115 defines += [ "USE_CLIPBOARD_AURAX11=1" ]
117 if (use_default_render_theme) {
118 defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
121 defines += [ "USE_GLIB=1" ]
124 defines += [ "USE_OPENSSL=1" ]
126 if (use_openssl_certs) {
127 defines += [ "USE_OPENSSL_CERTS=1" ]
130 defines += [ "USE_NSS_CERTS=1" ]
133 defines += [ "USE_OZONE=1" ]
136 defines += [ "USE_X11=1" ]
138 if (use_allocator != "tcmalloc") {
139 defines += [ "NO_TCMALLOC" ]
144 "MEMORY_TOOL_REPLACES_ALLOCATOR",
145 "MEMORY_SANITIZER_INITIAL_SIZE",
149 defines += [ "ENABLE_WEBRTC=1" ]
151 if (disable_ftp_support) {
152 defines += [ "DISABLE_FTP_SUPPORT=1" ]
155 defines += [ "DISABLE_NACL" ]
157 if (enable_extensions) {
158 defines += [ "ENABLE_EXTENSIONS=1" ]
160 if (enable_configuration_policy) {
161 defines += [ "ENABLE_CONFIGURATION_POLICY" ]
163 if (enable_task_manager) {
164 defines += [ "ENABLE_TASK_MANAGER=1" ]
167 defines += [ "ENABLE_THEMES=1" ]
169 if (enable_captive_portal_detection) {
170 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
172 if (enable_session_service) {
173 defines += [ "ENABLE_SESSION_SERVICE=1" ]
176 defines += [ "ENABLE_RLZ" ]
178 if (enable_plugin_installation) {
179 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
181 if (enable_app_list) {
182 defines += [ "ENABLE_APP_LIST=1" ]
184 if (enable_settings_app) {
185 defines += [ "ENABLE_SETTINGS_APP=1" ]
187 if (enable_supervised_users) {
188 defines += [ "ENABLE_SUPERVISED_USERS=1" ]
190 if (enable_service_discovery) {
191 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
193 if (enable_autofill_dialog) {
194 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
196 if (enable_wifi_bootstrapping) {
197 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
199 if (enable_image_loader_extension) {
200 defines += [ "IMAGE_LOADER_EXTENSION=1" ]
202 if (enable_remoting) {
203 defines += [ "ENABLE_REMOTING=1" ]
205 if (enable_google_now) {
206 defines += [ "ENABLE_GOOGLE_NOW=1" ]
208 if (enable_one_click_signin) {
209 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
212 defines += [ "ENABLE_HIDPI=1" ]
214 if (proprietary_codecs) {
215 defines += [ "USE_PROPRIETARY_CODECS" ]
217 if (enable_hangout_services_extension) {
218 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
220 if (v8_use_external_startup_data) {
221 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
223 if (enable_background) {
224 defines += [ "ENABLE_BACKGROUND=1" ]
226 if (enable_pre_sync_backup) {
227 defines += [ "ENABLE_PRE_SYNC_BACKUP" ]
229 if (enable_video_hole) {
230 defines += [ "VIDEO_HOLE=1" ]
232 if (safe_browsing_mode == 1) {
233 defines += [ "FULL_SAFE_BROWSING" ]
234 defines += [ "SAFE_BROWSING_CSD" ]
235 defines += [ "SAFE_BROWSING_DB_LOCAL" ]
236 defines += [ "SAFE_BROWSING_SERVICE" ]
237 } else if (safe_browsing_mode == 2) {
238 defines += [ "MOBILE_SAFE_BROWSING" ]
239 defines += [ "SAFE_BROWSING_SERVICE" ]
243 # Debug/release ----------------------------------------------------------------
248 "DYNAMIC_ANNOTATIONS_ENABLED=1",
249 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
253 defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ]
257 if (disable_iterator_debugging) {
258 # Iterator debugging is enabled by the compiler on debug builds, and we
259 # have to tell it to turn it off.
260 defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
262 } else if (is_linux && !is_android && current_cpu == "x64" &&
263 !disable_iterator_debugging) {
264 # Enable libstdc++ debugging facilities to help catch problems early, see
265 # http://crbug.com/65151 .
266 # TODO(phajdan.jr): Should we enable this for all of POSIX?
267 defines += [ "_GLIBCXX_DEBUG=1" ]
272 defines = [ "NDEBUG" ]
275 # Default libraries ------------------------------------------------------------
277 # This config defines the default libraries applied to all targets.
278 config("default_libs") {
280 # TODO(brettw) this list of defaults should probably be smaller, and
281 # instead the targets that use the less common ones (e.g. wininet or
282 # winspool) should include those explicitly.
308 # Please don't add more stuff here. We should actually be making this
309 # list smaller, since all common things should be covered. If you need
310 # some extra libraries, please just add a libs = [ "foo.lib" ] to your
311 # target that needs it.
313 } else if (is_android) {
314 # Android uses -nostdlib so we need to add even libc here.
316 # TODO(brettw) write a version of this, hopefully we can express this
317 # without forking out to GCC just to get the library name. The android
318 # toolchain directory should probably be extracted into a .gni file that
319 # this file and the android toolchain .gn file can share.
320 # # Manually link the libgcc.a that the cross compiler uses.
321 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
329 "ApplicationServices.framework",
331 "CoreFoundation.framework",
332 "Foundation.framework",
334 "Security.framework",
338 "CoreFoundation.framework",
339 "CoreGraphics.framework",
340 "CoreText.framework",
341 "Foundation.framework",
344 } else if (is_linux) {