Upstream version 7.36.149.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/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8
9 declare_args() {
10   # When set, turns off the (normally-on) iterator debugging and related stuff
11   # that is normally turned on for Debug builds. These are generally useful for
12   # catching bugs but in some cases may cause conflicts or excessive slowness.
13   disable_iterator_debugging = false
14 }
15
16 # TODO(brettw) Most of these should be removed. Instead of global feature
17 # flags, we should have more modular flags that apply only to a target and its
18 # dependents. For example, depending on the "x11" meta-target should define
19 # USE_X11 for all dependents so that everything that could use X11 gets the
20 # define, but anything that doesn't depend on X11 doesn't see it.
21 #
22 # For now we define these globally to match the current GYP build.
23 config("feature_flags") {
24   # TODO(brettw) most of these need to be parameterized.
25   defines = [
26       "CHROMIUM_BUILD",
27       "ENABLE_ONE_CLICK_SIGNIN",
28       "ENABLE_REMOTING=1",
29       "ENABLE_WEBRTC=1",
30       "ENABLE_CONFIGURATION_POLICY",
31       "ENABLE_NOTIFICATIONS",
32       "ENABLE_EGLIMAGE=1",
33       "ENABLE_TASK_MANAGER=1",
34       "ENABLE_EXTENSIONS=1",
35       "ENABLE_PLUGIN_INSTALLATION=1",
36       "ENABLE_SESSION_SERVICE=1",
37       "ENABLE_THEMES=1",
38       "ENABLE_AUTOFILL_DIALOG=1",
39       "ENABLE_BACKGROUND=1",
40       "ENABLE_GOOGLE_NOW=1",
41       "ENABLE_CAPTIVE_PORTAL_DETECTION=1",
42       "ENABLE_APP_LIST=1",
43       "ENABLE_SETTINGS_APP=1",
44       "ENABLE_MANAGED_USERS=1",
45       "ENABLE_SERVICE_DISCOVERY=1",
46       "USE_MOJO=1",
47       "V8_DEPRECATION_WARNINGS",  # Don't use deprecated V8 APIs anywhere.
48       # Temporary suppression until Blink code can be removed.
49       "BLINK_SCALE_FILTERS_AT_RECORD_TIME",
50   ]
51
52   if (cld_version > 0) {
53     defines += [ "CLD_VERSION=$cld_version" ]
54   }
55   if (enable_mdns) {
56     defines += [ "ENABLE_MDNS=1" ]
57   }
58   if (enable_pepper_cdms) {
59     # TODO(brettw) should probably be "=1"
60     defines += [ "ENABLE_PEPPER_CDMS" ]
61   }
62   if (enable_plugins) {
63     defines += [ "ENABLE_PLUGINS=1" ]
64   }
65   if (enable_printing > 0) {
66     defines += [ "ENABLE_PRINTING=1" ]
67     if (enable_printing < 2) {
68       defines += [ "ENABLE_FULL_PRINTING=1" ]
69     }
70   }
71   if (enable_spellcheck) {
72     defines += [ "ENABLE_SPELLCHECK=1" ]
73   }
74   if (use_udev) {
75     # TODO(brettw) should probably be "=1".
76     defines += [ "USE_UDEV" ]
77   }
78   if (toolkit_views) {
79     defines += [ "TOOLKIT_VIEWS=1" ]
80   }
81   if (ui_compositor_image_transport) {
82     # TODO(brettw) should probably be "=1".
83     defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
84   }
85   if (use_ash) {
86     defines += [ "USE_ASH=1" ]
87   }
88   if (use_aura) {
89     defines += [ "USE_AURA=1" ]
90   }
91   if (use_cairo) {
92     defines += [ "USE_CAIRO=1" ]
93   }
94   if (use_clipboard_aurax11) {
95     defines += [ "USE_CLIPBOARD_AURAX11=1" ]
96   }
97   if (use_default_render_theme) {
98     defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
99   }
100   if (use_glib) {
101     defines += [ "USE_GLIB=1" ]
102   }
103   if (use_openssl) {
104     defines += [ "USE_OPENSSL=1" ]
105     if (use_openssl_certs) {
106       defines += [ "USE_OPENSSL_CERTS=1" ]
107     }
108   } else if (use_nss_certs) {
109     # USE_NSS really means "use nss for certificate validation and storage"
110     # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
111     # to rename this but we're hoping to transition away from NSS.
112     defines += [ "USE_NSS=1" ]
113   }
114   if (use_ozone) {
115     defines += [ "USE_OZONE=1" ]
116   }
117   if (use_x11) {
118     defines += [ "USE_X11=1" ]
119     if (use_xi2_mt > 0) {
120       defines += [ "USE_XI2_MT=$use_xi2_mt" ]
121     }
122   }
123 }
124
125 # Debug/release ----------------------------------------------------------------
126
127 config("debug") {
128   defines = [
129     "_DEBUG",
130     "DYNAMIC_ANNOTATIONS_ENABLED=1",
131     "WTF_USE_DYNAMIC_ANNOTATIONS=1",
132   ]
133
134   if (is_win) {
135     if (disable_iterator_debugging) {
136       # Iterator debugging is enabled by the compiler on debug builds, and we
137       # have to tell it to turn it off.
138       defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
139     }
140   } else if (is_linux && !is_android && cpu_arch == "x64" &&
141              !disable_iterator_debugging) {
142     # Enable libstdc++ debugging facilities to help catch problems early, see
143     # http://crbug.com/65151 .
144     # TODO(phajdan.jr): Should we enable this for all of POSIX?
145     defines += [ "_GLIBCXX_DEBUG=1" ]
146   }
147 }
148
149 config("release") {
150 }
151
152 # Default libraries ------------------------------------------------------------
153
154 # This config defines the default libraries applied to all targets.
155 config("default_libs") {
156   if (is_win) {
157     # TODO(brettw) this list of defaults should probably be smaller, and
158     # instead the targets that use the less common ones (e.g. wininet or
159     # winspool) should include those explicitly.
160     libs = [
161       "advapi32.lib",
162       "comdlg32.lib",
163       "dbghelp.lib",
164       "delayimp.lib",
165       "dnsapi.lib",
166       "gdi32.lib",
167       "kernel32.lib",
168       "msimg32.lib",
169       "odbc32.lib",
170       "odbccp32.lib",
171       "ole32.lib",
172       "oleaut32.lib",
173       "psapi.lib",
174       "shell32.lib",
175       "shlwapi.lib",
176       "user32.lib",
177       "usp10.lib",
178       "uuid.lib",
179       "version.lib",
180       "wininet.lib",
181       "winmm.lib",
182       "winspool.lib",
183       "ws2_32.lib",
184       # Please don't add more stuff here. We should actually be making this
185       # list smaller, since all common things should be covered. If you need
186       # some extra libraries, please just add a libs = [ "foo.lib" ] to your
187       # target that needs it.
188     ]
189   } else if (is_android) {
190     # Android uses -nostdlib so we need to add even libc here.
191     libs = [
192       # TODO(brettw) write a version of this, hopefully we can express this
193       # without forking out to GCC just to get the library name. The android
194       # toolchain directory should probably be extracted into a .gni file that
195       # this file and the android toolchain .gn file can share.
196       #   # Manually link the libgcc.a that the cross compiler uses.
197       #   '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
198       "c",
199       "dl",
200       "m"
201     ]
202   } else if (is_mac) {
203     libs = [
204       "AppKit.framework",
205       "ApplicationServices.framework",
206       "Carbon.framework",
207       "CoreFoundation.framework",
208       "Foundation.framework",
209       "IOKit.framework",
210       "Security.framework",
211     ]
212   } else if (is_ios) {
213     libs = [
214       "CoreFoundation.framework",
215       "CoreGraphics.framework",
216       "CoreText.framework",
217       "Foundation.framework",
218       "UIKit.framework",
219     ]
220   } else if (is_linux) {
221     libs = [
222       "dl",
223     ]
224   }
225 }