1# Copyright (c) 2022 Huawei Device Co., Ltd.. All rights reserved. 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.gni") 15import("//foundation/graphic/graphic_2d/ace_platforms.gni") 16import("//foundation/graphic/graphic_2d/graphic_config.gni") 17 18skia_root = "//third_party/skia" 19 20config("libharfbuzz_compile_flags") { 21 cflags_cc = [ 22 "-std=c++14", 23 "-fno-exceptions", 24 "-fno-rtti", 25 26 # "-fvisibility-inlines-hidden", 27 "-Os", 28 ] 29 30 cflags = [ 31 "-w", 32 "-fstrict-aliasing", 33 "-Os", 34 "-fdata-sections", 35 "-ffunction-sections", 36 "-gline-tables-only", 37 "-funwind-tables", 38 "-Wno-unused-parameter", 39 40 # "-fvisibility=hidden", 41 ] 42 43 include_dirs = [ 44 "$skia_root/third_party/harfbuzz", 45 "$skia_root/third_party/externals/harfbuzz/src", 46 ] 47} 48 49template("rosen_libharfbuzz") { 50 forward_variables_from(invoker, "*") 51 52 ohos_source_set(target_name) { 53 defines += invoker.defines 54 defines += [ 55 "HAVE_ICU", 56 "HAVE_ICU_BUILTIN", 57 "HAVE_INTEL_ATOMIC_PRIMITIVES", 58 "HAVE_OT", 59 "U_USING_ICU_NAMESPACE=0", 60 "SK_USING_THIRD_PARTY_ICU", 61 "UPRV_BLOCK_MACRO_BEGIN=", 62 "UPRV_BLOCK_MACRO_END=", 63 ] 64 cflags_cc += invoker.cflags_cc 65 66 configs = [ ":libharfbuzz_compile_flags" ] 67 if (platform == "android") { 68 configs += [ "$ace_root/build:reduce_eh_frame_config" ] 69 } 70 71 sources = [ 72 "$skia_root/third_party/externals/harfbuzz/src/hb-aat-layout.cc", 73 "$skia_root/third_party/externals/harfbuzz/src/hb-aat-map.cc", 74 "$skia_root/third_party/externals/harfbuzz/src/hb-blob.cc", 75 "$skia_root/third_party/externals/harfbuzz/src/hb-buffer-serialize.cc", 76 "$skia_root/third_party/externals/harfbuzz/src/hb-buffer.cc", 77 "$skia_root/third_party/externals/harfbuzz/src/hb-common.cc", 78 "$skia_root/third_party/externals/harfbuzz/src/hb-face.cc", 79 "$skia_root/third_party/externals/harfbuzz/src/hb-font.cc", 80 "$skia_root/third_party/externals/harfbuzz/src/hb-icu.cc", 81 "$skia_root/third_party/externals/harfbuzz/src/hb-map.cc", 82 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-cff1-table.cc", 83 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-cff2-table.cc", 84 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-color.cc", 85 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-face.cc", 86 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-font.cc", 87 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-layout.cc", 88 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-map.cc", 89 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-math.cc", 90 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-name.cc", 91 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-arabic.cc", 92 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-default.cc", 93 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-hangul.cc", 94 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-hebrew.cc", 95 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-indic-table.cc", 96 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-indic.cc", 97 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-khmer.cc", 98 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-myanmar.cc", 99 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-thai.cc", 100 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-use-table.cc", 101 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-use.cc", 102 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-vowel-constraints.cc", 103 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-fallback.cc", 104 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-normalize.cc", 105 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape.cc", 106 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-tag.cc", 107 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-var.cc", 108 "$skia_root/third_party/externals/harfbuzz/src/hb-set.cc", 109 "$skia_root/third_party/externals/harfbuzz/src/hb-shape-plan.cc", 110 "$skia_root/third_party/externals/harfbuzz/src/hb-shape.cc", 111 "$skia_root/third_party/externals/harfbuzz/src/hb-shaper.cc", 112 "$skia_root/third_party/externals/harfbuzz/src/hb-static.cc", 113 "$skia_root/third_party/externals/harfbuzz/src/hb-subset-cff-common.cc", 114 "$skia_root/third_party/externals/harfbuzz/src/hb-subset-cff1.cc", 115 "$skia_root/third_party/externals/harfbuzz/src/hb-subset-cff2.cc", 116 "$skia_root/third_party/externals/harfbuzz/src/hb-subset-input.cc", 117 "$skia_root/third_party/externals/harfbuzz/src/hb-subset-plan.cc", 118 "$skia_root/third_party/externals/harfbuzz/src/hb-subset.cc", 119 "$skia_root/third_party/externals/harfbuzz/src/hb-ucd.cc", 120 "$skia_root/third_party/externals/harfbuzz/src/hb-unicode.cc", 121 "$skia_root/third_party/externals/harfbuzz/src/hb-warning.cc", 122 ] 123 if (defined(use_new_skia) && use_new_skia) { 124 sources -= [ 125 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-use-table.cc", 126 "$skia_root/third_party/externals/harfbuzz/src/hb-warning.cc", 127 ] 128 sources += [ 129 "$skia_root/third_party/externals/harfbuzz/src/hb-fallback-shape.cc", 130 "$skia_root/third_party/externals/harfbuzz/src/hb-number.cc", 131 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-metrics.cc", 132 "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-syllabic.cc", 133 ] 134 } 135 136 deps = [ "$graphic_2d_root/rosen/build/icu:rosen_libicu_$platform" ] 137 138 part_name = "graphic_2d" 139 subsystem_name = "graphic" 140 } 141} 142 143foreach(item, ace_platforms) { 144 rosen_libharfbuzz("rosen_libharfbuzz_" + item.name) { 145 platform = item.name 146 defines = [] 147 cflags_cc = [] 148 config = { 149 } 150 151 if (defined(item.config)) { 152 config = item.config 153 } 154 155 if (defined(config.defines)) { 156 defines = config.defines 157 } 158 159 if (defined(config.cflags_cc)) { 160 cflags_cc = config.cflags_cc 161 } 162 } 163} 164