1e9297d28Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.. All rights reserved.
2e9297d28Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3e9297d28Sopenharmony_ci# you may not use this file except in compliance with the License.
4e9297d28Sopenharmony_ci# You may obtain a copy of the License at
5e9297d28Sopenharmony_ci#
6e9297d28Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7e9297d28Sopenharmony_ci#
8e9297d28Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9e9297d28Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10e9297d28Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11e9297d28Sopenharmony_ci# See the License for the specific language governing permissions and
12e9297d28Sopenharmony_ci# limitations under the License.
13e9297d28Sopenharmony_ci
14e9297d28Sopenharmony_ciimport("//build/ohos.gni")
15e9297d28Sopenharmony_ciimport("//foundation/graphic/graphic_2d/ace_platforms.gni")
16e9297d28Sopenharmony_ciimport("//foundation/graphic/graphic_2d/graphic_config.gni")
17e9297d28Sopenharmony_ci
18e9297d28Sopenharmony_ciskia_root = "//third_party/skia"
19e9297d28Sopenharmony_ci
20e9297d28Sopenharmony_ciconfig("libharfbuzz_compile_flags") {
21e9297d28Sopenharmony_ci  cflags_cc = [
22e9297d28Sopenharmony_ci    "-std=c++14",
23e9297d28Sopenharmony_ci    "-fno-exceptions",
24e9297d28Sopenharmony_ci    "-fno-rtti",
25e9297d28Sopenharmony_ci
26e9297d28Sopenharmony_ci    # "-fvisibility-inlines-hidden",
27e9297d28Sopenharmony_ci    "-Os",
28e9297d28Sopenharmony_ci  ]
29e9297d28Sopenharmony_ci
30e9297d28Sopenharmony_ci  cflags = [
31e9297d28Sopenharmony_ci    "-w",
32e9297d28Sopenharmony_ci    "-fstrict-aliasing",
33e9297d28Sopenharmony_ci    "-Os",
34e9297d28Sopenharmony_ci    "-fdata-sections",
35e9297d28Sopenharmony_ci    "-ffunction-sections",
36e9297d28Sopenharmony_ci    "-gline-tables-only",
37e9297d28Sopenharmony_ci    "-funwind-tables",
38e9297d28Sopenharmony_ci    "-Wno-unused-parameter",
39e9297d28Sopenharmony_ci
40e9297d28Sopenharmony_ci    # "-fvisibility=hidden",
41e9297d28Sopenharmony_ci  ]
42e9297d28Sopenharmony_ci
43e9297d28Sopenharmony_ci  include_dirs = [
44e9297d28Sopenharmony_ci    "$skia_root/third_party/harfbuzz",
45e9297d28Sopenharmony_ci    "$skia_root/third_party/externals/harfbuzz/src",
46e9297d28Sopenharmony_ci  ]
47e9297d28Sopenharmony_ci}
48e9297d28Sopenharmony_ci
49e9297d28Sopenharmony_citemplate("rosen_libharfbuzz") {
50e9297d28Sopenharmony_ci  forward_variables_from(invoker, "*")
51e9297d28Sopenharmony_ci
52e9297d28Sopenharmony_ci  ohos_source_set(target_name) {
53e9297d28Sopenharmony_ci    defines += invoker.defines
54e9297d28Sopenharmony_ci    defines += [
55e9297d28Sopenharmony_ci      "HAVE_ICU",
56e9297d28Sopenharmony_ci      "HAVE_ICU_BUILTIN",
57e9297d28Sopenharmony_ci      "HAVE_INTEL_ATOMIC_PRIMITIVES",
58e9297d28Sopenharmony_ci      "HAVE_OT",
59e9297d28Sopenharmony_ci      "U_USING_ICU_NAMESPACE=0",
60e9297d28Sopenharmony_ci      "SK_USING_THIRD_PARTY_ICU",
61e9297d28Sopenharmony_ci      "UPRV_BLOCK_MACRO_BEGIN=",
62e9297d28Sopenharmony_ci      "UPRV_BLOCK_MACRO_END=",
63e9297d28Sopenharmony_ci    ]
64e9297d28Sopenharmony_ci    cflags_cc += invoker.cflags_cc
65e9297d28Sopenharmony_ci
66e9297d28Sopenharmony_ci    configs = [ ":libharfbuzz_compile_flags" ]
67e9297d28Sopenharmony_ci    if (platform == "android") {
68e9297d28Sopenharmony_ci      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
69e9297d28Sopenharmony_ci    }
70e9297d28Sopenharmony_ci
71e9297d28Sopenharmony_ci    sources = [
72e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-aat-layout.cc",
73e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-aat-map.cc",
74e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-blob.cc",
75e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-buffer-serialize.cc",
76e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-buffer.cc",
77e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-common.cc",
78e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-face.cc",
79e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-font.cc",
80e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-icu.cc",
81e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-map.cc",
82e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-cff1-table.cc",
83e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-cff2-table.cc",
84e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-color.cc",
85e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-face.cc",
86e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-font.cc",
87e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-layout.cc",
88e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-map.cc",
89e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-math.cc",
90e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-name.cc",
91e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-arabic.cc",
92e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-default.cc",
93e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-hangul.cc",
94e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-hebrew.cc",
95e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-indic-table.cc",
96e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-indic.cc",
97e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-khmer.cc",
98e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-myanmar.cc",
99e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-thai.cc",
100e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-use-table.cc",
101e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-use.cc",
102e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-vowel-constraints.cc",
103e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-fallback.cc",
104e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-normalize.cc",
105e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape.cc",
106e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-tag.cc",
107e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ot-var.cc",
108e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-set.cc",
109e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-shape-plan.cc",
110e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-shape.cc",
111e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-shaper.cc",
112e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-static.cc",
113e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-subset-cff-common.cc",
114e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-subset-cff1.cc",
115e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-subset-cff2.cc",
116e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-subset-input.cc",
117e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-subset-plan.cc",
118e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-subset.cc",
119e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-ucd.cc",
120e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-unicode.cc",
121e9297d28Sopenharmony_ci      "$skia_root/third_party/externals/harfbuzz/src/hb-warning.cc",
122e9297d28Sopenharmony_ci    ]
123e9297d28Sopenharmony_ci    if (defined(use_new_skia) && use_new_skia) {
124e9297d28Sopenharmony_ci      sources -= [
125e9297d28Sopenharmony_ci        "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-use-table.cc",
126e9297d28Sopenharmony_ci        "$skia_root/third_party/externals/harfbuzz/src/hb-warning.cc",
127e9297d28Sopenharmony_ci      ]
128e9297d28Sopenharmony_ci      sources += [
129e9297d28Sopenharmony_ci        "$skia_root/third_party/externals/harfbuzz/src/hb-fallback-shape.cc",
130e9297d28Sopenharmony_ci        "$skia_root/third_party/externals/harfbuzz/src/hb-number.cc",
131e9297d28Sopenharmony_ci        "$skia_root/third_party/externals/harfbuzz/src/hb-ot-metrics.cc",
132e9297d28Sopenharmony_ci        "$skia_root/third_party/externals/harfbuzz/src/hb-ot-shape-complex-syllabic.cc",
133e9297d28Sopenharmony_ci      ]
134e9297d28Sopenharmony_ci    }
135e9297d28Sopenharmony_ci
136e9297d28Sopenharmony_ci    deps = [ "$graphic_2d_root/rosen/build/icu:rosen_libicu_$platform" ]
137e9297d28Sopenharmony_ci
138e9297d28Sopenharmony_ci    part_name = "graphic_2d"
139e9297d28Sopenharmony_ci    subsystem_name = "graphic"
140e9297d28Sopenharmony_ci  }
141e9297d28Sopenharmony_ci}
142e9297d28Sopenharmony_ci
143e9297d28Sopenharmony_ciforeach(item, ace_platforms) {
144e9297d28Sopenharmony_ci  rosen_libharfbuzz("rosen_libharfbuzz_" + item.name) {
145e9297d28Sopenharmony_ci    platform = item.name
146e9297d28Sopenharmony_ci    defines = []
147e9297d28Sopenharmony_ci    cflags_cc = []
148e9297d28Sopenharmony_ci    config = {
149e9297d28Sopenharmony_ci    }
150e9297d28Sopenharmony_ci
151e9297d28Sopenharmony_ci    if (defined(item.config)) {
152e9297d28Sopenharmony_ci      config = item.config
153e9297d28Sopenharmony_ci    }
154e9297d28Sopenharmony_ci
155e9297d28Sopenharmony_ci    if (defined(config.defines)) {
156e9297d28Sopenharmony_ci      defines = config.defines
157e9297d28Sopenharmony_ci    }
158e9297d28Sopenharmony_ci
159e9297d28Sopenharmony_ci    if (defined(config.cflags_cc)) {
160e9297d28Sopenharmony_ci      cflags_cc = config.cflags_cc
161e9297d28Sopenharmony_ci    }
162e9297d28Sopenharmony_ci  }
163e9297d28Sopenharmony_ci}
164