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

Side by Side Diff: skia/BUILD.gn

Issue 2316653003: Use new Skia .gni file for sources, remove .gypis. (Closed)
Patch Set: More path Created 4 years, 3 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
« no previous file with comments | « DEPS ('k') | skia/skia.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/features.gni") 5 import("//build/config/features.gni")
6 import("//build/config/ui.gni") 6 import("//build/config/ui.gni")
7 import("//testing/test.gni") 7 import("//testing/test.gni")
8 import("//third_party/skia/gn/shared_sources.gni")
8 9
9 if (current_cpu == "arm") { 10 if (current_cpu == "arm") {
10 import("//build/config/arm.gni") 11 import("//build/config/arm.gni")
11 } 12 }
12 if (current_cpu == "mipsel" || current_cpu == "mips64el") { 13 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
13 import("//build/config/mips.gni") 14 import("//build/config/mips.gni")
14 } 15 }
15 16
16 skia_support_gpu = !is_ios 17 skia_support_gpu = !is_ios
17 skia_support_pdf = false #!is_ios && (enable_basic_printing || enable_print_pre view) 18 skia_support_pdf = false #!is_ios && (enable_basic_printing || enable_print_pre view)
18 19
19 # The list of Skia core sources that are to be set for chromium.
20 gypi_skia_core =
21 exec_script("//build/gypi_to_gn.py",
22 [
23 rebase_path("//third_party/skia/gyp/core.gypi"),
24 "--replace=<(skia_include_path)=//third_party/skia/include",
25 "--replace=<(skia_src_path)=//third_party/skia/src",
26 ],
27 "scope",
28 [ "//third_party/skia/gyp/core.gypi" ])
29
30 # The list of Skia gpu sources that are to be set for chromium.
31 if (skia_support_gpu) {
32 gypi_skia_gpu =
33 exec_script("//build/gypi_to_gn.py",
34 [
35 rebase_path("//third_party/skia/gyp/gpu.gypi"),
36 "--replace=<(skia_include_path)=//third_party/skia/include",
37 "--replace=<(skia_src_path)=//third_party/skia/src",
38 ],
39 "scope",
40 [ "//third_party/skia/gyp/gpu.gypi" ])
41 }
42
43 # The list of Skia pdf sources that are to be set for chromium.
44 if (skia_support_pdf) {
45 gypi_skia_pdf =
46 exec_script("//build/gypi_to_gn.py",
47 [
48 rebase_path("//third_party/skia/gyp/pdf.gypi"),
49 "--replace=<(skia_include_path)=//third_party/skia/include",
50 "--replace=<(skia_src_path)=//third_party/skia/src",
51 ],
52 "scope",
53 [ "//third_party/skia/gyp/pdf.gypi" ])
54 }
55
56 # The list of Skia effects that are to be set for chromium.
57 gypi_skia_effects =
58 exec_script("//build/gypi_to_gn.py",
59 [
60 rebase_path("//third_party/skia/gyp/effects.gypi"),
61 "--replace=<(skia_include_path)=//third_party/skia/include",
62 "--replace=<(skia_src_path)=//third_party/skia/src",
63 ],
64 "scope",
65 [ "//third_party/skia/gyp/effects.gypi" ])
66
67 # The list of Skia utils that are to be set for chromium.
68 gypi_skia_utils =
69 exec_script("//build/gypi_to_gn.py",
70 [
71 rebase_path("//third_party/skia/gyp/utils.gypi"),
72 "--replace=<(skia_include_path)=//third_party/skia/include",
73 "--replace=<(skia_src_path)=//third_party/skia/src",
74 ],
75 "scope",
76 [ "//third_party/skia/gyp/utils.gypi" ])
77
78 gypi_skia_opts =
79 exec_script("//build/gypi_to_gn.py",
80 [
81 rebase_path("//third_party/skia/gyp/opts.gypi"),
82 "--replace=<(skia_include_path)=//third_party/skia/include",
83 "--replace=<(skia_src_path)=//third_party/skia/src",
84 ],
85 "scope",
86 [ "//third_party/skia/gyp/opts.gypi" ])
87
88 # The list of Skia files is kept in skia_gn_files.gypi. Read it.
89 gypi_values =
90 exec_script("//build/gypi_to_gn.py",
91 [
92 rebase_path("skia_gn_files.gypi"),
93 "--replace=<(skia_include_path)=//third_party/skia/include",
94 "--replace=<(skia_src_path)=//third_party/skia/src",
95 ],
96 "scope",
97 [ "skia_gn_files.gypi" ])
98
99 # External-facing config for dependent code. 20 # External-facing config for dependent code.
100 config("skia_config") { 21 config("skia_config") {
101 include_dirs = [ 22 include_dirs = [
102 "config", 23 "config",
103 "ext", 24 "ext",
104 "//third_party/skia/include/c", 25 "//third_party/skia/include/c",
105 "//third_party/skia/include/config", 26 "//third_party/skia/include/config",
106 "//third_party/skia/include/core", 27 "//third_party/skia/include/core",
107 "//third_party/skia/include/effects", 28 "//third_party/skia/include/effects",
108 "//third_party/skia/include/images", 29 "//third_party/skia/include/images",
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 164 }
244 165
245 component("skia") { 166 component("skia") {
246 sources = [ 167 sources = [
247 # PDFium sources. 168 # PDFium sources.
248 "config/SkUserConfig.h", 169 "config/SkUserConfig.h",
249 "ext/google_logging.cc", 170 "ext/google_logging.cc",
250 ] 171 ]
251 172
252 # The skia gypi values are relative to the skia_dir, so we need to rebase. 173 # The skia gypi values are relative to the skia_dir, so we need to rebase.
253 sources += gypi_skia_core.sources 174 sources += skia_core_sources
254 sources += gypi_skia_effects.sources 175 sources += skia_effects_sources
255 sources += gypi_skia_utils.sources 176 sources += skia_utils_sources
256 sources += gypi_values.skia_library_sources 177 sources += [
178 "//third_party/skia/src/ports/SkImageGenerator_none.cpp",
179
180 "//third_party/skia/src/fonts/SkFontMgr_indirect.cpp",
181 "//third_party/skia/src/fonts/SkRemotableFontMgr.cpp",
182 "//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
183 "//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
184 "//third_party/skia/src/ports/SkFontHost_win.cpp",
185 "//third_party/skia/src/ports/SkFontMgr_android.cpp",
186 "//third_party/skia/src/ports/SkFontMgr_android_factory.cpp",
187 "//third_party/skia/src/ports/SkFontMgr_android_parser.cpp",
188 "//third_party/skia/src/ports/SkGlobalInitialization_default.cpp",
189 "//third_party/skia/src/ports/SkImageEncoder_none.cpp",
190 "//third_party/skia/src/ports/SkOSFile_posix.cpp",
191 "//third_party/skia/src/ports/SkOSFile_stdio.cpp",
192 "//third_party/skia/src/ports/SkOSFile_win.cpp",
193 "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
194 "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
195 "//third_party/skia/src/ports/SkTLS_pthread.cpp",
196 "//third_party/skia/src/ports/SkTLS_win.cpp",
197 "//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
198 "//third_party/skia/src/sfnt/SkOTTable_name.cpp",
199 "//third_party/skia/src/sfnt/SkOTUtils.cpp",
200
201 #mac
202 "//third_party/skia/src/utils/mac/SkStream_mac.cpp",
203
204 #pdfium
205 "//third_party/skia/src/ports/SkDiscardableMemory_none.cpp",
206 "//third_party/skia/src/ports/SkFontMgr_custom.cpp",
207 "//third_party/skia/src/ports/SkFontMgr_custom_empty_factory.cpp",
208 "//third_party/skia/src/ports/SkMemory_malloc.cpp",
209 ]
257 210
258 # This and skia_opts are really the same conceptual target so share headers. 211 # This and skia_opts are really the same conceptual target so share headers.
259 allow_circular_includes_from = [ ":skia_opts" ] 212 allow_circular_includes_from = [ ":skia_opts" ]
260 213
261 if (current_cpu == "arm") { 214 if (current_cpu == "arm") {
262 sources += [ "//third_party/skia/src/core/SkUtilsArm.cpp" ] 215 sources += [ "//third_party/skia/src/core/SkUtilsArm.cpp" ]
263 } 216 }
264 217
265 # GPU 218 # GPU
266 if (skia_support_gpu) { 219 if (skia_support_gpu) {
267 sources += gypi_skia_gpu.skgpu_sources 220 sources += skia_gpu_sources
268 sources += gypi_skia_gpu.skgpu_null_gl_sources 221 sources += skia_null_gpu_sources
269 } 222 }
270 223
271 # Remove unused util files include in utils.gypi 224 # Remove unused util files include in utils.gypi
272 sources -= [ 225 sources -= [
273 "//third_party/skia/src/utils/SkBoundaryPatch.cpp", 226 "//third_party/skia/src/utils/SkBoundaryPatch.cpp",
274 "//third_party/skia/src/utils/SkCamera.cpp", 227 "//third_party/skia/src/utils/SkCamera.cpp",
275 "//third_party/skia/src/utils/SkDumpCanvas.cpp", 228 "//third_party/skia/src/utils/SkDumpCanvas.cpp",
276 "//third_party/skia/src/utils/SkFrontBufferedStream.cpp", 229 "//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
277 "//third_party/skia/src/utils/SkInterpolator.cpp", 230 "//third_party/skia/src/utils/SkInterpolator.cpp",
278 "//third_party/skia/src/utils/SkLayer.cpp", 231 "//third_party/skia/src/utils/SkLayer.cpp",
279 "//third_party/skia/src/utils/SkMeshUtils.cpp", 232 "//third_party/skia/src/utils/SkMeshUtils.cpp",
280 "//third_party/skia/src/utils/SkParsePath.cpp", 233 "//third_party/skia/src/utils/SkParsePath.cpp",
281
282 #testing
283 "//third_party/skia/src/fonts/SkGScalerContext.cpp",
284 ] 234 ]
285 235
286 if (is_win) { 236 if (is_win) {
287 sources -= [ 237 sources -= [
288 # Keeping _win.cpp 238 # Keeping _win.cpp
289 "//third_party/skia/src/utils/SkThreadUtils_pthread.cpp", 239 "//third_party/skia/src/utils/SkThreadUtils_pthread.cpp",
290 ] 240 ]
291 } else { 241 } else {
292 sources -= [ 242 sources -= [
293 # Keeping _pthread.cpp 243 # Keeping _pthread.cpp
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 set_sources_assignment_filter(sources_assignment_filter) 317 set_sources_assignment_filter(sources_assignment_filter)
368 deps += [ 318 deps += [
369 "//third_party/android_tools:cpu_features", 319 "//third_party/android_tools:cpu_features",
370 "//third_party/expat", 320 "//third_party/expat",
371 "//third_party/freetype-android:freetype", 321 "//third_party/freetype-android:freetype",
372 ] 322 ]
373 } 323 }
374 324
375 if (skia_support_pdf) { 325 if (skia_support_pdf) {
376 deps += [ "//third_party/sfntly" ] 326 deps += [ "//third_party/sfntly" ]
377 sources += gypi_skia_pdf.sources 327 sources += skia_pdf_sources
378 } else { 328 } else {
379 sources += [ "//third_party/skia/src/pdf/SkDocument_PDF_None.cpp" ] 329 sources += [ "//third_party/skia/src/pdf/SkDocument_PDF_None.cpp" ]
380 } 330 }
381 331
382 if (is_android && !is_debug) { 332 if (is_android && !is_debug) {
383 configs -= [ "//build/config/compiler:default_optimization" ] 333 configs -= [ "//build/config/compiler:default_optimization" ]
384 configs += [ "//build/config/compiler:optimize_max" ] 334 configs += [ "//build/config/compiler:optimize_max" ]
385 } 335 }
386 336
387 if (is_ios) { 337 if (is_ios) {
388 libs = [ "ImageIO.framework" ] 338 libs = [ "ImageIO.framework" ]
389 set_sources_assignment_filter([]) 339 set_sources_assignment_filter([])
390 sources += [ 340 sources += [
391 "//third_party/skia/src/ports/SkFontHost_mac.cpp", 341 "//third_party/skia/src/ports/SkFontHost_mac.cpp",
392 "//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp", 342 "//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp",
393 "//third_party/skia/src/utils/mac/SkStream_mac.cpp", 343 "//third_party/skia/src/utils/mac/SkStream_mac.cpp",
394 ] 344 ]
395 set_sources_assignment_filter(sources_assignment_filter) 345 set_sources_assignment_filter(sources_assignment_filter)
396 346
397 # To disable warning "CGContextSelectFont' is deprecated" 347 # To disable warning "CGContextSelectFont' is deprecated"
398 cflags = [ "-Wno-deprecated-declarations" ] 348 cflags = [ "-Wno-deprecated-declarations" ]
399 } 349 }
400 } 350 }
401 351
402 # Separated out so it can be compiled with different flags for SSE. 352 # Separated out so it can be compiled with different flags for SSE.
403 if (current_cpu == "x86" || current_cpu == "x64") { 353 if (current_cpu == "x86" || current_cpu == "x64") {
404 source_set("skia_opts_sse3") { 354 source_set("skia_opts_sse3") {
405 sources = gypi_skia_opts.ssse3_sources 355 sources = skia_opts.ssse3_sources
406 if (!is_win || is_clang) { 356 if (!is_win || is_clang) {
407 cflags = [ "-mssse3" ] 357 cflags = [ "-mssse3" ]
408 } 358 }
409 if (is_win) { 359 if (is_win) {
410 defines = [ "SK_CPU_SSE_LEVEL=31" ] 360 defines = [ "SK_CPU_SSE_LEVEL=31" ]
411 } 361 }
412 visibility = [ ":skia_opts" ] 362 visibility = [ ":skia_opts" ]
413 configs -= [ "//build/config/compiler:chromium_code" ] 363 configs -= [ "//build/config/compiler:chromium_code" ]
414 configs += [ 364 configs += [
415 ":skia_config", 365 ":skia_config",
416 ":skia_library_config", 366 ":skia_library_config",
417 "//build/config/compiler:no_chromium_code", 367 "//build/config/compiler:no_chromium_code",
418 ] 368 ]
419 } 369 }
420 source_set("skia_opts_sse41") { 370 source_set("skia_opts_sse41") {
421 sources = gypi_skia_opts.sse41_sources 371 sources = skia_opts.sse41_sources
422 if (!is_win || is_clang) { 372 if (!is_win || is_clang) {
423 cflags = [ "-msse4.1" ] 373 cflags = [ "-msse4.1" ]
424 } 374 }
425 if (is_win) { 375 if (is_win) {
426 defines = [ "SK_CPU_SSE_LEVEL=41" ] 376 defines = [ "SK_CPU_SSE_LEVEL=41" ]
427 } 377 }
428 visibility = [ ":skia_opts" ] 378 visibility = [ ":skia_opts" ]
429 configs -= [ "//build/config/compiler:chromium_code" ] 379 configs -= [ "//build/config/compiler:chromium_code" ]
430 configs += [ 380 configs += [
431 ":skia_config", 381 ":skia_config",
432 ":skia_library_config", 382 ":skia_library_config",
433 "//build/config/compiler:no_chromium_code", 383 "//build/config/compiler:no_chromium_code",
434 ] 384 ]
435 } 385 }
436 source_set("skia_opts_sse42") { 386 source_set("skia_opts_sse42") {
437 sources = gypi_skia_opts.sse42_sources 387 sources = skia_opts.sse42_sources
438 if (!is_win || is_clang) { 388 if (!is_win || is_clang) {
439 cflags = [ "-msse4.2" ] 389 cflags = [ "-msse4.2" ]
440 } 390 }
441 if (is_win) { 391 if (is_win) {
442 defines = [ "SK_CPU_SSE_LEVEL=42" ] 392 defines = [ "SK_CPU_SSE_LEVEL=42" ]
443 } 393 }
444 visibility = [ ":skia_opts" ] 394 visibility = [ ":skia_opts" ]
445 configs -= [ "//build/config/compiler:chromium_code" ] 395 configs -= [ "//build/config/compiler:chromium_code" ]
446 configs += [ 396 configs += [
447 ":skia_config", 397 ":skia_config",
448 ":skia_library_config", 398 ":skia_library_config",
449 "//build/config/compiler:no_chromium_code", 399 "//build/config/compiler:no_chromium_code",
450 ] 400 ]
451 } 401 }
452 source_set("skia_opts_avx") { 402 source_set("skia_opts_avx") {
453 sources = gypi_skia_opts.avx_sources 403 sources = skia_opts.avx_sources
454 if (!is_win) { 404 if (!is_win) {
455 cflags = [ "-mavx" ] 405 cflags = [ "-mavx" ]
456 } 406 }
457 if (is_win) { 407 if (is_win) {
458 cflags = [ "/arch:AVX" ] 408 cflags = [ "/arch:AVX" ]
459 } 409 }
460 visibility = [ ":skia_opts" ] 410 visibility = [ ":skia_opts" ]
461 configs -= [ "//build/config/compiler:chromium_code" ] 411 configs -= [ "//build/config/compiler:chromium_code" ]
462 configs += [ 412 configs += [
463 ":skia_config", 413 ":skia_config",
464 ":skia_library_config", 414 ":skia_library_config",
465 "//build/config/compiler:no_chromium_code", 415 "//build/config/compiler:no_chromium_code",
466 ] 416 ]
467 } 417 }
468 source_set("skia_opts_avx2") { 418 source_set("skia_opts_avx2") {
469 sources = gypi_skia_opts.avx2_sources 419 sources = skia_opts.avx2_sources
470 if (!is_win) { 420 if (!is_win) {
471 cflags = [ "-mavx2" ] 421 cflags = [ "-mavx2" ]
472 } 422 }
473 if (is_win) { 423 if (is_win) {
474 cflags = [ "/arch:AVX2" ] 424 cflags = [ "/arch:AVX2" ]
475 } 425 }
476 visibility = [ ":skia_opts" ] 426 visibility = [ ":skia_opts" ]
477 configs -= [ "//build/config/compiler:chromium_code" ] 427 configs -= [ "//build/config/compiler:chromium_code" ]
478 configs += [ 428 configs += [
479 ":skia_config", 429 ":skia_config",
480 ":skia_library_config", 430 ":skia_library_config",
481 "//build/config/compiler:no_chromium_code", 431 "//build/config/compiler:no_chromium_code",
482 ] 432 ]
483 } 433 }
484 } 434 }
485 source_set("skia_opts") { 435 source_set("skia_opts") {
486 cflags = [] 436 cflags = []
487 defines = [] 437 defines = []
488 438
489 if (current_cpu == "x86" || current_cpu == "x64") { 439 if (current_cpu == "x86" || current_cpu == "x64") {
490 sources = gypi_skia_opts.sse2_sources 440 sources = skia_opts.sse2_sources
491 deps = [ 441 deps = [
492 ":skia_opts_avx", 442 ":skia_opts_avx",
493 ":skia_opts_avx2", 443 ":skia_opts_avx2",
494 ":skia_opts_sse3", 444 ":skia_opts_sse3",
495 ":skia_opts_sse41", 445 ":skia_opts_sse41",
496 ":skia_opts_sse42", 446 ":skia_opts_sse42",
497 ] 447 ]
498 } else if (current_cpu == "arm") { 448 } else if (current_cpu == "arm") {
499 # The assembly uses the frame pointer register (r7 in Thumb/r11 in 449 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
500 # ARM), the compiler doesn't like that. 450 # ARM), the compiler doesn't like that.
501 cflags += [ "-fomit-frame-pointer" ] 451 cflags += [ "-fomit-frame-pointer" ]
502 452
503 if (arm_version >= 7) { 453 if (arm_version >= 7) {
504 sources = gypi_skia_opts.armv7_sources 454 sources = skia_opts.armv7_sources
505 if (arm_use_neon || arm_optionally_use_neon) { 455 if (arm_use_neon || arm_optionally_use_neon) {
506 sources += gypi_skia_opts.neon_sources 456 sources += skia_opts.neon_sources
507 457
508 # Root build config sets -mfpu=$arm_fpu, which we expect to be neon 458 # Root build config sets -mfpu=$arm_fpu, which we expect to be neon
509 # when running this. 459 # when running this.
510 if (!arm_use_neon) { 460 if (!arm_use_neon) {
511 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] 461 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
512 cflags += [ "-mfpu=neon" ] 462 cflags += [ "-mfpu=neon" ]
513 } 463 }
514 } 464 }
515 } else { 465 } else {
516 sources = gypi_skia_opts.none_sources 466 sources = skia_opts.none_sources
517 } 467 }
518 } else if (current_cpu == "arm64") { 468 } else if (current_cpu == "arm64") {
519 sources = gypi_skia_opts.arm64_sources 469 sources = skia_opts.arm64_sources
520 } else if (current_cpu == "mipsel") { 470 } else if (current_cpu == "mipsel") {
521 cflags += [ "-fomit-frame-pointer" ] 471 cflags += [ "-fomit-frame-pointer" ]
522 472
523 if (mips_dsp_rev >= 1) { 473 if (mips_dsp_rev >= 1) {
524 sources = gypi_skia_opts.mips_dsp_sources 474 sources = skia_opts.mips_dsp_sources
525 } else { 475 } else {
526 sources = gypi_skia_opts.none_sources 476 sources = skia_opts.none_sources
527 } 477 }
528 } else if (current_cpu == "mips64el") { 478 } else if (current_cpu == "mips64el") {
529 cflags += [ "-fomit-frame-pointer" ] 479 cflags += [ "-fomit-frame-pointer" ]
530 sources = gypi_skia_opts.none_sources 480 sources = skia_opts.none_sources
531 } else { 481 } else {
532 assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp") 482 assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp")
533 } 483 }
534 484
535 if (is_android && !is_debug) { 485 if (is_android && !is_debug) {
536 configs -= [ "//build/config/compiler:default_optimization" ] 486 configs -= [ "//build/config/compiler:default_optimization" ]
537 configs += [ "//build/config/compiler:optimize_max" ] 487 configs += [ "//build/config/compiler:optimize_max" ]
538 } 488 }
539 489
540 configs -= [ "//build/config/compiler:chromium_code" ] 490 configs -= [ "//build/config/compiler:chromium_code" ]
541 configs += [ 491 configs += [
542 ":skia_config", 492 ":skia_config",
543 ":skia_library_config", 493 ":skia_library_config",
544 "//build/config/compiler:no_chromium_code", 494 "//build/config/compiler:no_chromium_code",
545 ] 495 ]
546 496
547 visibility = [ ":skia" ] 497 visibility = [ ":skia" ]
548 } 498 }
OLDNEW
« no previous file with comments | « DEPS ('k') | skia/skia.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698