OLD | NEW |
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 if (current_cpu == "arm") { | 8 if (current_cpu == "arm") { |
9 import("//build/config/arm.gni") | 9 import("//build/config/arm.gni") |
10 } | 10 } |
11 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 11 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
12 import("//build/config/mips.gni") | 12 import("//build/config/mips.gni") |
13 } | 13 } |
14 | 14 |
15 skia_support_gpu = !is_ios | 15 skia_support_gpu = !is_ios |
16 skia_support_pdf = !is_ios && (enable_basic_printing || enable_print_preview) | 16 skia_support_pdf = !is_ios && (enable_basic_printing || enable_print_preview) |
17 | 17 |
| 18 # When building Chrome for iOS with GYP, the target cpu is not known during |
| 19 # the invocation of gyp. This cause the iOS build to use non-optimised skia. |
| 20 # Replicate this with GN to avoid introducing regression as recommended by |
| 21 # the OWNERS of skia. |
| 22 |
| 23 declare_args() { |
| 24 # TODO(crbug.com/607933): Once GYP is no longer supported, port iOS to use |
| 25 # optimised skia. |
| 26 skia_build_no_opts = is_ios |
| 27 } |
| 28 |
18 # The list of Skia defines that are to be set for chromium. | 29 # The list of Skia defines that are to be set for chromium. |
19 gypi_chromium_skia_defines = | 30 gypi_chromium_skia_defines = |
20 exec_script("//build/gypi_to_gn.py", | 31 exec_script("//build/gypi_to_gn.py", |
21 [ | 32 [ |
22 rebase_path("//skia/chromium_skia_defines.gypi"), | 33 rebase_path("//skia/chromium_skia_defines.gypi"), |
23 "--replace=<(skia_include_path)=//third_party/skia/include", | 34 "--replace=<(skia_include_path)=//third_party/skia/include", |
24 "--replace=<(skia_src_path)=//third_party/skia/src", | 35 "--replace=<(skia_src_path)=//third_party/skia/src", |
25 ], | 36 ], |
26 "scope", | 37 "scope", |
27 [ "//skia/chromium_skia_defines.gypi" ]) | 38 [ "//skia/chromium_skia_defines.gypi" ]) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 "//third_party/skia/include/pipe", | 145 "//third_party/skia/include/pipe", |
135 "//third_party/skia/include/ports", | 146 "//third_party/skia/include/ports", |
136 "//third_party/skia/include/utils", | 147 "//third_party/skia/include/utils", |
137 ] | 148 ] |
138 | 149 |
139 defines = gypi_chromium_skia_defines.chromium_skia_defines | 150 defines = gypi_chromium_skia_defines.chromium_skia_defines |
140 defines += gypi_skia_defines.skia_for_chromium_defines | 151 defines += gypi_skia_defines.skia_for_chromium_defines |
141 | 152 |
142 defines += [] | 153 defines += [] |
143 | 154 |
| 155 if (skia_build_no_opts) { |
| 156 defines += [ "SK_BUILD_NO_OPTS" ] |
| 157 } |
| 158 |
144 if (is_component_build) { | 159 if (is_component_build) { |
145 defines += [ | 160 defines += [ |
146 "SKIA_DLL", | 161 "SKIA_DLL", |
147 "GR_GL_IGNORE_ES3_MSAA=0", | 162 "GR_GL_IGNORE_ES3_MSAA=0", |
148 ] | 163 ] |
149 } | 164 } |
150 | 165 |
151 if (skia_support_gpu) { | 166 if (skia_support_gpu) { |
152 include_dirs += [ | 167 include_dirs += [ |
153 "//third_party/skia/include/gpu", | 168 "//third_party/skia/include/gpu", |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 if (is_mac) { | 212 if (is_mac) { |
198 include_dirs += [ "//third_party/skia/include/utils/ios" ] | 213 include_dirs += [ "//third_party/skia/include/utils/ios" ] |
199 } | 214 } |
200 | 215 |
201 defines = [] | 216 defines = [] |
202 | 217 |
203 if (is_component_build) { | 218 if (is_component_build) { |
204 defines += [ "SKIA_IMPLEMENTATION=1" ] | 219 defines += [ "SKIA_IMPLEMENTATION=1" ] |
205 } | 220 } |
206 | 221 |
207 if (current_cpu == "arm") { | 222 if (current_cpu == "arm" && !skia_build_no_opts) { |
208 if (arm_use_neon) { | 223 if (arm_use_neon) { |
209 defines += [ "SK_ARM_HAS_NEON" ] | 224 defines += [ "SK_ARM_HAS_NEON" ] |
210 } else if (arm_optionally_use_neon) { | 225 } else if (arm_optionally_use_neon) { |
211 defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ] | 226 defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ] |
212 } | 227 } |
213 } | 228 } |
214 | 229 |
215 # Settings for text blitting, chosen to approximate the system browser. | 230 # Settings for text blitting, chosen to approximate the system browser. |
216 if (is_linux) { | 231 if (is_linux) { |
217 defines += [ | 232 defines += [ |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 "//third_party/skia/src/utils/mac/SkStream_mac.cpp", | 532 "//third_party/skia/src/utils/mac/SkStream_mac.cpp", |
518 ] | 533 ] |
519 set_sources_assignment_filter(sources_assignment_filter) | 534 set_sources_assignment_filter(sources_assignment_filter) |
520 | 535 |
521 # To disable warning "CGContextSelectFont' is deprecated" | 536 # To disable warning "CGContextSelectFont' is deprecated" |
522 cflags = [ "-Wno-deprecated-declarations" ] | 537 cflags = [ "-Wno-deprecated-declarations" ] |
523 } | 538 } |
524 } | 539 } |
525 | 540 |
526 # Separated out so it can be compiled with different flags for SSE. | 541 # Separated out so it can be compiled with different flags for SSE. |
527 if (current_cpu == "x86" || current_cpu == "x64") { | 542 if (!skia_build_no_opts) { |
528 source_set("skia_opts_sse3") { | 543 if (current_cpu == "x86" || current_cpu == "x64") { |
529 sources = gypi_skia_opts.ssse3_sources | 544 source_set("skia_opts_sse3") { |
530 if (!is_win || is_clang) { | 545 sources = gypi_skia_opts.ssse3_sources |
531 cflags = [ "-mssse3" ] | 546 if (!is_win || is_clang) { |
| 547 cflags = [ "-mssse3" ] |
| 548 } |
| 549 if (is_win) { |
| 550 defines = [ "SK_CPU_SSE_LEVEL=31" ] |
| 551 } |
| 552 visibility = [ ":skia_opts" ] |
| 553 configs -= [ "//build/config/compiler:chromium_code" ] |
| 554 configs += [ |
| 555 ":skia_config", |
| 556 ":skia_library_config", |
| 557 "//build/config/compiler:no_chromium_code", |
| 558 ] |
532 } | 559 } |
533 if (is_win) { | 560 source_set("skia_opts_sse41") { |
534 defines = [ "SK_CPU_SSE_LEVEL=31" ] | 561 sources = gypi_skia_opts.sse41_sources |
| 562 if (!is_win || is_clang) { |
| 563 cflags = [ "-msse4.1" ] |
| 564 } |
| 565 if (is_win) { |
| 566 defines = [ "SK_CPU_SSE_LEVEL=41" ] |
| 567 } |
| 568 visibility = [ ":skia_opts" ] |
| 569 configs -= [ "//build/config/compiler:chromium_code" ] |
| 570 configs += [ |
| 571 ":skia_config", |
| 572 ":skia_library_config", |
| 573 "//build/config/compiler:no_chromium_code", |
| 574 ] |
535 } | 575 } |
536 visibility = [ ":skia_opts" ] | 576 source_set("skia_opts_sse42") { |
537 configs -= [ "//build/config/compiler:chromium_code" ] | 577 sources = gypi_skia_opts.sse42_sources |
538 configs += [ | 578 if (!is_win || is_clang) { |
539 ":skia_config", | 579 cflags = [ "-msse4.2" ] |
540 ":skia_library_config", | 580 } |
541 "//build/config/compiler:no_chromium_code", | 581 if (is_win) { |
542 ] | 582 defines = [ "SK_CPU_SSE_LEVEL=42" ] |
543 } | 583 } |
544 source_set("skia_opts_sse41") { | 584 visibility = [ ":skia_opts" ] |
545 sources = gypi_skia_opts.sse41_sources | 585 configs -= [ "//build/config/compiler:chromium_code" ] |
546 if (!is_win || is_clang) { | 586 configs += [ |
547 cflags = [ "-msse4.1" ] | 587 ":skia_config", |
| 588 ":skia_library_config", |
| 589 "//build/config/compiler:no_chromium_code", |
| 590 ] |
548 } | 591 } |
549 if (is_win) { | 592 source_set("skia_opts_avx") { |
550 defines = [ "SK_CPU_SSE_LEVEL=41" ] | 593 sources = gypi_skia_opts.avx_sources |
| 594 if (!is_win) { |
| 595 cflags = [ "-mavx" ] |
| 596 } |
| 597 if (is_win) { |
| 598 cflags = [ "/arch:AVX" ] |
| 599 } |
| 600 visibility = [ ":skia_opts" ] |
| 601 configs -= [ "//build/config/compiler:chromium_code" ] |
| 602 configs += [ |
| 603 ":skia_config", |
| 604 ":skia_library_config", |
| 605 "//build/config/compiler:no_chromium_code", |
| 606 ] |
551 } | 607 } |
552 visibility = [ ":skia_opts" ] | 608 source_set("skia_opts_avx2") { |
553 configs -= [ "//build/config/compiler:chromium_code" ] | 609 sources = gypi_skia_opts.avx2_sources |
554 configs += [ | 610 if (!is_win) { |
555 ":skia_config", | 611 cflags = [ "-mavx2" ] |
556 ":skia_library_config", | 612 } |
557 "//build/config/compiler:no_chromium_code", | 613 if (is_win) { |
558 ] | 614 cflags = [ "/arch:AVX2" ] |
559 } | 615 } |
560 source_set("skia_opts_sse42") { | 616 visibility = [ ":skia_opts" ] |
561 sources = gypi_skia_opts.sse42_sources | 617 configs -= [ "//build/config/compiler:chromium_code" ] |
562 if (!is_win || is_clang) { | 618 configs += [ |
563 cflags = [ "-msse4.2" ] | 619 ":skia_config", |
| 620 ":skia_library_config", |
| 621 "//build/config/compiler:no_chromium_code", |
| 622 ] |
564 } | 623 } |
565 if (is_win) { | |
566 defines = [ "SK_CPU_SSE_LEVEL=42" ] | |
567 } | |
568 visibility = [ ":skia_opts" ] | |
569 configs -= [ "//build/config/compiler:chromium_code" ] | |
570 configs += [ | |
571 ":skia_config", | |
572 ":skia_library_config", | |
573 "//build/config/compiler:no_chromium_code", | |
574 ] | |
575 } | |
576 source_set("skia_opts_avx") { | |
577 sources = gypi_skia_opts.avx_sources | |
578 if (!is_win) { | |
579 cflags = [ "-mavx" ] | |
580 } | |
581 if (is_win) { | |
582 cflags = [ "/arch:AVX" ] | |
583 } | |
584 visibility = [ ":skia_opts" ] | |
585 configs -= [ "//build/config/compiler:chromium_code" ] | |
586 configs += [ | |
587 ":skia_config", | |
588 ":skia_library_config", | |
589 "//build/config/compiler:no_chromium_code", | |
590 ] | |
591 } | |
592 source_set("skia_opts_avx2") { | |
593 sources = gypi_skia_opts.avx2_sources | |
594 if (!is_win) { | |
595 cflags = [ "-mavx2" ] | |
596 } | |
597 if (is_win) { | |
598 cflags = [ "/arch:AVX2" ] | |
599 } | |
600 visibility = [ ":skia_opts" ] | |
601 configs -= [ "//build/config/compiler:chromium_code" ] | |
602 configs += [ | |
603 ":skia_config", | |
604 ":skia_library_config", | |
605 "//build/config/compiler:no_chromium_code", | |
606 ] | |
607 } | 624 } |
608 } | 625 } |
| 626 |
609 source_set("skia_opts") { | 627 source_set("skia_opts") { |
610 cflags = [] | 628 cflags = [] |
611 defines = [] | 629 defines = [] |
612 | 630 |
613 deps = [ | 631 deps = [ |
614 "//base", | 632 "//base", |
615 ] | 633 ] |
616 | 634 |
617 if (current_cpu == "x86" || current_cpu == "x64") { | 635 if (skia_build_no_opts) { |
| 636 sources = gypi_skia_opts.none_sources |
| 637 } else if (current_cpu == "x86" || current_cpu == "x64") { |
618 sources = gypi_skia_opts.sse2_sources | 638 sources = gypi_skia_opts.sse2_sources |
619 deps += [ | 639 deps += [ |
620 ":skia_opts_avx", | 640 ":skia_opts_avx", |
621 ":skia_opts_avx2", | 641 ":skia_opts_avx2", |
622 ":skia_opts_sse3", | 642 ":skia_opts_sse3", |
623 ":skia_opts_sse41", | 643 ":skia_opts_sse41", |
624 ":skia_opts_sse42", | 644 ":skia_opts_sse42", |
625 ] | 645 ] |
626 } else if (current_cpu == "arm") { | 646 } else if (current_cpu == "arm") { |
627 # The assembly uses the frame pointer register (r7 in Thumb/r11 in | 647 # The assembly uses the frame pointer register (r7 in Thumb/r11 in |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 ] | 747 ] |
728 | 748 |
729 deps = [ | 749 deps = [ |
730 ":skia", | 750 ":skia", |
731 "//base", | 751 "//base", |
732 "//base/test:test_support", | 752 "//base/test:test_support", |
733 "//build/config/sanitizers:deps", | 753 "//build/config/sanitizers:deps", |
734 ] | 754 ] |
735 } | 755 } |
736 } | 756 } |
OLD | NEW |