BUILD.gn 10.3 KB
Newer Older
1
# Copyright (c) 2020-2022 Huawei Device Co., Ltd.
M
mamingshuai 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build/lite/config/component/lite_component.gni")
import("//build/lite/config/subsystem/graphic/config.gni")
import("//build/lite/ndk/ndk.gni")

lite_component("lite_ui") {
  features = [ ":ui" ]
  public_deps = features
}

ndk_lib("lite_ui_ndk") {
  lib_extension = ".so"
  deps = [ ":ui" ]
  head_files = [ "interfaces/kits" ]
}

config("graphic_define_config") {
  include_dirs = [
    "interfaces/kits",
    "interfaces/innerkits",
  ]
32 33 34 35 36 37 38 39 40 41 42
  defines = [
    "GRAPHIC_ENABLE_ELLIPSE_FLAG=1",
    "GRAPHIC_ENABLE_BEZIER_ARC_FLAG=1",
    "GRAPHIC_ENABLE_LINECAP_FLAG=1",
    "GRAPHIC_ENABLE_LINEJOIN_FLAG=1",
    "GRAPHIC_ENABLE_ARC_FLAG=1",
    "GRAPHIC_ENABLE_ROUNDEDRECT_FLAG=1",
    "GRAPHIC_ENABLE_GRADIENT_FILL_FLAG=1",
    "GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG=1",
    "GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1",
  ]
43 44 45
  if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") {
    cflags = [
      "--diag_suppress",
46
      "Pa084,Pa093,Pa137,Pe161,Pe177,Pe186,Pe223,Pe226,Pe366,Pe367,Pe550,Pe940,Pe068",
47 48 49
    ]
    cflags_cc = cflags
  }
50
  if (ohos_kernel_type != "liteos_m") {
51
    defines += [
52 53 54 55 56 57 58 59 60 61 62 63
      "ENABLE_VECTOR_FONT=1",
      "ENABLE_BITMAP_FONT=0",
      "ENABLE_SHAPING=0",
      "ENABLE_ICU=1",
      "ENABLE_MULTI_FONT=0",
      "DEFAULT_ANIMATION=1",
    ]
    if (ohos_kernel_type == "linux") {
      defines += [ "RESOURCE_DIR=\"/storage/data/\"" ]
    } else {
      defines += [ "RESOURCE_DIR=\"/user/data/\"" ]
    }
M
mamingshuai 已提交
64
  }
65 66 67 68 69 70 71 72 73 74 75

  if (ohos_kernel_type == "liteos_a") {
    defines += [
      "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
      "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
      "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
      "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
    ]
  } else if (ohos_kernel_type == "liteos_m") {
    include_dirs += [ "//third_party/freetype/include" ]
    defines += [
76
      "ENABLE_CANVAS_EXTEND=0",
77 78 79 80 81 82 83 84 85 86 87 88 89
      "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
      "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
      "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
      "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
    ]
  } else {
    defines += [
      "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
      "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
      "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
      "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
    ]
  }
M
mamingshuai 已提交
90 91 92 93
}

if (enable_graphic_font) {
  copy("utils_config") {
W
wangtiantian 已提交
94 95 96 97 98
    sources = [
      "tools/qt/simulator/font/SourceHanSansSC-Regular.otf",
      "tools/qt/simulator/font/line_cj.brk",
    ]
    outputs = [ "$root_out_dir/data/{{source_file_part}}" ]
M
mamingshuai 已提交
99 100 101
  }
}

