1# Copyright (c) 2020-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# 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 if (ohos_kernel_type != "liteos_m") { 33 defines = [ 34 "ENABLE_VECTOR_FONT=1", 35 "ENABLE_BITMAP_FONT=0", 36 "ENABLE_SHAPING=0", 37 "ENABLE_ICU=1", 38 "ENABLE_MULTI_FONT=0", 39 "DEFAULT_ANIMATION=1", 40 ] 41 42 if (ohos_kernel_type == "linux") { 43 defines += [ "RESOURCE_DIR=\"/storage/data/\"" ] 44 } else { 45 defines += [ "RESOURCE_DIR=\"/user/data/\"" ] 46 } 47 } 48} 49 50if (enable_graphic_font) { 51 copy("utils_config") { 52 sources = [ 53 "tools/qt/simulator/font/SourceHanSansSC-Regular.otf", 54 "tools/qt/simulator/font/line_cj.brk", 55 ] 56 outputs = [ "$root_out_dir/data/{{source_file_part}}" ] 57 } 58} 59 60lite_library("ui") { 61 sources = [ 62 "frameworks/animator/animator.cpp", 63 "frameworks/animator/animator_manager.cpp", 64 "frameworks/animator/easing_equation.cpp", 65 "frameworks/animator/interpolation.cpp", 66 "frameworks/common/graphic_startup.cpp", 67 "frameworks/common/image.cpp", 68 "frameworks/common/image_decode_ability.cpp", 69 "frameworks/common/input_device_manager.cpp", 70 "frameworks/common/screen.cpp", 71 "frameworks/common/task.cpp", 72 "frameworks/common/text.cpp", 73 "frameworks/common/typed_text.cpp", 74 "frameworks/components/root_view.cpp", 75 "frameworks/components/text_adapter.cpp", 76 "frameworks/components/ui_abstract_clock.cpp", 77 "frameworks/components/ui_abstract_progress.cpp", 78 "frameworks/components/ui_abstract_scroll.cpp", 79 "frameworks/components/ui_abstract_scroll_bar.cpp", 80 "frameworks/components/ui_analog_clock.cpp", 81 "frameworks/components/ui_arc_label.cpp", 82 "frameworks/components/ui_arc_scroll_bar.cpp", 83 "frameworks/components/ui_axis.cpp", 84 "frameworks/components/ui_box_progress.cpp", 85 "frameworks/components/ui_box_scroll_bar.cpp", 86 "frameworks/components/ui_button.cpp", 87 "frameworks/components/ui_canvas.cpp", 88 "frameworks/components/ui_chart.cpp", 89 "frameworks/components/ui_checkbox.cpp", 90 "frameworks/components/ui_circle_progress.cpp", 91 "frameworks/components/ui_dialog.cpp", 92 "frameworks/components/ui_digital_clock.cpp", 93 "frameworks/components/ui_image_animator.cpp", 94 "frameworks/components/ui_image_view.cpp", 95 "frameworks/components/ui_label.cpp", 96 "frameworks/components/ui_label_button.cpp", 97 "frameworks/components/ui_list.cpp", 98 "frameworks/components/ui_picker.cpp", 99 "frameworks/components/ui_qrcode.cpp", 100 "frameworks/components/ui_radio_button.cpp", 101 "frameworks/components/ui_repeat_button.cpp", 102 "frameworks/components/ui_scroll_view.cpp", 103 "frameworks/components/ui_slider.cpp", 104 "frameworks/components/ui_surface_view.cpp", 105 "frameworks/components/ui_swipe_view.cpp", 106 "frameworks/components/ui_texture_mapper.cpp", 107 "frameworks/components/ui_time_picker.cpp", 108 "frameworks/components/ui_toggle_button.cpp", 109 "frameworks/components/ui_view.cpp", 110 "frameworks/components/ui_view_group.cpp", 111 "frameworks/core/render_manager.cpp", 112 "frameworks/core/task_manager.cpp", 113 "frameworks/default_resource/check_box_res.cpp", 114 "frameworks/dfx/event_injector.cpp", 115 "frameworks/dfx/key_event_injector.cpp", 116 "frameworks/dfx/performance_task.cpp", 117 "frameworks/dfx/point_event_injector.cpp", 118 "frameworks/dfx/ui_dump_dom_tree.cpp", 119 "frameworks/dfx/ui_screenshot.cpp", 120 "frameworks/dfx/ui_view_bounds.cpp", 121 "frameworks/dock/focus_manager.cpp", 122 "frameworks/dock/input_device.cpp", 123 "frameworks/dock/key_input_device.cpp", 124 "frameworks/dock/ohos/ohos_input_device.cpp", 125 "frameworks/dock/pointer_input_device.cpp", 126 "frameworks/dock/rotate_input_device.cpp", 127 "frameworks/dock/screen_device_proxy.cpp", 128 "frameworks/dock/vibrator_manager.cpp", 129 "frameworks/dock/virtual_input_device.cpp", 130 "frameworks/draw/clip_utils.cpp", 131 "frameworks/draw/draw_arc.cpp", 132 "frameworks/draw/draw_curve.cpp", 133 "frameworks/draw/draw_image.cpp", 134 "frameworks/draw/draw_label.cpp", 135 "frameworks/draw/draw_line.cpp", 136 "frameworks/draw/draw_rect.cpp", 137 "frameworks/draw/draw_triangle.cpp", 138 "frameworks/draw/draw_utils.cpp", 139 "frameworks/engines/gfx/gfx_engine_manager.cpp", 140 "frameworks/engines/gfx/hi3516/hi3516_engine.cpp", 141 "frameworks/events/event.cpp", 142 "frameworks/font/base_font.cpp", 143 "frameworks/font/glyphs_manager.cpp", 144 "frameworks/font/ui_font.cpp", 145 "frameworks/font/ui_font_adaptor.cpp", 146 "frameworks/font/ui_font_allocator.cpp", 147 "frameworks/font/ui_font_bitmap.cpp", 148 "frameworks/font/ui_font_builder.cpp", 149 "frameworks/font/ui_font_cache.cpp", 150 "frameworks/font/ui_font_vector.cpp", 151 "frameworks/font/ui_line_break.cpp", 152 "frameworks/font/ui_multi_font_manager.cpp", 153 "frameworks/font/ui_text_shaping.cpp", 154 "frameworks/imgdecode/cache_manager.cpp", 155 "frameworks/imgdecode/file_img_decoder.cpp", 156 "frameworks/imgdecode/image_load.cpp", 157 "frameworks/layout/flex_layout.cpp", 158 "frameworks/layout/grid_layout.cpp", 159 "frameworks/layout/list_layout.cpp", 160 "frameworks/themes/theme.cpp", 161 "frameworks/themes/theme_manager.cpp", 162 "frameworks/window/window.cpp", 163 "frameworks/window/window_impl.cpp", 164 ] 165 166 if (ohos_kernel_type == "liteos_m") { 167 target_type = "static_library" 168 include_dirs = [ 169 "frameworks", 170 "//third_party/freetype/include", 171 ] 172 sources -= [ 173 "frameworks/components/ui_surface_view.cpp", 174 "frameworks/dfx/ui_dump_dom_tree.cpp", 175 "frameworks/dfx/ui_screenshot.cpp", 176 "frameworks/engines/gfx/hi3516/hi3516_engine.cpp", 177 "frameworks/window/window.cpp", 178 "frameworks/window/window_impl.cpp", 179 ] 180 deps = [ 181 "//build/lite/config/component/cJSON:cjson_static", 182 "//third_party/bounds_checking_function:libsec_static", 183 "//third_party/freetype:freetype", 184 "//third_party/giflib:libgif", 185 "//third_party/libjpeg:libjpeg", 186 "//third_party/libpng:libpng", 187 "//third_party/qrcodegen:qrcodegen", 188 ] 189 } else { 190 target_type = "shared_library" 191 include_dirs = [ "frameworks" ] 192 deps = [ 193 "//build/lite/config/component/cJSON:cjson_shared", 194 "//foundation/graphic/surface:lite_surface", 195 "//foundation/graphic/utils:lite_graphic_hals", 196 "//foundation/graphic/wms:lite_wms", 197 "//third_party/bounds_checking_function:libsec_shared", 198 "//third_party/freetype:freetype", 199 "//third_party/giflib:libgif", 200 "//third_party/icu/icu4c/source/common:icu_font", 201 "//third_party/libjpeg:libjpeg", 202 "//third_party/libpng:libpng", 203 "//third_party/qrcodegen:qrcodegen", 204 ] 205 206 if (enable_video_component) { 207 defines += [ "ENABLE_VIDEO_COMPONENT=1" ] 208 source += [ "frameworks/components/ui_video.cpp" ] 209 210 deps += [ 211 "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite", 212 ] 213 } 214 215 if (enable_graphic_font) { 216 deps += [ "//foundation/graphic/ui:utils_config" ] 217 } 218 219 ldflags = [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ] 220 } 221 222 public_deps = [ "//foundation/graphic/utils:lite_graphic_utils" ] 223 public_configs = [ ":graphic_define_config" ] 224 cflags = [ 225 "-Wall", 226 "-fno-exceptions", 227 ] 228 cflags_cc = cflags 229} 230