• 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/ace/ace_engine/ace_config.gni")
16
17config("thirdparty_lib_txt_config") {
18  cflags_cc = [
19    "-Wno-implicit-fallthrough",
20    "-fvisibility-inlines-hidden",
21    "-Os",
22  ]
23}
24
25template("thirdparty_lib_txt") {
26  forward_variables_from(invoker, "*")
27
28  ohos_source_set(target_name) {
29    defines += invoker.defines
30    cflags_cc += invoker.cflags_cc
31
32    configs = [
33      "$ace_flutter_engine_root/icu:icu_config_$platform",
34      "$ace_flutter_engine_root:flutter_config",
35      ":thirdparty_lib_txt_config",
36    ]
37    if (platform == "android") {
38      configs += [ "$ace_root/build:reduce_eh_frame_config" ]
39    }
40
41    sources = [
42      "$flutter_root/engine/flutter/third_party/txt/src/log/log.cc",
43      "$flutter_root/engine/flutter/third_party/txt/src/minikin/CmapCoverage.cpp",
44      "$flutter_root/engine/flutter/third_party/txt/src/minikin/Emoji.cpp",
45      "$flutter_root/engine/flutter/third_party/txt/src/minikin/FontCollection.cpp",
46      "$flutter_root/engine/flutter/third_party/txt/src/minikin/FontFamily.cpp",
47      "$flutter_root/engine/flutter/third_party/txt/src/minikin/FontLanguage.cpp",
48      "$flutter_root/engine/flutter/third_party/txt/src/minikin/FontLanguageListCache.cpp",
49      "$flutter_root/engine/flutter/third_party/txt/src/minikin/FontUtils.cpp",
50      "$flutter_root/engine/flutter/third_party/txt/src/minikin/GraphemeBreak.cpp",
51      "$flutter_root/engine/flutter/third_party/txt/src/minikin/HbFontCache.cpp",
52      "$flutter_root/engine/flutter/third_party/txt/src/minikin/Hyphenator.cpp",
53      "$flutter_root/engine/flutter/third_party/txt/src/minikin/Layout.cpp",
54      "$flutter_root/engine/flutter/third_party/txt/src/minikin/LayoutUtils.cpp",
55      "$flutter_root/engine/flutter/third_party/txt/src/minikin/LineBreaker.cpp",
56      "$flutter_root/engine/flutter/third_party/txt/src/minikin/Measurement.cpp",
57      "$flutter_root/engine/flutter/third_party/txt/src/minikin/MinikinFont.cpp",
58      "$flutter_root/engine/flutter/third_party/txt/src/minikin/MinikinInternal.cpp",
59      "$flutter_root/engine/flutter/third_party/txt/src/minikin/SparseBitSet.cpp",
60      "$flutter_root/engine/flutter/third_party/txt/src/minikin/WordBreaker.cpp",
61      "$flutter_root/engine/flutter/third_party/txt/src/txt/asset_font_manager.cc",
62      "$flutter_root/engine/flutter/third_party/txt/src/txt/font_asset_provider.cc",
63      "$flutter_root/engine/flutter/third_party/txt/src/txt/font_collection.cc",
64      "$flutter_root/engine/flutter/third_party/txt/src/txt/font_features.cc",
65      "$flutter_root/engine/flutter/third_party/txt/src/txt/font_skia.cc",
66      "$flutter_root/engine/flutter/third_party/txt/src/txt/paint_record.cc",
67      "$flutter_root/engine/flutter/third_party/txt/src/txt/paragraph_builder.cc",
68      "$flutter_root/engine/flutter/third_party/txt/src/txt/paragraph_builder_txt.cc",
69      "$flutter_root/engine/flutter/third_party/txt/src/txt/paragraph_style.cc",
70      "$flutter_root/engine/flutter/third_party/txt/src/txt/paragraph_txt.cc",
71      "$flutter_root/engine/flutter/third_party/txt/src/txt/placeholder_run.cc",
72      "$flutter_root/engine/flutter/third_party/txt/src/txt/styled_runs.cc",
73      "$flutter_root/engine/flutter/third_party/txt/src/txt/test_font_manager.cc",
74      "$flutter_root/engine/flutter/third_party/txt/src/txt/text_decoration.cc",
75      "$flutter_root/engine/flutter/third_party/txt/src/txt/text_shadow.cc",
76      "$flutter_root/engine/flutter/third_party/txt/src/txt/text_style.cc",
77      "$flutter_root/engine/flutter/third_party/txt/src/txt/typeface_font_asset_provider.cc",
78      "$flutter_root/engine/flutter/third_party/txt/src/utils/JenkinsHash.cpp",
79    ]
80
81    deps = [
82      "$ace_flutter_engine_root:flutter_engine_fml_$platform",
83      "$ace_flutter_engine_root/icu:ace_libicu_$platform",
84      "$ace_flutter_engine_root/skia:ace_skia_$platform",
85    ]
86
87    if (platform == "ohos") {
88      if (defined(oem_commercial_build) && oem_commercial_build) {
89        sources += [ "$flutter_root/engine/flutter/third_party/txt/src/txt/platform_android.cc" ]
90      } else {
91        sources += [ "$flutter_root/engine/flutter/third_party/txt/src/txt/platform_ohos.cc" ]
92      }
93    } else if (platform == "windows") {
94      sources +=
95          [ "$flutter_root/engine/flutter/third_party/txt/src/txt/platform.cc" ]
96      if (is_standard_system) {
97        defines += [ "OHOS_STANDARD_SYSTEM" ]
98      }
99    } else if (platform == "mac") {
100      sources += [
101        "$flutter_root/engine/flutter/third_party/txt/src/txt/platform_mac.mm",
102      ]
103      if (is_standard_system) {
104        defines += [ "OHOS_STANDARD_SYSTEM" ]
105      }
106    } else if (platform == "android") {
107      sources += [ "$flutter_root/engine/flutter/third_party/txt/src/txt/platform_android.cc" ]
108    }
109  }
110}
111
112foreach(item, ace_platforms) {
113  thirdparty_lib_txt("thirdparty_lib_txt_" + item.name) {
114    platform = item.name
115    defines = []
116    cflags_cc = []
117    config = {
118    }
119
120    if (defined(item.config)) {
121      config = item.config
122    }
123
124    if (defined(config.defines)) {
125      defines = config.defines
126    }
127
128    if (defined(config.cflags_cc)) {
129      cflags_cc = config.cflags_cc
130    }
131  }
132}
133