102
lite_library("ui") {
M
mamingshuai 已提交
103 104
  sources = [
    "frameworks/animator/animator.cpp",
P
pssea 已提交
105
    "frameworks/animator/animator_manager.cpp",
M
mamingshuai 已提交
106 107 108 109
    "frameworks/animator/easing_equation.cpp",
    "frameworks/animator/interpolation.cpp",
    "frameworks/common/graphic_startup.cpp",
    "frameworks/common/image.cpp",
110
    "frameworks/common/image_decode_ability.cpp",
M
mamingshuai 已提交
111 112
    "frameworks/common/input_device_manager.cpp",
    "frameworks/common/screen.cpp",
X
xucheng57@huawei.com 已提交
113
    "frameworks/common/spannable_string.cpp",
M
mamingshuai 已提交
114 115 116 117 118 119 120 121
    "frameworks/common/task.cpp",
    "frameworks/common/text.cpp",
    "frameworks/common/typed_text.cpp",
    "frameworks/components/root_view.cpp",
    "frameworks/components/text_adapter.cpp",
    "frameworks/components/ui_abstract_clock.cpp",
    "frameworks/components/ui_abstract_progress.cpp",
    "frameworks/components/ui_abstract_scroll.cpp",
Y
YueBiang 已提交
122
    "frameworks/components/ui_abstract_scroll_bar.cpp",
M
mamingshuai 已提交
123 124
    "frameworks/components/ui_analog_clock.cpp",
    "frameworks/components/ui_arc_label.cpp",
Y
YueBiang 已提交
125
    "frameworks/components/ui_arc_scroll_bar.cpp",
M
mamingshuai 已提交
126 127
    "frameworks/components/ui_axis.cpp",
    "frameworks/components/ui_box_progress.cpp",
Y
YueBiang 已提交
128
    "frameworks/components/ui_box_scroll_bar.cpp",
M
mamingshuai 已提交
129 130 131 132 133 134 135
    "frameworks/components/ui_button.cpp",
    "frameworks/components/ui_canvas.cpp",
    "frameworks/components/ui_chart.cpp",
    "frameworks/components/ui_checkbox.cpp",
    "frameworks/components/ui_circle_progress.cpp",
    "frameworks/components/ui_dialog.cpp",
    "frameworks/components/ui_digital_clock.cpp",
P
pssea 已提交
136
    "frameworks/components/ui_edit_text.cpp",
137
    "frameworks/components/ui_extend_image_view.cpp",
M
mamingshuai 已提交
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
    "frameworks/components/ui_image_animator.cpp",
    "frameworks/components/ui_image_view.cpp",
    "frameworks/components/ui_label.cpp",
    "frameworks/components/ui_label_button.cpp",
    "frameworks/components/ui_list.cpp",
    "frameworks/components/ui_picker.cpp",
    "frameworks/components/ui_qrcode.cpp",
    "frameworks/components/ui_radio_button.cpp",
    "frameworks/components/ui_repeat_button.cpp",
    "frameworks/components/ui_scroll_view.cpp",
    "frameworks/components/ui_slider.cpp",
    "frameworks/components/ui_surface_view.cpp",
    "frameworks/components/ui_swipe_view.cpp",
    "frameworks/components/ui_texture_mapper.cpp",
    "frameworks/components/ui_time_picker.cpp",
    "frameworks/components/ui_toggle_button.cpp",
154
    "frameworks/components/ui_tree_manager.cpp",
M
mamingshuai 已提交
155 156
    "frameworks/components/ui_view.cpp",
    "frameworks/components/ui_view_group.cpp",
P
pssea 已提交
157
    "frameworks/core/input_method_manager.cpp",
M
mamingshuai 已提交
158 159 160 161 162
    "frameworks/core/render_manager.cpp",
    "frameworks/core/task_manager.cpp",
    "frameworks/default_resource/check_box_res.cpp",
    "frameworks/dfx/event_injector.cpp",
    "frameworks/dfx/key_event_injector.cpp",
Z
zhdengc 已提交
163
    "frameworks/dfx/performance_task.cpp",
M
mamingshuai 已提交
164 165 166
    "frameworks/dfx/point_event_injector.cpp",
    "frameworks/dfx/ui_dump_dom_tree.cpp",
    "frameworks/dfx/ui_screenshot.cpp",
P
pssea 已提交
167
    "frameworks/dfx/ui_view_bounds.cpp",
S
suyue 已提交
168
    "frameworks/dock/focus_manager.cpp",
M
mamingshuai 已提交
169 170 171 172 173
    "frameworks/dock/input_device.cpp",
    "frameworks/dock/key_input_device.cpp",
    "frameworks/dock/ohos/ohos_input_device.cpp",
    "frameworks/dock/pointer_input_device.cpp",
    "frameworks/dock/rotate_input_device.cpp",
174
    "frameworks/dock/screen_device_proxy.cpp",
Z
zhdengc 已提交
175
    "frameworks/dock/vibrator_manager.cpp",
M
mamingshuai 已提交
176
    "frameworks/dock/virtual_input_device.cpp",
J
jsjzju 已提交
177
    "frameworks/draw/clip_utils.cpp",
M
mamingshuai 已提交
178
    "frameworks/draw/draw_arc.cpp",
179
    "frameworks/draw/draw_canvas.cpp",
M
mamingshuai 已提交
180 181 182 183 184 185 186
    "frameworks/draw/draw_curve.cpp",
    "frameworks/draw/draw_image.cpp",
    "frameworks/draw/draw_label.cpp",
    "frameworks/draw/draw_line.cpp",
    "frameworks/draw/draw_rect.cpp",
    "frameworks/draw/draw_triangle.cpp",
    "frameworks/draw/draw_utils.cpp",
187 188
    "frameworks/engines/gfx/gfx_engine_manager.cpp",
    "frameworks/engines/gfx/hi3516/hi3516_engine.cpp",
Z
Zhouyj_zju 已提交
189
    "frameworks/engines/gfx/soft_engine.cpp",
M
mamingshuai 已提交
190 191
    "frameworks/events/event.cpp",
    "frameworks/font/base_font.cpp",
192 193 194
    "frameworks/font/font_ram_allocator.cpp",
    "frameworks/font/glyphs_cache.cpp",
    "frameworks/font/glyphs_file.cpp",
M
mamingshuai 已提交
195 196 197 198
    "frameworks/font/glyphs_manager.cpp",
    "frameworks/font/ui_font.cpp",
    "frameworks/font/ui_font_adaptor.cpp",
    "frameworks/font/ui_font_allocator.cpp",
W
wangtiantian 已提交
199 200
    "frameworks/font/ui_font_bitmap.cpp",
    "frameworks/font/ui_font_builder.cpp",
M
mamingshuai 已提交
201
    "frameworks/font/ui_font_cache.cpp",
L
lancer 已提交
202
    "frameworks/font/ui_font_cache_manager.cpp",
M
mamingshuai 已提交
203 204 205 206 207 208 209 210 211 212
    "frameworks/font/ui_font_vector.cpp",
    "frameworks/font/ui_line_break.cpp",
    "frameworks/font/ui_multi_font_manager.cpp",
    "frameworks/font/ui_text_shaping.cpp",
    "frameworks/imgdecode/cache_manager.cpp",
    "frameworks/imgdecode/file_img_decoder.cpp",
    "frameworks/imgdecode/image_load.cpp",
    "frameworks/layout/flex_layout.cpp",
    "frameworks/layout/grid_layout.cpp",
    "frameworks/layout/list_layout.cpp",
213 214 215
    "frameworks/render/render_base.cpp",
    "frameworks/render/render_pixfmt_rgba_blend.cpp",
    "frameworks/render/render_scanline.cpp",
M
mamingshuai 已提交
216 217 218 219 220
    "frameworks/themes/theme.cpp",
    "frameworks/themes/theme_manager.cpp",
    "frameworks/window/window.cpp",
    "frameworks/window/window_impl.cpp",
  ]
N
niulihua 已提交
221

222 223 224 225 226
  if (ohos_kernel_type == "liteos_m") {
    target_type = "static_library"
    include_dirs = [
      "frameworks",
      "//third_party/freetype/include",
N
niulihua 已提交
227
    ]
228 229 230 231 232 233 234
    sources -= [
      "frameworks/components/ui_surface_view.cpp",
      "frameworks/dfx/ui_dump_dom_tree.cpp",
      "frameworks/dfx/ui_screenshot.cpp",
      "frameworks/engines/gfx/hi3516/hi3516_engine.cpp",
      "frameworks/window/window.cpp",
      "frameworks/window/window_impl.cpp",
N
niulihua 已提交
235
    ]
236 237 238 239 240
    deps = [
      "//build/lite/config/component/cJSON:cjson_static",
      "//third_party/bounds_checking_function:libsec_static",
      "//third_party/freetype:freetype",
      "//third_party/giflib:libgif",
241
      "//third_party/icu/icu4c/source/common:icu_font",
242
      "//third_party/libjpeg-turbo:libjpeg",
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
      "//third_party/libpng:libpng",
      "//third_party/qrcodegen:qrcodegen",
    ]
  } else {
    target_type = "shared_library"
    include_dirs = [ "frameworks" ]
    deps = [
      "//build/lite/config/component/cJSON:cjson_shared",
      "//foundation/graphic/surface:lite_surface",
      "//foundation/graphic/utils:lite_graphic_hals",
      "//foundation/graphic/wms:lite_wms",
      "//third_party/bounds_checking_function:libsec_shared",
      "//third_party/freetype:freetype",
      "//third_party/giflib:libgif",
      "//third_party/icu/icu4c/source/common:icu_font",
258
      "//third_party/libjpeg-turbo:libjpeg",
259 260 261 262 263 264 265 266 267 268 269 270 271
      "//third_party/libpng:libpng",
      "//third_party/qrcodegen:qrcodegen",
    ]

    if (enable_video_component) {
      defines += [ "ENABLE_VIDEO_COMPONENT=1" ]
      source += [ "frameworks/components/ui_video.cpp" ]

      deps += [
        "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite",
      ]
    }

272 273 274 275
    if (enable_graphic_font) {
      deps += [ "//foundation/graphic/ui:utils_config" ]
    }

276
    ldflags = [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ]
N
niulihua 已提交
277 278
  }

M
mamingshuai 已提交
279 280
  public_deps = [ "//foundation/graphic/utils:lite_graphic_utils" ]
  public_configs = [ ":graphic_define_config" ]
281 282 283 284 285 286 287
  if (board_toolchain_type != "iccarm") {
    cflags = [
      "-Wall",
      "-fno-exceptions",
    ]
    cflags_cc = cflags
  } else {
288
    defines = [ "ENABLE_ICU=1" ]
289 290
    include_dirs +=
        [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
291
  }
M
mamingshuai 已提交
292
}