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