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