Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: skia/BUILD.gn

Issue 214883005: Add Skia to the GN build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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/features.gni")
6 if (cpu_arch == "arm") {
7 import("//build/config/arm.gni")
8 }
9
10 skia_support_gpu = !is_ios
11 skia_support_pdf = !is_ios && enable_printing != 0
12
13 # The list of Skia files is kept in skia_gn_files.gypi. Read it.
14 gypi_values = exec_script("//build/gypi_to_gn.py",
15 [ rebase_path("skia_gn_files.gypi") ],
16 "scope",
17 [ "skia_gn_files.gypi" ])
18
19 # This files in the skia gypi file are relative to this directory.
20 skia_dir = "//third_party/skia"
21
22 # Same as skia_dir but relative to the current directory. This is what all
23 # files will be prefixed to once we rebase them to be relative to our file. If
24 # you need to filter out a file, prefix it with $skia_rel_dir.
25 skia_rel_dir = rebase_path(".", ".", skia_dir)
26
27 # External-facing config for dependent code.
28 config("skia_config") {
29 include_dirs = [
30 "config",
31 "ext",
32 "//third_party/skia/include/config",
33 "//third_party/skia/include/core",
34 "//third_party/skia/include/effects",
35 "//third_party/skia/include/images",
36 "//third_party/skia/include/lazy",
37 "//third_party/skia/include/pathops",
38 "//third_party/skia/include/pdf",
39 "//third_party/skia/include/pipe",
40 "//third_party/skia/include/ports",
41 "//third_party/skia/include/utils",
42 "//third_party/skia/src/core",
43 "//third_party/skia/src/image",
44 "//third_party/skia/src/opts",
45 "//third_party/skia/src/ports",
46 "//third_party/skia/src/sfnt",
47 "//third_party/skia/src/utils",
48 "//third_party/skia/src/lazy",
49 ]
50
51 defines = gypi_values.skia_feature_defines
52
53 if (component_mode == "shared_library") {
54 defines += [ "SKIA_DLL" ]
55 }
56
57 if (skia_support_gpu) {
58 include_dirs += [
59 "//third_party/skia/include/gpu",
60 "//third_party/skia/src/gpu",
61 ]
62 defines += [ "SK_SUPPORT_GPU=1" ]
63 } else {
64 defines += [ "SK_SUPPORT_GPU=0" ]
65 }
66
67 # For POSIX platforms, prefer the Mutex implementation provided by Skia
68 # since it does not generate static initializers.
69 if (is_posix) {
70 defines += [ "SK_USE_POSIX_THREADS" ]
71 }
72
73 if (is_android) {
74 defines += [
75 "SK_BUILD_FOR_ANDROID",
76 "USE_CHROMIUM_SKIA",
77 ]
78 }
79 }
80
81 config("skia_dependent_config") {
82 }
83
84 # Internal-facing config for Skia library code.
85 config("skia_library_config") {
86 defines = [
87 #skia_export_defines ???) TODO
88
89 # skia uses static initializers to initialize the serialization logic
90 # of its "pictures" library. This is currently not used in chrome; if
91 # it ever gets used the processes that use it need to call
92 # SkGraphics::Init().
93 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0",
94
95 # Disable this check because it is too strict for some Chromium-specific
96 # subclasses of SkPixelRef. See bug: crbug.com/171776.
97 "SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK",
98
99 "IGNORE_ROT_AA_RECT_OPT",
100
101 # Forces Skia not to use typographic metrics with GDI.
102 "SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS",
103 ]
104
105 # Settings for text blitting, chosen to approximate the system browser.
106 if (is_linux) {
107 defines += [
108 "SK_GAMMA_EXPONENT=1.2",
109 "SK_GAMMA_CONTRAST=0.2",
110 ]
111 } else if (is_android) {
112 defines += [
113 "SK_GAMMA_APPLY_TO_A8",
114 "SK_GAMMA_EXPONENT=1.4",
115 "SK_GAMMA_CONTRAST=0.0",
116 ]
117 } else if (is_win) {
118 defines += [
119 "SK_GAMMA_SRGB",
120 "SK_GAMMA_CONTRAST=0.5",
121 ]
122 } else if (is_mac) {
123 defines += [
124 "SK_GAMMA_SRGB",
125 "SK_GAMMA_CONTRAST=0.0",
126 ]
127 }
128
129 if (is_android) {
130 defines += [
131 # Android devices are typically more memory constrained, so default to a
132 # smaller glyph cache (it may be overriden at runtime when the renderer
133 # starts up, depending on the actual device memory).
134 "SK_DEFAULT_FONT_CACHE_LIMIT=1048576" # 1024 * 1024
135 ]
136 } else {
137 defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ] # 20 * 1024 * 1024
138 }
139
140 if (is_win) {
141 include_dirs = [
142 "//third_party/skia/include/utils/win",
143 "//third_party/skia/src/utils/win",
144 ]
145
146 defines += [ "SK_FONTHOST_USES_FONTMGR" ]
147
148 cflags = [
149 # TODO(brettw) comment what these are.
150 "/wd4244",
151 "/wd4267",
152 "/wd4341",
153 "/wd4345",
154 "/wd4390",
155 "/wd4554",
156 "/wd4748",
157 "/wd4800",
158 ]
159 }
160 }
161
162 component("skia") {
163 sources = [
164 # Chrome sources.
165 "ext/analysis_canvas.cc",
166 "ext/analysis_canvas.h",
167 "ext/benchmarking_canvas.cc",
168 "ext/benchmarking_canvas.h",
169 "ext/bitmap_platform_device.h",
170 "ext/bitmap_platform_device_cairo.cc",
171 "ext/bitmap_platform_device_cairo.h",
172 "ext/bitmap_platform_device_mac.cc",
173 "ext/bitmap_platform_device_mac.h",
174 #"ext/bitmap_platform_device_skia.cc",
175 #"ext/bitmap_platform_device_skia.h",
176 "ext/bitmap_platform_device_win.cc",
177 "ext/bitmap_platform_device_win.h",
178 "ext/convolver.cc",
179 "ext/convolver.h",
180 "ext/event_tracer_impl.cc",
181 "ext/event_tracer_impl.h",
182 "ext/google_logging.cc",
183 "ext/image_operations.cc",
184 "ext/image_operations.h",
185 "ext/lazy_pixel_ref.cc",
186 "ext/lazy_pixel_ref.h",
187 "ext/SkThread_chrome.cc",
188 "ext/opacity_draw_filter.cc",
189 "ext/opacity_draw_filter.h",
190 "ext/paint_simplifier.cc",
191 "ext/paint_simplifier.h",
192 "ext/pixel_ref_utils.cc",
193 "ext/pixel_ref_utils.h",
194 "ext/platform_canvas.cc",
195 "ext/platform_canvas.h",
196 "ext/platform_device.cc",
197 "ext/platform_device.h",
198 "ext/platform_device_linux.cc",
199 "ext/platform_device_mac.cc",
200 "ext/platform_device_win.cc",
201 "ext/recursive_gaussian_convolution.cc",
202 "ext/recursive_gaussian_convolution.h",
203 "ext/refptr.h",
204 "ext/SkDiscardableMemory_chrome.h",
205 "ext/SkDiscardableMemory_chrome.cc",
206 "ext/SkMemory_new_handler.cpp",
207 "ext/skia_trace_shim.h",
208 "ext/skia_utils_base.cc",
209 "ext/skia_utils_base.h",
210 "ext/skia_utils_ios.mm",
211 "ext/skia_utils_ios.h",
212 "ext/skia_utils_mac.mm",
213 "ext/skia_utils_mac.h",
214 "ext/skia_utils_win.cc",
215 "ext/skia_utils_win.h",
216 "ext/vector_canvas.h",
217 "ext/vector_platform_device_emf_win.cc",
218 "ext/vector_platform_device_emf_win.h",
219 "ext/vector_platform_device_skia.cc",
220 "ext/vector_platform_device_skia.h",
221 ]
222
223 # The skia gypi values are relative to the skia_dir, so we need to rebase.
224 sources += rebase_path(gypi_values.skia_core_sources, ".", skia_dir)
225 sources += rebase_path(gypi_values.skia_effects_sources, ".", skia_dir)
226 sources += rebase_path(gypi_values.skia_pdf_sources, ".", skia_dir)
227 sources += rebase_path(gypi_values.skia_library_sources, ".", skia_dir)
228
229 # GPU
230 if (skia_support_gpu) {
231 sources += rebase_path(gypi_values.skia_gpu_sources, ".", skia_dir)
232 }
233
234 # Fixup Chrome sources.
235 if (is_posix) {
236 sources -= [ "ext/SkThread_chrome.cc" ]
237 }
238 if (is_ios) {
239 sources -= [ "ext/vector_platform_device_skia.cc" ]
240 }
241 if (is_win) {
242 sources -= [ "ext/SkThread_chrome.cc" ]
243 }
244 if (is_android && enable_printing == 0) {
245 sources -= [
246 "ext/skia_utils_base.cc",
247 "ext/vector_platform_device_skia.cc"
248 ]
249 }
250
251 # Fixup skia library sources.
252 if (is_win) {
253 sources -= [
254 "$skia_rel_dir/src/ports/SkOSFile_posix.cpp",
255 "$skia_rel_dir/src/ports/SkTime_Unix.cpp",
256 "$skia_rel_dir/src/ports/SkTLS_pthread.cpp",
257 "$skia_rel_dir/src/ports/SkFontConfigInterface_direct.cpp",
258 "$skia_rel_dir/src/fonts/SkFontMgr_fontconfig.cpp",
259 ]
260 } else {
261 sources -= [
262 "$skia_rel_dir/src/ports/SkFontHost_win.cpp",
263 "$skia_rel_dir/src/ports/SkFontHost_win_dw.cpp",
264 "$skia_rel_dir/src/ports/SkFontMgr_default_gdi.cpp",
265 "$skia_rel_dir/src/ports/SkOSFile_win.cpp",
266 "$skia_rel_dir/src/ports/SkThread_win.cpp",
267 "$skia_rel_dir/src/ports/SkTLS_win.cpp",
268 "$skia_rel_dir/src/utils/SkThreadUtils_win.cpp",
269 ]
270 }
271 if (!is_android) {
272 sources -= [
273 "$skia_rel_dir/src/ports/SkFontConfigInterface_android.cpp",
274 "$skia_rel_dir/src/ports/SkFontConfigParser_android.cpp",
275 ]
276 }
277 if (!is_mac) {
278 sources -= [
279 "$skia_rel_dir/src/ports/SkFontHost_mac.cpp",
280 "$skia_rel_dir/src/utils/SkThreadUtils_pthread_mach.cpp",
281 ]
282 }
283 if (!is_linux) {
284 sources -= [
285 "$skia_rel_dir/src/ports/SkFontHost_FreeType.cpp",
286 "$skia_rel_dir/src/ports/SkFontHost_FreeType_common.cpp",
287 "$skia_rel_dir/src/ports/SkFontHost_fontconfig.cpp",
288 "$skia_rel_dir/src/ports/SkFontHost_linux.cpp",
289 ]
290 } else if (!is_android) {
291 sources -= [
292 "$skia_rel_dir/src/ports/SkFontConfigInterface_direct.cpp",
293 "$skia_rel_dir/src/fonts/SkFontMgr_fontconfig.cpp",
294 ]
295 }
296
297 configs -= [ "//build/config/compiler:chromium_code" ]
298 configs += [
299 ":skia_library_config",
300 "//build/config/compiler:no_chromium_code"
301 ]
302 direct_dependent_configs = [ ":skia_config" ]
303
304 deps = [
305 ":skia_opts",
306 "//base",
307 "//base/third_party/dynamic_annotations",
308 "//third_party/zlib",
309 ]
310
311 if (component_mode == "shared_library") {
312 defines = [ "SKIA_IMPLEMENTATION=1" ]
313 }
314
315 if (is_linux) {
316 configs += [
317 "//build/config/linux:fontconfig",
318 "//build/config/linux:freetype2",
319 "//build/config/linux:pangocairo",
320 ]
321 deps += [
322 "//third_party/icu:icuuc",
323 ]
324 }
325
326 if (skia_support_pdf) {
327 deps += [ "//third_party/sfntly" ]
328 }
329 }
330
331 # Separated out so it can be compiled with different flags for SSE.
332 source_set("skia_opts") {
333 if (cpu_arch == "x86" || cpu_arch == "x64") {
334 sources = [
335 # SSE 2
336 "//third_party/skia/src/opts/opts_check_SSE2.cpp",
337 "//third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp",
338 "//third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp",
339 "//third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp",
340 "//third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp",
341 "//third_party/skia/src/opts/SkBlurImage_opts_SSE2.cpp",
342 "//third_party/skia/src/opts/SkMorphology_opts_SSE2.cpp",
343 "//third_party/skia/src/opts/SkUtils_opts_SSE2.cpp",
344 "//third_party/skia/src/opts/SkXfermode_opts_none.cpp",
345
346 # SSE 3
347 "//third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp",
348
349 # Chrome-specific.
350 "ext/convolver_SSE2.cc",
351 ]
352
353 if (is_linux || is_mac) {
354 cflags = [ "-mssse3" ] # Note third 's'.
355 }
356 } else {
357 assert(false, "Need to port ARM/MIPS stuff from skia_library_opts.gyp")
358 }
359
360 configs -= [ "//build/config/compiler:chromium_code" ]
361 configs += [
362 ":skia_config",
363 "//build/config/compiler:no_chromium_code"
364 ]
365
366 # TODO(brettw) uncomment when visibility is supported.
367 #visibility = ":skia"
368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698