1# Copyright (c) 2025 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} 22 23skia_common_defines = [ 24 "SK_HAS_ANDROID_CODEC", 25 "SK_CODEC_DECODES_JPEG", 26 "SK_ENCODE_JPEG", 27 "SK_ENCODE_PNG", 28 "SK_CODEC_DECODES_PNG", 29 "SK_CODEC_DECODES_WEBP", 30 "SK_ENCODE_WEBP", 31 "SK_GL", 32 "SK_USE_LIBGIFCODEC", 33 "SK_HAS_HEIF_LIBRARY", 34 "SK_XML", 35 "WEBP_SWAP_16BIT_CSP", 36 "SK_ENABLE_SVG", 37 "SKSHAPER_IMPLEMENTATION=1", 38 "SK_SHAPER_HARFBUZZ_AVAILABLE", 39 "SK_UNICODE_AVAILABLE", 40 "SKUNICODE_IMPLEMENTATION=1", 41 "SK_SUPPORT_PDF", 42 "SK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER", 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 "-mllvm", 72 "-enable-partial-inlining", 73 ] 74 } 75 if (skia_feature_product == "pc" && target_cpu == "arm64" && 76 current_cpu == "arm64") { 77 skia_common_cflags += [ "-moutline-atomics" ] 78 } 79 } 80} 81 82declare_args() { 83 use_oh_skia = true 84 is_skia_component_build = false 85 skia_use_freetype2 = true 86 skia_feature_zlib = "" 87 skia_use_system_lib = false 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