• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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.gni")
15import("//foundation/arkui/ace_engine/ace_config.gni")
16import("//third_party/flutter/flutter_config.gni")
17
18config("libsfntly_compile_flags") {
19  cflags_cc = [
20    "-std=c++14",
21    "-fno-exceptions",
22    "-fno-rtti",
23    "-fvisibility-inlines-hidden",
24  ]
25
26  cflags = [
27    "-w",
28    "-fstrict-aliasing",
29    "-fdata-sections",
30    "-ffunction-sections",
31    "-gline-tables-only",
32    "-funwind-tables",
33    "-Wno-unused-parameter",
34    "-fvisibility=hidden",
35  ]
36}
37
38config("libsfntly_configs") {
39  include_dirs = [ "$flutter_root/skia/third_party/externals/sfntly/cpp/src" ]
40}
41
42template("ace_libsfntly") {
43  forward_variables_from(invoker, "*")
44
45  ohos_source_set(target_name) {
46    part_name = flutter_part
47    subsystem_name = flutter_subsystem
48    license_file =
49        "$flutter_root/skia/third_party/externals/sfntly/cpp/COPYING.txt"
50    defines += invoker.defines
51    defines += [
52      "SFNTLY_NO_EXCEPTION",
53      "U_USING_ICU_NAMESPACE=0",
54      "SK_USING_THIRD_PARTY_ICU",
55    ]
56    configs = [ ":libsfntly_compile_flags" ]
57    public_configs = [ ":libsfntly_configs" ]
58
59    if (platform == "android") {
60      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
61    }
62
63    sources = [
64      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sample/chromium/font_subsetter.cc",
65      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sample/chromium/subsetter_impl.cc",
66      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/byte_array.cc",
67      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/font_data.cc",
68      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/font_input_stream.cc",
69      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/font_output_stream.cc",
70      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/growable_memory_byte_array.cc",
71      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/memory_byte_array.cc",
72      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/readable_font_data.cc",
73      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/data/writable_font_data.cc",
74      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/font.cc",
75      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/font_factory.cc",
76      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/port/file_input_stream.cc",
77      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/port/lock.cc",
78      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/port/memory_input_stream.cc",
79      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/port/memory_output_stream.cc",
80      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/big_glyph_metrics.cc",
81      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/bitmap_glyph.cc",
82      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/bitmap_glyph_info.cc",
83      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/bitmap_size_table.cc",
84      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/composite_bitmap_glyph.cc",
85      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/ebdt_table.cc",
86      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/eblc_table.cc",
87      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/ebsc_table.cc",
88      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/glyph_metrics.cc",
89      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table.cc",
90      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format1.cc",
91      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format2.cc",
92      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format3.cc",
93      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format4.cc",
94      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format5.cc",
95      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/simple_bitmap_glyph.cc",
96      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/bitmap/small_glyph_metrics.cc",
97      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/byte_array_table_builder.cc",
98      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc",
99      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/font_header_table.cc",
100      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/horizontal_device_metrics_table.cc",
101      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/horizontal_header_table.cc",
102      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/horizontal_metrics_table.cc",
103      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/maximum_profile_table.cc",
104      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/name_table.cc",
105      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/os2_table.cc",
106      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/font_data_table.cc",
107      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/generic_table_builder.cc",
108      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/header.cc",
109      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/subtable.cc",
110      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/table.cc",
111      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/table_based_table_builder.cc",
112      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/truetype/glyph_table.cc",
113      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/table/truetype/loca_table.cc",
114      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/tag.cc",
115      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/tools/subsetter/glyph_table_subsetter.cc",
116      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/tools/subsetter/subsetter.cc",
117      "$flutter_root/skia/third_party/externals/sfntly/cpp/src/sfntly/tools/subsetter/table_subsetter_impl.cc",
118    ]
119
120    if (platform == "windows") {
121      libs = [ "pthread" ]
122    }
123
124    deps = [ "$ace_flutter_engine_root/icu:ace_libicu_$platform" ]
125  }
126}
127
128foreach(item, ace_platforms) {
129  ace_libsfntly("ace_libsfntly_" + item.name) {
130    platform = item.name
131    defines = []
132    config = {
133    }
134
135    if (defined(item.config)) {
136      config = item.config
137    }
138
139    if (defined(config.defines)) {
140      defines = config.defines
141    }
142  }
143}
144