Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / BUILD.gn
blob6e7885e4ada40900908a52ebf910cad938090a44
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.
5 import("//build/config/ui.gni")
6 import("//testing/test.gni")
7 import("//third_party/WebKit/Source/build/scripts/scripts.gni")
8 import("//third_party/WebKit/Source/config.gni")
9 import("//third_party/WebKit/Source/platform/platform.gni")
10 import("//third_party/WebKit/Source/platform/platform_generated.gni")
12 # Most targets in this file are private actions so use that as the default.
13 visibility = [ ":*" ]
15 if (!is_mac) {
16   # TODO(GYP): can't link Blink binaries yet on mac.
17   heap_gypi = exec_script(
18       "//build/gypi_to_gn.py",
19       [ rebase_path("heap/blink_heap.gypi") ],
20       "scope",
21       [ "heap/blink_heap.gypi" ])
24 blink_platform_neon_files = [
25   "graphics/cpu/arm/WebGLImageConversionNEON.h",
28 blink_platform_sse_files = [
29   "graphics/cpu/x86/WebGLImageConversionSSE.h",
32 # blink_common in blink_platform.gyp
33 component("blink_common") {
34   visibility = []  # Allow re-assignment of list.
35   visibility = [ "//third_party/WebKit/*" ]
36   sources = [
37     "exported/WebCString.cpp",
38     "exported/WebString.cpp",
39     "exported/WebCommon.cpp",
40   ]
42   defines = [
43     "BLINK_COMMON_IMPLEMENTATION=1",
44     "INSIDE_BLINK",
45   ]
47   configs += [
48     "//build/config/compiler:wexit_time_destructors",
49     "//third_party/WebKit/Source:config",
50     "//third_party/WebKit/Source:non_test_config",
51   ]
53   deps = [
54     "//third_party/WebKit/Source/wtf",
55   ]
58 # Chromium's version of WebCore includes the following Objective-C classes. The
59 # system-provided WebCore framework may also provide these classes. Because of
60 # the nature of Objective-C binding (dynamically at runtime), it's possible for
61 # the Chromium-provided versions to interfere with the system-provided
62 # versions. This may happen when a system framework attempts to use
63 # core.framework, such as when converting an HTML-flavored string to an
64 # NSAttributedString. The solution is to force Objective-C class names that
65 # would conflict to use alternate names.
67 # This list will hopefully shrink but may also grow. Its performance is
68 # monitored by the "Check Objective-C Rename" postbuild step, and any
69 # suspicious-looking symbols not handled here or whitelisted in that step will
70 # cause a build failure.
72 # If this is unhandled, the console will receive log messages
73 # such as:
74 # 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.
75 if (is_mac) {
76   config("mac_objc_renaming") {
77     defines = [
78       "WebCascadeList=ChromiumWebCoreObjCWebCascadeList",
79       "WebFontCache=ChromiumWebCoreObjCWebFontCache",
80       "WebScrollAnimationHelperDelegate=ChromiumWebCoreObjCWebScrollAnimationHelperDelegate",
81       "WebScrollbarPainterControllerDelegate=ChromiumWebCoreObjCWebScrollbarPainterControllerDelegate",
82       "WebScrollbarPainterDelegate=ChromiumWebCoreObjCWebScrollbarPainterDelegate",
83       "WebScrollbarPartAnimation=ChromiumWebCoreObjCWebScrollbarPartAnimation",
84       "WebCoreFlippedView=ChromiumWebCoreObjCWebCoreFlippedView",
85       "WebCoreScrollbarObserver=ChromiumWebCoreObjCWebCoreScrollbarObserver",
86       "WebCoreTextFieldCell=ChromiumWebCoreObjCWebCoreTextFieldCell",
87     ]
88   }
91 # FontFamilyNames action in make_platform_generated in
92 # platform_generated.gyp
93 action("font_family_names") {
94   script = "../build/scripts/make_names.py"
96   font_family_names_in = "fonts/FontFamilyNames.in"
97   inputs = make_names_files + [ font_family_names_in ]
99   outputs = [
100     "$blink_platform_output_dir/FontFamilyNames.cpp",
101     "$blink_platform_output_dir/FontFamilyNames.h",
102   ]
104   args = [
105     rebase_path(font_family_names_in, root_build_dir),
106     "--output_dir",
107     rebase_path(blink_platform_output_dir, root_build_dir),
108   ]
111 # RuntimeEnabledFeatures action in make_platform_generated in
112 # platform_generated.gyp
113 action("runtime_enabled_features") {
114   script = "../build/scripts/make_runtime_features.py"
116   runtime_enabled_features_in = "RuntimeEnabledFeatures.in"
117   inputs = scripts_for_in_files + [
118     runtime_enabled_features_in,
119     "../build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl",
120     "../build/scripts/templates/RuntimeEnabledFeatures.h.tmpl",
121   ]
123   outputs = [
124     "$blink_platform_output_dir/RuntimeEnabledFeatures.cpp",
125     "$blink_platform_output_dir/RuntimeEnabledFeatures.h",
126   ]
128   args = [
129     rebase_path(runtime_enabled_features_in, root_build_dir),
130     "--output_dir",
131     rebase_path(blink_platform_output_dir, root_build_dir),
132   ]
135 # ColorData action in make_platform_generated in platform_generated.gyp
136 action("color_data") {
137   script = "../build/scripts/gperf.py"
139   color_data_gperf = "ColorData.gperf"
140   inputs = [ color_data_gperf ]
142   output_file = "$blink_platform_output_dir/ColorData.cpp"
143   outputs = [ output_file ]
145   args = [
146     gperf_exe,
147     "--key-positions=*",
148     "-D", "-s", "2",
149     rebase_path(color_data_gperf, root_build_dir),
150     "--output-file=" + rebase_path(output_file, root_build_dir),
151   ]
154 # This isn't strictly necessary since we can just add the deps to "platform",
155 # but it helps to have the targets match the GYP build.
156 group("make_platform_generated") {
157   visibility = []  # Allow re-assignment of list.
158   visibility = [ "//third_party/WebKit/Source/*" ]
159   public_deps = [
160     ":blink_common",
161     ":color_data",
162     ":font_family_names",
163     ":runtime_enabled_features",
164   ]
167 # TODO(brettw) Objective C Renaming postbuild steps on Mac.
168 # blink_platform target in blink_platform.gyp
169 component("platform") {
170   visibility = []  # Allow re-assignment of list.
171   visibility = [ "//third_party/WebKit/*" ]
172   output_name = "blink_platform"
174   sources = platform_files
175   sources -= blink_platform_neon_files
176   sources -= blink_platform_sse_files
178   # Add in the generated files.
179   sources +=
180     get_target_outputs(":font_family_names") +
181     get_target_outputs(":runtime_enabled_features") +
182     get_target_outputs(":color_data")
184   configs += [
185     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
186     "//build/config/compiler:no_size_t_to_int_warning",
187     "//third_party/WebKit/Source:config",
188     "//third_party/WebKit/Source:non_test_config",
189   ]
191   defines = [
192     "BLINK_PLATFORM_IMPLEMENTATION=1",
193     "INSIDE_BLINK",
194   ]
196   include_dirs = [
197     #"$angle_path/include",
198     "$root_gen_dir/blink",
199   ]
201   public_deps = [
202     "//gpu/command_buffer/client:gles2_c_lib",
203     "//skia",
204     "//third_party:jpeg",
205     "//third_party/iccjpeg",
206     "//third_party/libpng",
207     "//third_party/libwebp",
208     "//third_party/ots",
209     "//third_party/qcms",
210     "//url",
211     "//v8",
212   ]
213   deps = [
214     ":make_platform_generated",
215     "//third_party/harfbuzz-ng",
216     "//third_party/icu",
217     "//third_party/WebKit/Source/wtf",
218     "//third_party/WebKit/Source/platform/heap",
219   ]
221   if (is_mac) {
222     sources -= [
223       "fonts/skia/FontCacheSkia.cpp",
224       # Uses LocaleMac instead.
225       "text/LocaleICU.cpp",
226       "text/LocaleICU.h",
227       # Uses KillRingMac.mm instead.
228       "KillRingNone.cpp",
229       # Mac uses only ScrollAnimatorMac.
230       "scroll/ScrollbarThemeNonMacCommon.cpp",
231       "scroll/ScrollbarThemeNonMacCommon.h",
232       "scroll/ScrollAnimatorNone.cpp",
233       "scroll/ScrollAnimatorNone.h",
234     ]
236     # Some Mac-specific parts of WebKit won't compile without having this
237     # prefix header injected.
238     cflags = [
239       "-include",
240       rebase_path("../build/mac/Prefix.h", root_build_dir),
241     ]
243     defines += [ "WebFontCache=ChromiumWebCoreObjCWebFontCache" ]
244     configs += [ ":mac_objc_renaming" ]
245     libs = [
246       "Accelerate.framework",
247       "Carbon.framework",
248       "Foundation.framework",
249     ]
250   } else {
251     sources -= [
252       "geometry/cg/FloatPointCG.cpp",
253       "geometry/cg/FloatRectCG.cpp",
254       "geometry/cg/FloatSizeCG.cpp",
255       "geometry/cg/IntPointCG.cpp",
256       "geometry/cg/IntRectCG.cpp",
257       "geometry/cg/IntSizeCG.cpp",
258     ]
259   }
261   if (is_win) {
262     sources -= [
263       "clipboard/ClipboardUtilitiesPosix.cpp",
264       # Uses LocaleWin instead.
265       "text/LocaleICU.cpp",
266       "text/LocaleICU.h",
267     ]
268     cflags = [
269       "/wd4334",  # Result of 32-bit shift implicitly converted to 64 bits.
270       "/wd4724",  # Modulo by 0.
271     ]
272   } else {
273     sources -= [
274       "clipboard/ClipboardUtilitiesWin.cpp",
275       "text/LocaleWin.cpp",
276     ]
277   }
279   if (is_android) {
280     # Add in some Linux files also shared with Android.
281     set_sources_assignment_filter([])
282     sources += [
283       "exported/linux/WebFontRenderStyle.cpp",
284       "fonts/linux/FontPlatformDataLinux.cpp",
285     ]
286     set_sources_assignment_filter(sources_assignment_filter)
287   } else {
288     sources -= [
289       "scroll/ScrollbarThemeAndroid.cpp",
290     ]
291   }
293   if (is_linux) {
294     public_configs = [ "//build/config/linux:fontconfig" ]
295   }
297   if (!use_default_render_theme) {
298     sources -= [
299       "scroll/ScrollbarThemeAura.cpp",
300       "scroll/ScrollbarThemeAura.h",
301     ]
302   }
304   if (current_cpu == "arm") {
305     deps += [ ":blink_arm_neon" ]
306   }
308   if (current_cpu == "x86" || current_cpu == "x64") {
309     deps += [ ":blink_x86_sse" ]
310   }
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     deps += [ "//third_party/openmax_dl/dl" ]
319   }
322 source_set("test_support") {
323   sources = platform_test_support_files
324   visibility += [ "//third_party/WebKit/*" ]
326   configs += [
327     "//third_party/WebKit/Source:config",
328     "//third_party/WebKit/Source:inside_blink",
329     "//third_party/WebKit/Source:non_test_config",
330   ]
332   deps = [
333     ":platform",
334   ]
337 if (!is_mac) {
338   # TODO(GYP): Can't link Blink binaries yet.
339   test("heap_unittests") {
340     visibility = []  # Allow re-assignment of list.
341     visibility = [ "*" ]
342     output_name = "blink_heap_unittests"
344     sources = rebase_path(heap_gypi.platform_heap_test_files, ".", "heap")
345     sources += [ "heap/RunAllTests.cpp" ]
347     configs += [
348       "//third_party/WebKit/Source/wtf:wtf_config",
349       "//third_party/WebKit/Source:config",
350     ]
352     defines = [
353       "INSIDE_BLINK",
354     ]
356     deps = [
357       ":platform",
358       "//base",
359       "//base/allocator",
360       "//base/test:test_support",
361       "//testing/gmock",
362       "//testing/gtest",
363       "//third_party/WebKit/Source/wtf",
364       "//third_party/WebKit/Source/wtf:test_support",
365       "//content/test:test_support",
366     ]
367   }
369   test("platform_unittests") {
370     visibility = []  # Allow re-assignment of list.
371     visibility = [ "*" ]
372     output_name = "blink_platform_unittests"
374     sources = platform_test_files
376     sources += [ "testing/RunAllTests.cpp" ]
378     configs += [
379       "//third_party/WebKit/Source/wtf:wtf_config",
380       "//third_party/WebKit/Source:config",
381     ]
383     deps = [
384       ":blink_common",
385       ":platform",
386       ":test_support",
387       "//base",
388       "//base/allocator",
389       "//base/test:test_support",
390       "//skia",
391       "//testing/gmock",
392       "//testing/gtest",
393       "//third_party/harfbuzz-ng",
394       "//third_party/WebKit/Source/wtf",
395       "//third_party/WebKit/Source/wtf:test_support",
396       "//url",
397     ]
399     defines = [
400       "INSIDE_BLINK",
401     ]
403     include_dirs = [
404       "$root_gen_dir/blink",
405     ]
406   }
410 if (current_cpu == "arm") {
411   source_set("blink_arm_neon") {
412     sources = blink_platform_neon_files
414     # The *NEON.cpp files fail to compile when -mthumb is passed. Force
415     # them to build in ARM mode.
416     # See https://bugs.webkit.org/show_bug.cgi?id=62916.
417     # TODO(GYP)
418     #'cflags': ['-marm'],
419     #    'conditions': [
420     #      ['OS=="android"', {
421     #        'cflags!': ['-mthumb'],
422     #      }],
423     #    ],
425     deps = [ ":blink_common" ]
426   }
430 if (current_cpu == "x86" || current_cpu == "x64") {
431   source_set("blink_x86_sse") {
432     sources = blink_platform_sse_files
433     deps = [ ":blink_common" ]
434   }