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