• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos_var.gni")
15
16declare_args() {
17  skia_feature_product = "default"
18  skia_feature_enable_pgo = false
19  skia_feature_enable_codemerge = false
20  skia_feature_pgo_path = ""
21  skia_feature_wuji_enable = false
22  skia_feature_ace_enable_gpu = true
23}
24
25skia_common_defines = [
26  "SK_HAS_ANDROID_CODEC",
27  "SK_CODEC_DECODES_JPEG",
28  "SK_ENCODE_JPEG",
29  "SK_ENCODE_PNG",
30  "SK_CODEC_DECODES_PNG",
31  "SK_CODEC_DECODES_WEBP",
32  "SK_ENCODE_WEBP",
33  "SK_GL",
34  "SK_USE_LIBGIFCODEC",
35  "SK_HAS_HEIF_LIBRARY",
36  "SK_XML",
37  "WEBP_SWAP_16BIT_CSP",
38  "SK_ENABLE_SVG",
39  "SKSHAPER_IMPLEMENTATION=1",
40  "SK_SHAPER_HARFBUZZ_AVAILABLE",
41  "SK_UNICODE_AVAILABLE",
42  "SKUNICODE_IMPLEMENTATION=1",
43  "SK_SUPPORT_PDF",
44]
45
46skia_common_cflags = [
47  "-Wno-deprecated-declarations",
48  "-Wno-pessimizing-move",
49  "-Wno-return-type",
50  "-Wno-sign-compare",
51  "-Wno-sometimes-uninitialized",
52  "-Wno-unknown-pragmas",
53  "-Wno-unused-function",
54  "-Wno-unused-private-field",
55  "-Wno-unused-variable",
56  "-Wno-c++17-extensions",
57  "-Wno-unknown-warning-option",
58]
59
60if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
61  skia_common_cflags += [ "-flto=thin" ]
62  if (enhanced_opt) {
63    skia_common_cflags += [ "-fwhole-program-vtables" ]
64    if (skia_feature_enable_pgo && skia_feature_product != "default") {
65      skia_common_cflags += [
66        "-fprofile-use=" +
67            rebase_path("${skia_feature_pgo_path}/libskia_canvaskit.profdata",
68                        root_build_dir),
69        "-Wno-error=backend-plugin",
70        "-Wno-profile-instr-out-of-date",
71        "-Wno-profile-instr-unprofiled",
72        "-mllvm",
73        "-enable-partial-inlining",
74      ]
75    }
76    if (skia_feature_product == "pc" && target_cpu == "arm64" &&
77        current_cpu == "arm64") {
78      skia_common_cflags += [ "-moutline-atomics" ]
79    }
80  }
81}
82
83declare_args() {
84  use_oh_skia = true
85  skia_use_freetype2 = true
86  is_skia_component_build = false
87  skia_feature_zlib = ""
88  skia_feature_hispeed_plugin = false
89}
90
91use_mingw_win = "${current_os}_${current_cpu}" == "mingw_x86_64"
92use_mac = "${current_os}_${current_cpu}" == "mac_x64" ||
93          "${current_os}_${current_cpu}" == "mac_arm64"
94use_ios = "${current_os}_${current_cpu}" == "ios_x64" ||
95          "${current_os}_${current_cpu}" == "ios_arm64"
96use_linux = "${current_os}_${current_cpu}" == "linux_x64" ||
97            "${current_os}_${current_cpu}" == "linux_arm64"
98
99if (skia_feature_ace_enable_gpu) {
100  ace_enable_gpu = true
101} else {
102  ace_enable_gpu = false
103}
104