Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / BUILD.gn
1 # Copyright 2014 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/ui.gni")
6 import("//third_party/WebKit/Source/build/scripts/scripts.gni")
7 import("//third_party/WebKit/Source/config.gni")
8 import("//third_party/WebKit/Source/platform/platform.gni")
9 import("//third_party/WebKit/Source/platform/platform_generated.gni")
10
11 # Most targets in this file are private actions so use that as the default.
12 visibility = [ ":*" ]
13
14 heap_gypi = exec_script(
15     "//build/gypi_to_gn.py",
16     [ rebase_path("heap/blink_heap.gypi") ],
17     "scope",
18     [ "heap/blink_heap.gypi" ])
19
20 blink_platform_neon_files = [
21   "graphics/cpu/arm/WebGLImageConversionNEON.h",
22 ]
23
24 # blink_common in blink_platform.gyp
25 component("blink_common") {
26   visibility = []  # Allow re-assignment of list.
27   visibility = [ "//third_party/WebKit/*" ]
28   sources = [
29     "exported/WebCString.cpp",
30     "exported/WebString.cpp",
31     "exported/WebCommon.cpp",
32   ]
33
34   defines = [
35     "BLINK_COMMON_IMPLEMENTATION=1",
36     "INSIDE_BLINK",
37   ]
38
39   configs += [
40     "//build/config/compiler:wexit_time_destructors",
41     "//third_party/WebKit/Source:config",
42     "//third_party/WebKit/Source:non_test_config",
43   ]
44
45   deps = [
46     "//third_party/WebKit/Source/wtf",
47   ]
48 }
49
50 # Chromium's version of WebCore includes the following Objective-C classes. The
51 # system-provided WebCore framework may also provide these classes. Because of
52 # the nature of Objective-C binding (dynamically at runtime), it's possible for
53 # the Chromium-provided versions to interfere with the system-provided
54 # versions. This may happen when a system framework attempts to use
55 # core.framework, such as when converting an HTML-flavored string to an
56 # NSAttributedString. The solution is to force Objective-C class names that
57 # would conflict to use alternate names.
58 #
59 # This list will hopefully shrink but may also grow. Its performance is
60 # monitored by the "Check Objective-C Rename" postbuild step, and any
61 # suspicious-looking symbols not handled here or whitelisted in that step will
62 # cause a build failure.
63 #
64 # If this is unhandled, the console will receive log messages
65 # such as:
66 # com.google.Chrome[] objc[]: Class ScrollbarPrefsObserver is implemented in both .../Google Chrome.app/Contents/Versions/.../Google Chrome Helper.app/Contents/MacOS/../../../Google Chrome Framework.framework/Google Chrome Framework and /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/WebCore. One of the two will be used. Which one is undefined.
67 if (is_mac) {
68   config("mac_objc_renaming") {
69     defines = [
70       "WebCascadeList=ChromiumWebCoreObjCWebCascadeList",
71       "WebFontCache=ChromiumWebCoreObjCWebFontCache",
72       "WebScrollAnimationHelperDelegate=ChromiumWebCoreObjCWebScrollAnimationHelperDelegate",
73       "WebScrollbarPainterControllerDelegate=ChromiumWebCoreObjCWebScrollbarPainterControllerDelegate",
74       "WebScrollbarPainterDelegate=ChromiumWebCoreObjCWebScrollbarPainterDelegate",
75       "WebScrollbarPartAnimation=ChromiumWebCoreObjCWebScrollbarPartAnimation",
76       "WebCoreFlippedView=ChromiumWebCoreObjCWebCoreFlippedView",
77       "WebCoreTextFieldCell=ChromiumWebCoreObjCWebCoreTextFieldCell",
78       "WebCoreRenderThemeNotificationObserver=ChromiumWebCoreObjCWebCoreRenderThemeNotificationObserver",
79     ]
80   }
81 }
82
83 # FontFamilyNames action in make_platform_generated in
84 # platform_generated.gyp
85 action("font_family_names") {
86   script = "../build/scripts/make_names.py"
87
88   font_family_names_in = "fonts/FontFamilyNames.in"
89   inputs = make_names_files + [ font_family_names_in ]
90
91   outputs = [
92     "$blink_platform_output_dir/FontFamilyNames.cpp",
93     "$blink_platform_output_dir/FontFamilyNames.h",
94   ]
95
96   args = [
97     rebase_path(font_family_names_in, root_build_dir),
98     "--output_dir",
99     rebase_path(blink_platform_output_dir, root_build_dir),
100   ]
101 }
102
103 # RuntimeEnabledFeatures action in make_platform_generated in
104 # platform_generated.gyp
105 action("runtime_enabled_features") {
106   script = "../build/scripts/make_runtime_features.py"
107
108   runtime_enabled_features_in = "RuntimeEnabledFeatures.in"
109   inputs = scripts_for_in_files + [
110     runtime_enabled_features_in,
111     "../build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl",
112     "../build/scripts/templates/RuntimeEnabledFeatures.h.tmpl",
113   ]
114
115   outputs = [
116     "$blink_platform_output_dir/RuntimeEnabledFeatures.cpp",
117     "$blink_platform_output_dir/RuntimeEnabledFeatures.h",
118   ]
119
120   args = [
121     rebase_path(runtime_enabled_features_in, root_build_dir),
122     "--output_dir",
123     rebase_path(blink_platform_output_dir, root_build_dir),
124   ]
125 }
126
127 # ColorData action in make_platform_generated in platform_generated.gyp
128 action("color_data") {
129   script = "../build/scripts/gperf.py"
130
131   color_data_gperf = "ColorData.gperf"
132   inputs = [ color_data_gperf ]
133
134   output_file = "$blink_platform_output_dir/ColorData.cpp"
135   outputs = [ output_file ]
136
137   args = [
138     gperf_exe,
139     "--key-positions=*",
140     "-D", "-s", "2",
141     rebase_path(color_data_gperf, root_build_dir),
142     "--output-file=" + rebase_path(output_file, root_build_dir),
143   ]
144 }
145
146 # This isn't strictly necessary since we can just add the deps to "platform",
147 # but it helps to have the targets match the GYP build.
148 group("make_platform_generated") {
149   visibility = []  # Allow re-assignment of list.
150   visibility = [ "//third_party/WebKit/Source/*" ]
151   deps = [
152     ":blink_common",
153     ":color_data",
154     ":font_family_names",
155     ":runtime_enabled_features",
156   ]
157 }
158
159 # TODO(brettw) Objective C Renaming postbuild steps on Mac.
160 # blink_platform target in blink_platform.gyp
161 component("platform") {
162   visibility = []  # Allow re-assignment of list.
163   visibility = [ "//third_party/WebKit/*" ]
164   output_name = "blink_platform"
165
166   sources = platform_files
167   sources -= blink_platform_neon_files
168
169   # Add in the generated files.
170   sources +=
171     get_target_outputs(":font_family_names") +
172     get_target_outputs(":runtime_enabled_features") +
173     get_target_outputs(":color_data")
174
175   configs += [
176     "//third_party/WebKit/Source:config",
177     "//third_party/WebKit/Source:non_test_config",
178   ]
179
180   defines = [
181     "BLINK_PLATFORM_IMPLEMENTATION=1",
182     "INSIDE_BLINK",
183   ]
184
185   include_dirs = [
186     #"$angle_path/include",
187     "$root_gen_dir/blink",
188   ]
189
190   public_deps = [
191     "//gpu/command_buffer/client:gles2_c_lib",
192     "//skia",
193     "//third_party:jpeg",
194     "//third_party/iccjpeg",
195     "//third_party/libpng",
196     "//third_party/libwebp",
197     "//third_party/ots",
198     "//third_party/qcms",
199     "//url",
200     "//v8",
201   ]
202   deps = [
203     ":make_platform_generated",
204     "//third_party/harfbuzz-ng",
205     "//third_party/icu",
206     "//third_party/WebKit/Source/wtf",
207     "//third_party/WebKit/Source/platform/heap",
208   ]
209
210   if (is_mac) {
211     sources -= [
212       "fonts/opentype/OpenTypeTypes.h",
213       "fonts/opentype/OpenTypeVerticalData.cpp",
214       "fonts/opentype/OpenTypeVerticalData.h",
215       # The Mac currently uses FontCustomPlatformDataMac.cpp instead.
216       "fonts/skia/FontCustomPlatformDataSkia.cpp",
217       "fonts/skia/FontCacheSkia.cpp",
218       # Uses LocaleMac instead.
219       "text/LocaleICU.cpp",
220       "text/LocaleICU.h",
221       # Uses KillRingMac.mm instead.
222       "KillRingNone.cpp",
223       # Mac uses only ScrollAnimatorMac.
224       "scroll/ScrollbarThemeNonMacCommon.cpp",
225       "scroll/ScrollbarThemeNonMacCommon.h",
226       "scroll/ScrollAnimatorNone.cpp",
227       "scroll/ScrollAnimatorNone.h",
228     ]
229
230     # Some Mac-specific parts of WebKit won't compile without having this
231     # prefix header injected.
232     cflags = [
233       "-include",
234       rebase_path("../build/mac/Prefix.h", root_build_dir),
235     ]
236
237     defines += [ "WebFontCache=ChromiumWebCoreObjCWebFontCache" ]
238     configs += [ ":mac_objc_renaming" ]
239     libs = [
240       "Accelerate.framework",
241       "Carbon.framework",
242       "Foundation.framework",
243     ]
244   } else {
245     sources -= [
246       "geometry/cg/FloatPointCG.cpp",
247       "geometry/cg/FloatRectCG.cpp",
248       "geometry/cg/FloatSizeCG.cpp",
249       "geometry/cg/IntPointCG.cpp",
250       "geometry/cg/IntRectCG.cpp",
251       "geometry/cg/IntSizeCG.cpp",
252     ]
253   }
254
255   if (is_win) {
256     sources -= [
257       # Uses LocaleWin instead.
258       "text/LocaleICU.cpp",
259       "text/LocaleICU.h",
260     ]
261     cflags = [
262       "/wd4267",  # Conversion from 'size_t' to 'type', possible loss of data.
263       "/wd4334",  # Result of 32-bit shift implicitly converted to 64 bits.
264       "/wd4724",  # Modulo by 0.
265     ]
266   } else {
267     sources -= [
268       "clipboard/ClipboardUtilitiesWin.cpp",
269       "fonts/opentype/OpenTypeUtilities.cpp",
270       "fonts/opentype/OpenTypeUtilities.h",
271       "text/LocaleWin.cpp",
272     ]
273   }
274
275   if (is_android) {
276     # Add in some Linux files also shared with Android.
277     set_sources_assignment_filter([])
278     sources += [
279       "exported/linux/WebFontRenderStyle.cpp",
280       "fonts/linux/FontPlatformDataLinux.cpp",
281     ]
282     set_sources_assignment_filter(sources_assignment_filter)
283   } else {
284     sources -= [
285       "scroll/ScrollbarThemeAndroid.cpp",
286     ]
287   }
288
289   if (is_linux) {
290     public_configs = [ "//build/config/linux:fontconfig" ]
291   }
292
293   if (!use_default_render_theme) {
294     sources -= [
295       "scroll/ScrollbarThemeAura.cpp",
296       "scroll/ScrollbarThemeAura.h",
297     ]
298   }
299
300   if (cpu_arch == "arm") {
301     deps += [ ":blink_arm_neon" ]
302   }
303
304   if (use_webaudio_ffmpeg) {
305     include_dirs += [ "//third_party/ffmpeg" ]
306     deps += [ "//third_party/ffmpeg" ]
307   }
308   if (use_openmax_dl_fft) {
309     include_dirs += [ "//third_party/openmax_dl" ]
310     deps += [ "//third_party/openmax_dl/dl" ]
311   }
312 }
313
314 test("heap_unittests") {
315   visibility = []  # Allow re-assignment of list.
316   visibility = [ "//third_party/WebKit/*" ]
317   output_name = "blink_heap_unittests"
318
319   sources = rebase_path(heap_gypi.platform_heap_test_files, ".", "heap")
320   sources += [ "heap/RunAllTests.cpp" ]
321
322   configs += [
323     "//third_party/WebKit/Source/wtf:wtf_config",
324     "//third_party/WebKit/Source:config",
325   ]
326
327   deps = [
328     ":platform",
329     "//base",
330     "//base/allocator",
331     "//base/test:test_support",
332     "//testing/gmock",
333     "//testing/gtest",
334     "//third_party/WebKit/Source/wtf",
335     "//third_party/WebKit/Source/wtf:test_support",
336     "//content/test:test_support",
337   ]
338 }
339
340 test("platform_unittests") {
341   visibility = []  # Allow re-assignment of list.
342   visibility = [ "//third_party/WebKit/*" ]
343   output_name = "blink_platform_unittests"
344
345   sources = platform_test_files
346
347   sources += [ "testing/RunAllTests.cpp" ]
348
349   configs += [
350     "//third_party/WebKit/Source/wtf:wtf_config",
351     "//third_party/WebKit/Source:config",
352   ]
353
354   deps = [
355     ":blink_common",
356     ":platform",
357     "//base",
358     "//base/allocator",
359     "//base/test:test_support",
360     "//skia",
361     "//testing/gmock",
362     "//testing/gtest",
363     "//third_party/WebKit/Source/wtf",
364     "//third_party/WebKit/Source/wtf:test_support",
365     "//url",
366   ]
367
368   defines = [
369     "INSIDE_BLINK",
370   ]
371
372   include_dirs = [
373     "$root_gen_dir/blink",
374   ]
375 }
376
377
378 if (cpu_arch == "arm") {
379   source_set("blink_arm_neon") {
380     sources = blink_platform_neon_files
381
382     # The *NEON.cpp files fail to compile when -mthumb is passed. Force
383     # them to build in ARM mode.
384     # See https://bugs.webkit.org/show_bug.cgi?id=62916.
385     # TODO(GYP)
386     #'cflags': ['-marm'],
387     #    'conditions': [
388     #      ['OS=="android"', {
389     #        'cflags!': ['-mthumb'],
390     #      }],
391     #    ],
392
393     deps = [ ":blink_common" ]
394   }
395 }