Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / build / config / BUILD.gn
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.
4
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
10 declare_args() {
11   # When set, turns off the (normally-on) iterator debugging and related stuff
12   # that is normally turned on for Debug builds. These are generally useful for
13   # catching bugs but in some cases may cause conflicts or excessive slowness.
14   disable_iterator_debugging = false
15
16   # Set to true to not store any build metadata (this isn't working yet but
17   # this flag will help us to get there). See http://crbug.com/314403.
18   # TODO(sebmarchand): Update this comment once this flag guarantee that
19   #     there's no build metadata in the build artifacts.
20   dont_embed_build_metadata = false
21 }
22
23 # TODO(brettw) Most of these should be removed. Instead of global feature
24 # flags, we should have more modular flags that apply only to a target and its
25 # dependents. For example, depending on the "x11" meta-target should define
26 # USE_X11 for all dependents so that everything that could use X11 gets the
27 # define, but anything that doesn't depend on X11 doesn't see it.
28 #
29 # For now we define these globally to match the current GYP build.
30 config("feature_flags") {
31   # TODO(brettw) most of these need to be parameterized.
32   defines = [
33       "CHROMIUM_BUILD",
34       "V8_DEPRECATION_WARNINGS",  # Don't use deprecated V8 APIs anywhere.
35   ]
36
37   if (cld_version > 0) {
38     defines += [ "CLD_VERSION=$cld_version" ]
39   }
40   if (enable_mdns) {
41     defines += [ "ENABLE_MDNS=1" ]
42   }
43   if (enable_notifications) {
44     defines += [ "ENABLE_NOTIFICATIONS" ]
45   }
46   if (enable_pepper_cdms) {
47     # TODO(brettw) should probably be "=1"
48     defines += [ "ENABLE_PEPPER_CDMS" ]
49   }
50   if (enable_browser_cdms) {
51     # TODO(brettw) should probably be "=1"
52     defines += [ "ENABLE_BROWSER_CDMS" ]
53   }
54   if (enable_plugins) {
55     defines += [ "ENABLE_PLUGINS=1" ]
56   }
57   if (enable_basic_printing || enable_print_preview) {
58     # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW.
59     defines += [ "ENABLE_PRINTING=1" ]
60     if (enable_basic_printing) {
61       # Enable basic printing support and UI.
62       defines += [ "ENABLE_BASIC_PRINTING=1" ]
63     }
64     if (enable_print_preview) {
65       # Enable printing with print preview.
66       # Can be defined without ENABLE_BASIC_PRINTING.
67       defines += [ "ENABLE_PRINT_PREVIEW=1" ]
68     }
69   }
70   if (enable_spellcheck) {
71     defines += [ "ENABLE_SPELLCHECK=1" ]
72   }
73   if (dont_embed_build_metadata) {
74     defines += [ "DONT_EMBED_BUILD_METADATA" ]
75   }
76   if (use_udev) {
77     # TODO(brettw) should probably be "=1".
78     defines += [ "USE_UDEV" ]
79   }
80   if (toolkit_views) {
81     defines += [ "TOOLKIT_VIEWS=1" ]
82   }
83   if (ui_compositor_image_transport) {
84     # TODO(brettw) should probably be "=1".
85     defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
86   }
87   if (use_ash) {
88     defines += [ "USE_ASH=1" ]
89   }
90   if (use_aura) {
91     defines += [ "USE_AURA=1" ]
92   }
93   if (use_pango) {
94     defines += [ "USE_PANGO=1" ]
95   }
96   if (use_cairo) {
97     defines += [ "USE_CAIRO=1" ]
98   }
99   if (use_clipboard_aurax11) {
100     defines += [ "USE_CLIPBOARD_AURAX11=1" ]
101   }
102   if (use_default_render_theme) {
103     defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
104   }
105   if (use_glib) {
106     defines += [ "USE_GLIB=1" ]
107   }
108   if (use_openssl) {
109     defines += [ "USE_OPENSSL=1" ]
110     if (use_openssl_certs) {
111       defines += [ "USE_OPENSSL_CERTS=1" ]
112     }
113   } else if (use_nss_certs) {
114     # USE_NSS really means "use nss for certificate validation and storage"
115     # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
116     # to rename this but we're hoping to transition away from NSS.
117     defines += [ "USE_NSS=1" ]
118   }
119   if (use_ozone) {
120     defines += [ "USE_OZONE=1" ]
121   }
122   if (use_x11) {
123     defines += [ "USE_X11=1" ]
124     if (use_xi2_mt > 0) {
125       defines += [ "USE_XI2_MT=$use_xi2_mt" ]
126     }
127   }
128   if (use_allocator != "tcmalloc") {
129     defines += [ "NO_TCMALLOC" ]
130   }
131   if (is_asan) {
132     defines += [
133       "ADDRESS_SANITIZER",
134       "MEMORY_TOOL_REPLACES_ALLOCATOR",
135       "MEMORY_SANITIZER_INITIAL_SIZE",
136     ]
137   }
138   if (enable_webrtc) {
139     defines += [ "ENABLE_WEBRTC=1" ]
140   }
141   if (disable_ftp_support) {
142     defines += [ "DISABLE_FTP_SUPPORT=1" ]
143   }
144   if (!enable_nacl) {
145     defines += [ "DISABLE_NACL" ]
146   }
147   if (enable_extensions) {
148     defines += [ "ENABLE_EXTENSIONS=1" ]
149   }
150   if (enable_configuration_policy) {
151     defines += [ "ENABLE_CONFIGURATION_POLICY" ]
152   }
153   if (enable_task_manager) {
154     defines += [ "ENABLE_TASK_MANAGER=1" ]
155   }
156   if (enable_themes) {
157     defines += [ "ENABLE_THEMES=1" ]
158   }
159   if (enable_captive_portal_detection) {
160     defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
161   }
162   if (enable_session_service) {
163     defines += [ "ENABLE_SESSION_SERVICE=1" ]
164   }
165   if (enable_rlz) {
166     defines += [ "ENABLE_RLZ" ]
167   }
168   if (enable_plugin_installation) {
169     defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
170   }
171   if (enable_app_list) {
172     defines += [ "ENABLE_APP_LIST=1" ]
173   }
174   if (enable_settings_app) {
175     defines += [ "ENABLE_SETTINGS_APP=1" ]
176   }
177   if (enable_managed_users) {
178     defines += [ "ENABLE_MANAGED_USERS=1" ]
179   }
180   if (enable_service_discovery) {
181     defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
182   }
183   if (enable_autofill_dialog) {
184     defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
185   }
186   if (enable_wifi_bootstrapping) {
187     defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
188   }
189   if (enable_image_loader_extension) {
190     defines += [ "IMAGE_LOADER_EXTENSION=1" ]
191   }
192   if (enable_remoting) {
193     defines += [ "ENABLE_REMOTING=1" ]
194   }
195   if (enable_google_now) {
196     defines += [ "ENABLE_GOOGLE_NOW=1" ]
197   }
198   if (enable_one_click_signin) {
199     defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
200   }
201   if (use_athena) {
202     defines += [ "USE_ATHENA=1" ]
203   }
204   if (enable_hidpi) {
205     defines += [ "ENABLE_HIDPI=1" ]
206   }
207   if (proprietary_codecs) {
208     defines += [ "USE_PROPRIETARY_CODECS" ]
209   }
210 }
211
212 # Debug/release ----------------------------------------------------------------
213
214 config("debug") {
215   defines = [
216     "_DEBUG",
217     "DYNAMIC_ANNOTATIONS_ENABLED=1",
218     "WTF_USE_DYNAMIC_ANNOTATIONS=1",
219   ]
220
221   if (is_win) {
222     if (disable_iterator_debugging) {
223       # Iterator debugging is enabled by the compiler on debug builds, and we
224       # have to tell it to turn it off.
225       defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
226     }
227   } else if (is_linux && !is_android && cpu_arch == "x64" &&
228              !disable_iterator_debugging) {
229     # Enable libstdc++ debugging facilities to help catch problems early, see
230     # http://crbug.com/65151 .
231     # TODO(phajdan.jr): Should we enable this for all of POSIX?
232     defines += [ "_GLIBCXX_DEBUG=1" ]
233   }
234 }
235
236 config("release") {
237   defines = [
238     "NDEBUG",
239   ]
240 }
241
242 # Default libraries ------------------------------------------------------------
243
244 # This config defines the default libraries applied to all targets.
245 config("default_libs") {
246   if (is_win) {
247     # TODO(brettw) this list of defaults should probably be smaller, and
248     # instead the targets that use the less common ones (e.g. wininet or
249     # winspool) should include those explicitly.
250     libs = [
251       "advapi32.lib",
252       "comdlg32.lib",
253       "dbghelp.lib",
254       "delayimp.lib",
255       "dnsapi.lib",
256       "gdi32.lib",
257       "kernel32.lib",
258       "msimg32.lib",
259       "odbc32.lib",
260       "odbccp32.lib",
261       "ole32.lib",
262       "oleaut32.lib",
263       "psapi.lib",
264       "shell32.lib",
265       "shlwapi.lib",
266       "user32.lib",
267       "usp10.lib",
268       "uuid.lib",
269       "version.lib",
270       "wininet.lib",
271       "winmm.lib",
272       "winspool.lib",
273       "ws2_32.lib",
274       # Please don't add more stuff here. We should actually be making this
275       # list smaller, since all common things should be covered. If you need
276       # some extra libraries, please just add a libs = [ "foo.lib" ] to your
277       # target that needs it.
278     ]
279   } else if (is_android) {
280     # Android uses -nostdlib so we need to add even libc here.
281     libs = [
282       # TODO(brettw) write a version of this, hopefully we can express this
283       # without forking out to GCC just to get the library name. The android
284       # toolchain directory should probably be extracted into a .gni file that
285       # this file and the android toolchain .gn file can share.
286       #   # Manually link the libgcc.a that the cross compiler uses.
287       #   '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
288       "c",
289       "dl",
290       "m"
291     ]
292   } else if (is_mac) {
293     libs = [
294       "AppKit.framework",
295       "ApplicationServices.framework",
296       "Carbon.framework",
297       "CoreFoundation.framework",
298       "Foundation.framework",
299       "IOKit.framework",
300       "Security.framework",
301     ]
302   } else if (is_ios) {
303     libs = [
304       "CoreFoundation.framework",
305       "CoreGraphics.framework",
306       "CoreText.framework",
307       "Foundation.framework",
308       "UIKit.framework",
309     ]
310   } else if (is_linux) {
311     libs = [
312       "dl",
313     ]
314   }
315 }