Upstream version 10.39.225.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       "ENABLE_EGLIMAGE=1",
35       "ENABLE_BACKGROUND=1",
36       "V8_DEPRECATION_WARNINGS",  # Don't use deprecated V8 APIs anywhere.
37   ]
38
39   if (cld_version > 0) {
40     defines += [ "CLD_VERSION=$cld_version" ]
41   }
42   if (enable_mdns) {
43     defines += [ "ENABLE_MDNS=1" ]
44   }
45   if (enable_notifications) {
46     defines += [ "ENABLE_NOTIFICATIONS" ]
47   }
48   if (enable_pepper_cdms) {
49     # TODO(brettw) should probably be "=1"
50     defines += [ "ENABLE_PEPPER_CDMS" ]
51   }
52   if (enable_browser_cdms) {
53     # TODO(brettw) should probably be "=1"
54     defines += [ "ENABLE_BROWSER_CDMS" ]
55   }
56   if (enable_plugins) {
57     defines += [ "ENABLE_PLUGINS=1" ]
58   }
59   if (printing_mode > 0) {
60     defines += [ "ENABLE_PRINTING=1" ]
61     if (printing_mode < 2) {
62       defines += [ "ENABLE_FULL_PRINTING=1" ]
63     }
64   }
65   if (enable_spellcheck) {
66     defines += [ "ENABLE_SPELLCHECK=1" ]
67   }
68   if (dont_embed_build_metadata) {
69     defines += [ "DONT_EMBED_BUILD_METADATA" ]
70   }
71   if (use_udev) {
72     # TODO(brettw) should probably be "=1".
73     defines += [ "USE_UDEV" ]
74   }
75   if (toolkit_views) {
76     defines += [ "TOOLKIT_VIEWS=1" ]
77   }
78   if (ui_compositor_image_transport) {
79     # TODO(brettw) should probably be "=1".
80     defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
81   }
82   if (use_ash) {
83     defines += [ "USE_ASH=1" ]
84   }
85   if (use_aura) {
86     defines += [ "USE_AURA=1" ]
87   }
88   if (use_cairo) {
89     defines += [ "USE_CAIRO=1" ]
90   }
91   if (use_clipboard_aurax11) {
92     defines += [ "USE_CLIPBOARD_AURAX11=1" ]
93   }
94   if (use_default_render_theme) {
95     defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
96   }
97   if (use_glib) {
98     defines += [ "USE_GLIB=1" ]
99   }
100   if (use_openssl) {
101     defines += [ "USE_OPENSSL=1" ]
102     if (use_openssl_certs) {
103       defines += [ "USE_OPENSSL_CERTS=1" ]
104     }
105   } else if (use_nss_certs) {
106     # USE_NSS really means "use nss for certificate validation and storage"
107     # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
108     # to rename this but we're hoping to transition away from NSS.
109     defines += [ "USE_NSS=1" ]
110   }
111   if (use_ozone) {
112     defines += [ "USE_OZONE=1" ]
113   }
114   if (use_x11) {
115     defines += [ "USE_X11=1" ]
116     if (use_xi2_mt > 0) {
117       defines += [ "USE_XI2_MT=$use_xi2_mt" ]
118     }
119   }
120   if (use_allocator != "tcmalloc") {
121     defines += [ "NO_TCMALLOC" ]
122   }
123   if (enable_webrtc) {
124     defines += [ "ENABLE_WEBRTC=1" ]
125   }
126   if (disable_ftp_support) {
127     defines += [ "DISABLE_FTP_SUPPORT=1" ]
128   }
129   if (!enable_nacl) {
130     defines += [ "DISABLE_NACL" ]
131   }
132   if (enable_extensions) {
133     defines += [ "ENABLE_EXTENSIONS=1" ]
134   }
135   if (enable_configuration_policy) {
136     defines += [ "ENABLE_CONFIGURATION_POLICY" ]
137   }
138   if (enable_task_manager) {
139     defines += [ "ENABLE_TASK_MANAGER=1" ]
140   }
141   if (enable_themes) {
142     defines += [ "ENABLE_THEMES=1" ]
143   }
144   if (enable_captive_portal_detection) {
145     defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
146   }
147   if (enable_session_service) {
148     defines += [ "ENABLE_SESSION_SERVICE=1" ]
149   }
150   if (enable_rlz) {
151     defines += [ "ENABLE_RLZ" ]
152   }
153   if (enable_plugin_installation) {
154     defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
155   }
156   if (enable_app_list) {
157     defines += [ "ENABLE_APP_LIST=1" ]
158   }
159   if (enable_settings_app) {
160     defines += [ "ENABLE_SETTINGS_APP=1" ]
161   }
162   if (enable_managed_users) {
163     defines += [ "ENABLE_MANAGED_USERS=1" ]
164   }
165   if (enable_service_discovery) {
166     defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
167   }
168   if (enable_autofill_dialog) {
169     defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
170   }
171   if (enable_wifi_bootstrapping) {
172     defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
173   }
174   if (enable_image_loader_extension) {
175     defines += [ "IMAGE_LOADER_EXTENSION=1" ]
176   }
177   if (enable_remoting) {
178     defines += [ "ENABLE_REMOTING=1" ]
179   }
180   if (enable_google_now) {
181     defines += [ "ENABLE_GOOGLE_NOW=1" ]
182   }
183   if (enable_one_click_signin) {
184     defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
185   }
186   if (use_athena) {
187     defines += [ "USE_ATHENA=1" ]
188   }
189   if (enable_hidpi) {
190     defines += [ "ENABLE_HIDPI=1" ]
191   }
192 }
193
194 # Debug/release ----------------------------------------------------------------
195
196 config("debug") {
197   defines = [
198     "_DEBUG",
199     "DYNAMIC_ANNOTATIONS_ENABLED=1",
200     "WTF_USE_DYNAMIC_ANNOTATIONS=1",
201   ]
202
203   if (is_win) {
204     if (disable_iterator_debugging) {
205       # Iterator debugging is enabled by the compiler on debug builds, and we
206       # have to tell it to turn it off.
207       defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
208     }
209   } else if (is_linux && !is_android && cpu_arch == "x64" &&
210              !disable_iterator_debugging) {
211     # Enable libstdc++ debugging facilities to help catch problems early, see
212     # http://crbug.com/65151 .
213     # TODO(phajdan.jr): Should we enable this for all of POSIX?
214     defines += [ "_GLIBCXX_DEBUG=1" ]
215   }
216 }
217
218 config("release") {
219   defines = [
220     "NDEBUG",
221   ]
222 }
223
224 # Default libraries ------------------------------------------------------------
225
226 # This config defines the default libraries applied to all targets.
227 config("default_libs") {
228   if (is_win) {
229     # TODO(brettw) this list of defaults should probably be smaller, and
230     # instead the targets that use the less common ones (e.g. wininet or
231     # winspool) should include those explicitly.
232     libs = [
233       "advapi32.lib",
234       "comdlg32.lib",
235       "dbghelp.lib",
236       "delayimp.lib",
237       "dnsapi.lib",
238       "gdi32.lib",
239       "kernel32.lib",
240       "msimg32.lib",
241       "odbc32.lib",
242       "odbccp32.lib",
243       "ole32.lib",
244       "oleaut32.lib",
245       "psapi.lib",
246       "shell32.lib",
247       "shlwapi.lib",
248       "user32.lib",
249       "usp10.lib",
250       "uuid.lib",
251       "version.lib",
252       "wininet.lib",
253       "winmm.lib",
254       "winspool.lib",
255       "ws2_32.lib",
256       # Please don't add more stuff here. We should actually be making this
257       # list smaller, since all common things should be covered. If you need
258       # some extra libraries, please just add a libs = [ "foo.lib" ] to your
259       # target that needs it.
260     ]
261   } else if (is_android) {
262     # Android uses -nostdlib so we need to add even libc here.
263     libs = [
264       # TODO(brettw) write a version of this, hopefully we can express this
265       # without forking out to GCC just to get the library name. The android
266       # toolchain directory should probably be extracted into a .gni file that
267       # this file and the android toolchain .gn file can share.
268       #   # Manually link the libgcc.a that the cross compiler uses.
269       #   '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
270       "c",
271       "dl",
272       "m"
273     ]
274   } else if (is_mac) {
275     libs = [
276       "AppKit.framework",
277       "ApplicationServices.framework",
278       "Carbon.framework",
279       "CoreFoundation.framework",
280       "Foundation.framework",
281       "IOKit.framework",
282       "Security.framework",
283     ]
284   } else if (is_ios) {
285     libs = [
286       "CoreFoundation.framework",
287       "CoreGraphics.framework",
288       "CoreText.framework",
289       "Foundation.framework",
290       "UIKit.framework",
291     ]
292   } else if (is_linux) {
293     libs = [
294       "dl",
295     ]
296   }
297 }