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