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