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