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") 15import("//foundation/graphic/graphic_2d/graphic_config.gni") 16 17skia_common_defines = [ 18 "SK_HAS_ANDROID_CODEC", 19 "SK_CODEC_DECODES_JPEG", 20 "SK_ENCODE_JPEG", 21 "SK_ENCODE_PNG", 22 "SK_CODEC_DECODES_PNG", 23 "SK_CODEC_DECODES_WEBP", 24 "SK_ENCODE_WEBP", 25 "SK_GL", 26 "SK_USE_LIBGIFCODEC", 27 "SK_HAS_HEIF_LIBRARY", 28 "SK_XML", 29 "WEBP_SWAP_16BIT_CSP", 30 "SK_ENABLE_SVG", 31 "SKSHAPER_IMPLEMENTATION=1", 32 "SK_SHAPER_HARFBUZZ_AVAILABLE", 33 "SK_UNICODE_AVAILABLE", 34 "SKUNICODE_IMPLEMENTATION=1", 35 "SK_SUPPORT_PDF", 36] 37 38skia_common_cflags = [ 39 "-Wno-deprecated-declarations", 40 "-Wno-pessimizing-move", 41 "-Wno-return-type", 42 "-Wno-sign-compare", 43 "-Wno-sometimes-uninitialized", 44 "-Wno-unknown-pragmas", 45 "-Wno-unused-function", 46 "-Wno-unused-private-field", 47 "-Wno-unused-variable", 48 "-Wno-c++17-extensions", 49 "-Wno-unknown-warning-option", 50] 51 52if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) { 53 skia_common_cflags += [ "-flto=thin" ] 54 if (enhanced_opt) { 55 skia_common_cflags += [ "-fwhole-program-vtables" ] 56 if (graphic_2d_feature_enable_pgo && 57 graphic_2d_feature_product != "default") { 58 skia_common_cflags += [ 59 "-fprofile-use=" + rebase_path( 60 "${graphic_2d_feature_pgo_path}/libskia_canvaskit.profdata", 61 root_build_dir), 62 "-Wno-error=backend-plugin", 63 "-Wno-profile-instr-out-of-date", 64 "-Wno-profile-instr-unprofiled", 65 ] 66 } 67 if (graphic_2d_feature_product == "pc" && target_cpu == "arm64" && 68 current_cpu == "arm64") { 69 skia_common_cflags += [ "-moutline-atomics" ] 70 } 71 } 72} 73 74declare_args() { 75 use_oh_skia = true 76 skia_use_freetype2 = true 77 is_skia_component_build = false 78} 79