• 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_pgo_path = ""
20  skia_feature_wuji_enable = false
21  skia_feature_ace_enable_gpu = true
22}
23
24skia_common_defines = [
25  "SK_HAS_ANDROID_CODEC",
26  "SK_CODEC_DECODES_JPEG",
27  "SK_ENCODE_JPEG",
28  "SK_ENCODE_PNG",
29  "SK_CODEC_DECODES_PNG",
30  "SK_CODEC_DECODES_WEBP",
31  "SK_ENCODE_WEBP",
32  "SK_GL",
33  "SK_USE_LIBGIFCODEC",
34  "SK_HAS_HEIF_LIBRARY",
35  "SK_XML",
36  "WEBP_SWAP_16BIT_CSP",
37  "SK_ENABLE_SVG",
38  "SKSHAPER_IMPLEMENTATION=1",
39  "SK_SHAPER_HARFBUZZ_AVAILABLE",
40  "SK_UNICODE_AVAILABLE",
41  "SKUNICODE_IMPLEMENTATION=1",
42  "SK_SUPPORT_PDF",
43]
44
45skia_common_cflags = [
46  "-Wno-deprecated-declarations",
47  "-Wno-pessimizing-move",
48  "-Wno-return-type",
49  "-Wno-sign-compare",
50  "-Wno-sometimes-uninitialized",
51  "-Wno-unknown-pragmas",
52  "-Wno-unused-function",
53  "-Wno-unused-private-field",
54  "-Wno-unused-variable",
55  "-Wno-c++17-extensions",
56  "-Wno-unknown-warning-option",
57]
58
59if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
60  skia_common_cflags += [ "-flto=thin" ]
61  if (enhanced_opt) {
62    skia_common_cflags += [ "-fwhole-program-vtables" ]
63    if (skia_feature_enable_pgo && skia_feature_product != "default") {
64      skia_common_cflags += [
65        "-fprofile-use=" +
66            rebase_path("${skia_feature_pgo_path}/libskia_canvaskit.profdata",
67                        root_build_dir),
68        "-Wno-error=backend-plugin",
69        "-Wno-profile-instr-out-of-date",
70        "-Wno-profile-instr-unprofiled",
71      ]
72    }
73    if (skia_feature_product == "pc" && target_cpu == "arm64" &&
74        current_cpu == "arm64") {
75      skia_common_cflags += [ "-moutline-atomics" ]
76    }
77  }
78}
79
80declare_args() {
81  use_oh_skia = true
82  skia_use_freetype2 = true
83  is_skia_component_build = false
84  skia_feature_zlib = ""
85}
86
87use_mingw_win = "${current_os}_${current_cpu}" == "mingw_x86_64"
88use_mac = "${current_os}_${current_cpu}" == "mac_x64" ||
89          "${current_os}_${current_cpu}" == "mac_arm64"
90use_ios = "${current_os}_${current_cpu}" == "ios_x64" ||
91          "${current_os}_${current_cpu}" == "ios_arm64"
92use_linux = "${current_os}_${current_cpu}" == "linux_x64" ||
93            "${current_os}_${current_cpu}" == "linux_arm64"
94
95if (skia_feature_ace_enable_gpu) {
96  ace_enable_gpu = true
97} else {
98  ace_enable_gpu = false
99}
100