• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2020-2022 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#     http://www.apache.org/licenses/LICENSE-2.0
6# Unless required by applicable law or agreed to in writing, software
7# distributed under the License is distributed on an "AS IS" BASIS,
8# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9# See the License for the specific language governing permissions and
10# limitations under the License.
11
12import("//build/lite/config/component/lite_component.gni")
13import("//build/lite/config/subsystem/graphic/config.gni")
14import("//build/lite/ndk/ndk.gni")
15
16lite_component("lite_ui") {
17  features = [ ":ui" ]
18  public_deps = features
19}
20
21ndk_lib("lite_ui_ndk") {
22  lib_extension = ".so"
23  deps = [ ":ui" ]
24  head_files = [ "interfaces/kits" ]
25}
26
27config("graphic_define_config") {
28  include_dirs = [
29    "interfaces/kits",
30    "interfaces/innerkits",
31  ]
32  defines = [
33    "GRAPHIC_ENABLE_ELLIPSE_FLAG=1",
34    "GRAPHIC_ENABLE_BEZIER_ARC_FLAG=1",
35    "GRAPHIC_ENABLE_LINECAP_FLAG=1",
36    "GRAPHIC_ENABLE_LINEJOIN_FLAG=1",
37    "GRAPHIC_ENABLE_ARC_FLAG=1",
38    "GRAPHIC_ENABLE_ROUNDEDRECT_FLAG=1",
39    "GRAPHIC_ENABLE_GRADIENT_FILL_FLAG=1",
40    "GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG=1",
41    "GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1",
42  ]
43  if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") {
44    cflags = [
45      "--diag_suppress",
46      "Pa084,Pa093,Pa137,Pe161,Pe177,Pe186,Pe223,Pe226,Pe366,Pe367,Pe550,Pe940,Pe068",
47    ]
48    cflags_cc = cflags
49  }
50  if (ohos_kernel_type != "liteos_m") {
51    defines += [
52      "ENABLE_VECTOR_FONT=1",
53      "ENABLE_BITMAP_FONT=0",
54      "ENABLE_SHAPING=0",
55      "ENABLE_ICU=1",
56      "ENABLE_MULTI_FONT=0",
57      "DEFAULT_ANIMATION=1",
58    ]
59    if (ohos_kernel_type == "linux") {
60      defines += [ "RESOURCE_DIR=\"/storage/data/\"" ]
61    } else {
62      defines += [ "RESOURCE_DIR=\"/user/data/\"" ]
63    }
64  }
65
66  if (ohos_kernel_type == "liteos_a") {
67    defines += [
68      "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
69      "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
70      "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
71      "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
72    ]
73  } else if (ohos_kernel_type == "liteos_m") {
74    include_dirs += [ "//third_party/freetype/include" ]
75    defines += [
76      "ENABLE_CANVAS_EXTEND=0",
77      "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
78      "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
79      "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
80      "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
81    ]
82  } else {
83    defines += [
84      "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
85      "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
86      "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
87      "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
88    ]
89  }
90}
91
92if (enable_graphic_font) {
93  copy("utils_config") {
94    sources = [
95      "tools/qt/simulator/font/SourceHanSansSC-Regular.otf",
96      "tools/qt/simulator/font/line_cj.brk",
97    ]
98    outputs = [ "$root_out_dir/data/{{source_file_part}}" ]
99  }
100}
101
102lite_library("ui") {
103  sources = [
104    "frameworks/animator/animator.cpp",
105    "frameworks/animator/animator_manager.cpp",
106    "frameworks/animator/easing_equation.cpp",
107    "frameworks/animator/interpolation.cpp",
108    "frameworks/common/graphic_startup.cpp",
109    "frameworks/common/image.cpp",
110    "frameworks/common/image_decode_ability.cpp",
111    "frameworks/common/input_device_manager.cpp",
112    "frameworks/common/screen.cpp",
113    "frameworks/common/spannable_string.cpp",
114    "frameworks/common/task.cpp",
115    "frameworks/common/text.cpp",
116    "frameworks/common/typed_text.cpp",
117    "frameworks/components/root_view.cpp",
118    "frameworks/components/text_adapter.cpp",
119    "frameworks/components/ui_abstract_clock.cpp",
120    "frameworks/components/ui_abstract_progress.cpp",
121    "frameworks/components/ui_abstract_scroll.cpp",
122    "frameworks/components/ui_abstract_scroll_bar.cpp",
123    "frameworks/components/ui_analog_clock.cpp",
124    "frameworks/components/ui_arc_label.cpp",
125    "frameworks/components/ui_arc_scroll_bar.cpp",
126    "frameworks/components/ui_axis.cpp",
127    "frameworks/components/ui_box_progress.cpp",
128    "frameworks/components/ui_box_scroll_bar.cpp",
129    "frameworks/components/ui_button.cpp",
130    "frameworks/components/ui_canvas.cpp",
131    "frameworks/components/ui_chart.cpp",
132    "frameworks/components/ui_checkbox.cpp",
133    "frameworks/components/ui_circle_progress.cpp",
134    "frameworks/components/ui_dialog.cpp",
135    "frameworks/components/ui_digital_clock.cpp",
136    "frameworks/components/ui_edit_text.cpp",
137    "frameworks/components/ui_extend_image_view.cpp",
138    "frameworks/components/ui_image_animator.cpp",
139    "frameworks/components/ui_image_view.cpp",
140    "frameworks/components/ui_label.cpp",
141    "frameworks/components/ui_label_button.cpp",
142    "frameworks/components/ui_list.cpp",
143    "frameworks/components/ui_picker.cpp",
144    "frameworks/components/ui_qrcode.cpp",
145    "frameworks/components/ui_radio_button.cpp",
146    "frameworks/components/ui_repeat_button.cpp",
147    "frameworks/components/ui_scroll_view.cpp",
148    "frameworks/components/ui_slider.cpp",
149    "frameworks/components/ui_surface_view.cpp",
150    "frameworks/components/ui_swipe_view.cpp",
151    "frameworks/components/ui_texture_mapper.cpp",
152    "frameworks/components/ui_time_picker.cpp",
153    "frameworks/components/ui_toggle_button.cpp",
154    "frameworks/components/ui_tree_manager.cpp",
155    "frameworks/components/ui_view.cpp",
156    "frameworks/components/ui_view_group.cpp",
157    "frameworks/core/input_method_manager.cpp",
158    "frameworks/core/render_manager.cpp",
159    "frameworks/core/task_manager.cpp",
160    "frameworks/default_resource/check_box_res.cpp",
161    "frameworks/dfx/event_injector.cpp",
162    "frameworks/dfx/key_event_injector.cpp",
163    "frameworks/dfx/performance_task.cpp",
164    "frameworks/dfx/point_event_injector.cpp",
165    "frameworks/dfx/ui_dump_dom_tree.cpp",
166    "frameworks/dfx/ui_screenshot.cpp",
167    "frameworks/dfx/ui_view_bounds.cpp",
168    "frameworks/dock/focus_manager.cpp",
169    "frameworks/dock/input_device.cpp",
170    "frameworks/dock/key_input_device.cpp",
171    "frameworks/dock/ohos/ohos_input_device.cpp",
172    "frameworks/dock/pointer_input_device.cpp",
173    "frameworks/dock/rotate_input_device.cpp",
174    "frameworks/dock/screen_device_proxy.cpp",
175    "frameworks/dock/vibrator_manager.cpp",
176    "frameworks/dock/virtual_input_device.cpp",
177    "frameworks/draw/clip_utils.cpp",
178    "frameworks/draw/draw_arc.cpp",
179    "frameworks/draw/draw_canvas.cpp",
180    "frameworks/draw/draw_curve.cpp",
181    "frameworks/draw/draw_image.cpp",
182    "frameworks/draw/draw_label.cpp",
183    "frameworks/draw/draw_line.cpp",
184    "frameworks/draw/draw_rect.cpp",
185    "frameworks/draw/draw_triangle.cpp",
186    "frameworks/draw/draw_utils.cpp",
187    "frameworks/engines/gfx/gfx_engine_manager.cpp",
188    "frameworks/engines/gfx/hi3516/hi3516_engine.cpp",
189    "frameworks/engines/gfx/soft_engine.cpp",
190    "frameworks/events/event.cpp",
191    "frameworks/font/base_font.cpp",
192    "frameworks/font/font_ram_allocator.cpp",
193    "frameworks/font/glyphs_cache.cpp",
194    "frameworks/font/glyphs_file.cpp",
195    "frameworks/font/glyphs_manager.cpp",
196    "frameworks/font/ui_font.cpp",
197    "frameworks/font/ui_font_adaptor.cpp",
198    "frameworks/font/ui_font_allocator.cpp",
199    "frameworks/font/ui_font_bitmap.cpp",
200    "frameworks/font/ui_font_builder.cpp",
201    "frameworks/font/ui_font_cache.cpp",
202    "frameworks/font/ui_font_cache_manager.cpp",
203    "frameworks/font/ui_font_vector.cpp",
204    "frameworks/font/ui_line_break.cpp",
205    "frameworks/font/ui_multi_font_manager.cpp",
206    "frameworks/font/ui_text_shaping.cpp",
207    "frameworks/imgdecode/cache_manager.cpp",
208    "frameworks/imgdecode/file_img_decoder.cpp",
209    "frameworks/imgdecode/image_load.cpp",
210    "frameworks/layout/flex_layout.cpp",
211    "frameworks/layout/grid_layout.cpp",
212    "frameworks/layout/list_layout.cpp",
213    "frameworks/render/render_base.cpp",
214    "frameworks/render/render_pixfmt_rgba_blend.cpp",
215    "frameworks/render/render_scanline.cpp",
216    "frameworks/themes/theme.cpp",
217    "frameworks/themes/theme_manager.cpp",
218    "frameworks/window/window.cpp",
219    "frameworks/window/window_impl.cpp",
220  ]
221
222  if (ohos_kernel_type == "liteos_m") {
223    target_type = "static_library"
224    include_dirs = [
225      "frameworks",
226      "//third_party/freetype/include",
227    ]
228    sources -= [
229      "frameworks/components/ui_surface_view.cpp",
230      "frameworks/dfx/ui_dump_dom_tree.cpp",
231      "frameworks/dfx/ui_screenshot.cpp",
232      "frameworks/engines/gfx/hi3516/hi3516_engine.cpp",
233      "frameworks/window/window.cpp",
234      "frameworks/window/window_impl.cpp",
235    ]
236    deps = [
237      "//build/lite/config/component/cJSON:cjson_static",
238      "//third_party/bounds_checking_function:libsec_static",
239      "//third_party/freetype:freetype",
240      "//third_party/giflib:libgif",
241      "//third_party/icu/icu4c/source/common:icu_font",
242      "//third_party/libjpeg-turbo:libjpeg",
243      "//third_party/libpng:libpng",
244      "//third_party/qrcodegen:qrcodegen",
245    ]
246  } else {
247    target_type = "shared_library"
248    include_dirs = [ "frameworks" ]
249    deps = [
250      "//build/lite/config/component/cJSON:cjson_shared",
251      "//foundation/graphic/surface:lite_surface",
252      "//foundation/graphic/utils:lite_graphic_hals",
253      "//foundation/graphic/wms:lite_wms",
254      "//third_party/bounds_checking_function:libsec_shared",
255      "//third_party/freetype:freetype",
256      "//third_party/giflib:libgif",
257      "//third_party/icu/icu4c/source/common:icu_font",
258      "//third_party/libjpeg-turbo:libjpeg",
259      "//third_party/libpng:libpng",
260      "//third_party/qrcodegen:qrcodegen",
261    ]
262
263    if (enable_video_component) {
264      defines += [ "ENABLE_VIDEO_COMPONENT=1" ]
265      source += [ "frameworks/components/ui_video.cpp" ]
266
267      deps += [
268        "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite",
269      ]
270    }
271
272    if (enable_graphic_font) {
273      deps += [ "//foundation/graphic/ui:utils_config" ]
274    }
275
276    ldflags = [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ]
277  }
278
279  public_deps = [ "//foundation/graphic/utils:lite_graphic_utils" ]
280  public_configs = [ ":graphic_define_config" ]
281  if (board_toolchain_type != "iccarm") {
282    cflags = [
283      "-Wall",
284      "-fno-exceptions",
285    ]
286    cflags_cc = cflags
287  } else {
288    defines = [ "ENABLE_ICU=1" ]
289    include_dirs +=
290        [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
291  }
292}
293