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" ]
125 if (use_openssl_certs) {
126 defines += [ "USE_OPENSSL_CERTS=1" ]
128 } else if (use_nss_certs) {
129 # USE_NSS really means "use nss for certificate validation and storage"
130 # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
131 # to rename this but we're hoping to transition away from NSS.
132 defines += [ "USE_NSS=1" ]
135 defines += [ "USE_OZONE=1" ]
138 defines += [ "USE_X11=1" ]
140 if (use_allocator != "tcmalloc") {
141 defines += [ "NO_TCMALLOC" ]
146 "MEMORY_TOOL_REPLACES_ALLOCATOR",
147 "MEMORY_SANITIZER_INITIAL_SIZE",
151 defines += [ "ENABLE_WEBRTC=1" ]
153 if (disable_ftp_support) {
154 defines += [ "DISABLE_FTP_SUPPORT=1" ]
157 defines += [ "DISABLE_NACL" ]
159 if (enable_extensions) {
160 defines += [ "ENABLE_EXTENSIONS=1" ]
162 if (enable_configuration_policy) {
163 defines += [ "ENABLE_CONFIGURATION_POLICY" ]
165 if (enable_task_manager) {
166 defines += [ "ENABLE_TASK_MANAGER=1" ]
169 defines += [ "ENABLE_THEMES=1" ]
171 if (enable_captive_portal_detection) {
172 defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
174 if (enable_session_service) {
175 defines += [ "ENABLE_SESSION_SERVICE=1" ]
178 defines += [ "ENABLE_RLZ" ]
180 if (enable_plugin_installation) {
181 defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
183 if (enable_app_list) {
184 defines += [ "ENABLE_APP_LIST=1" ]
186 if (enable_settings_app) {
187 defines += [ "ENABLE_SETTINGS_APP=1" ]
189 if (enable_supervised_users) {
190 defines += [ "ENABLE_SUPERVISED_USERS=1" ]
192 if (enable_service_discovery) {
193 defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
195 if (enable_autofill_dialog) {
196 defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
198 if (enable_wifi_bootstrapping) {
199 defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
201 if (enable_image_loader_extension) {
202 defines += [ "IMAGE_LOADER_EXTENSION=1" ]
204 if (enable_remoting) {
205 defines += [ "ENABLE_REMOTING=1" ]
207 if (enable_google_now) {
208 defines += [ "ENABLE_GOOGLE_NOW=1" ]
210 if (enable_one_click_signin) {
211 defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
214 defines += [ "ENABLE_HIDPI=1" ]
216 if (proprietary_codecs) {
217 defines += [ "USE_PROPRIETARY_CODECS" ]
219 if (enable_hangout_services_extension) {
220 defines += [ "ENABLE_HANGOUT_SERVICES_EXTENSION=1" ]
222 if (v8_use_external_startup_data) {
223 defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
225 if (enable_background) {
226 defines += [ "ENABLE_BACKGROUND=1" ]
228 if (enable_pre_sync_backup) {
229 defines += [ "ENABLE_PRE_SYNC_BACKUP" ]
231 if (enable_video_hole) {
232 defines += [ "VIDEO_HOLE=1" ]
236 # Debug/release ----------------------------------------------------------------
241 "DYNAMIC_ANNOTATIONS_ENABLED=1",
242 "WTF_USE_DYNAMIC_ANNOTATIONS=1",
246 defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ]
250 if (disable_iterator_debugging) {
251 # Iterator debugging is enabled by the compiler on debug builds, and we
252 # have to tell it to turn it off.
253 defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
255 } else if (is_linux && !is_android && current_cpu == "x64" &&
256 !disable_iterator_debugging) {
257 # Enable libstdc++ debugging facilities to help catch problems early, see
258 # http://crbug.com/65151 .
259 # TODO(phajdan.jr): Should we enable this for all of POSIX?
260 defines += [ "_GLIBCXX_DEBUG=1" ]
265 defines = [ "NDEBUG" ]
268 # Default libraries ------------------------------------------------------------
270 # This config defines the default libraries applied to all targets.
271 config("default_libs") {
273 # TODO(brettw) this list of defaults should probably be smaller, and
274 # instead the targets that use the less common ones (e.g. wininet or
275 # winspool) should include those explicitly.
301 # Please don't add more stuff here. We should actually be making this
302 # list smaller, since all common things should be covered. If you need
303 # some extra libraries, please just add a libs = [ "foo.lib" ] to your
304 # target that needs it.
306 } else if (is_android) {
307 # Android uses -nostdlib so we need to add even libc here.
309 # TODO(brettw) write a version of this, hopefully we can express this
310 # without forking out to GCC just to get the library name. The android
311 # toolchain directory should probably be extracted into a .gni file that
312 # this file and the android toolchain .gn file can share.
313 # # Manually link the libgcc.a that the cross compiler uses.
314 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
322 "ApplicationServices.framework",
324 "CoreFoundation.framework",
325 "Foundation.framework",
327 "Security.framework",
331 "CoreFoundation.framework",
332 "CoreGraphics.framework",
333 "CoreText.framework",
334 "Foundation.framework",
337 } else if (is_linux) {