• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16defines = []
17
18declare_args() {
19  enable_ohos_graphic_utils_product_config = false
20}
21
22if (enable_ohos_graphic_utils_product_config) {
23  defines += [ "ENABLE_OHOS_GRAPHIC_UTILS_PRODUCT_CONFIG=1" ]
24}
25
26lite_component("lite_graphic_utils") {
27  features = [ ":graphic_utils" ]
28  public_deps = features
29}
30
31ndk_lib("lite_graphic_utils_ndk") {
32  lib_extension = ".so"
33  deps = [ ":graphic_utils" ]
34  head_files = [ "interfaces/kits" ]
35}
36
37lite_library("graphic_utils") {
38  if (ohos_kernel_type == "liteos_m") {
39    target_type = "static_library"
40  } else {
41    target_type = "shared_library"
42  }
43  include_dirs = [ "frameworks" ]
44  if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") {
45    include_dirs +=
46        [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
47    cflags = [
48      "--diag_suppress",
49      "Pe068,Pa089,Pa093,Pe161,Pe181,Pa205,Pe223",
50    ]
51    cflags_cc = cflags
52  }
53  if (enable_graphic_dualcore == true) {
54    defines += [ "HAL_CPU_NUM=2" ]
55  }
56
57  sources = [
58    "frameworks/color.cpp",
59    "frameworks/diagram/depiction/depict_curve.cpp",
60    "frameworks/diagram/rasterizer/rasterizer_cells_antialias.cpp",
61    "frameworks/diagram/rasterizer/rasterizer_scanline_antialias.cpp",
62    "frameworks/diagram/rasterizer/rasterizer_scanline_clip.cpp",
63    "frameworks/diagram/vertexgenerate/vertex_generate_dash.cpp",
64    "frameworks/diagram/vertexgenerate/vertex_generate_stroke.cpp",
65    "frameworks/diagram/vertexprimitive/geometry_arc.cpp",
66    "frameworks/diagram/vertexprimitive/geometry_bezier_arc.cpp",
67    "frameworks/diagram/vertexprimitive/geometry_curves.cpp",
68    "frameworks/diagram/vertexprimitive/geometry_shorten_path.cpp",
69    "frameworks/geometry2d.cpp",
70    "frameworks/graphic_math.cpp",
71    "frameworks/graphic_performance.cpp",
72    "frameworks/graphic_timer.cpp",
73    "frameworks/hal_cpu.cpp",
74    "frameworks/hal_tick.cpp",
75    "frameworks/mem_api.cpp",
76    "frameworks/pixel_format_utils.cpp",
77    "frameworks/style.cpp",
78    "frameworks/trans_affine.cpp",
79    "frameworks/transform.cpp",
80    "frameworks/version.cpp",
81  ]
82  public_configs = [ ":graphic_utils_public_config" ]
83  if (ohos_kernel_type == "liteos_m") {
84    deps = [ "//third_party/bounds_checking_function:libsec_static" ]
85    public_deps =
86        [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static" ]
87  } else {
88    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
89    public_deps =
90        [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ]
91  }
92}
93
94config("graphic_utils_public_config") {
95  include_dirs = [
96    "interfaces/innerkits",
97    "interfaces/kits",
98    "$product_path/graphic_config",
99  ]
100
101  defines += [
102    "GRAPHIC_ENABLE_LINECAP_FLAG=1",
103    "GRAPHIC_ENABLE_LINEJOIN_FLAG=1",
104    "GRAPHIC_ENABLE_ELLIPSE_FLAG=1",
105    "GRAPHIC_ENABLE_BEZIER_ARC_FLAG=1",
106    "GRAPHIC_ENABLE_ARC_FLAG=1",
107    "GRAPHIC_ENABLE_ROUNDEDRECT_FLAG=1",
108    "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
109    "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
110    "GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG=1",
111    "GRAPHIC_ENABLE_GRADIENT_FILL_FLAG=1",
112    "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
113    "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
114    "GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1",
115  ]
116}
117
118if (ohos_kernel_type != "liteos_m") {
119  lite_component("lite_graphic_hals") {
120    features = [ ":graphic_hals" ]
121    public_deps = features
122  }
123
124  ndk_lib("lite_graphic_hals_ndk") {
125    lib_extension = ".so"
126    deps = [ ":graphic_hals" ]
127    head_files = []
128  }
129
130  shared_library("graphic_hals") {
131    sources = [
132      "frameworks/hals/gfx_engines.cpp",
133      "frameworks/hals/hi_fbdev.cpp",
134    ]
135    include_dirs = [ "//foundation/graphic/wms/interfaces/innerkits" ]
136    deps = [
137      ":lite_graphic_utils",
138      "//drivers/peripheral/display/hal:hdi_display",
139    ]
140    public_configs = [ ":graphic_hals_public_config" ]
141    ldflags = [
142      "-ldisplay_gfx",
143      "-ldisplay_gralloc",
144      "-ldisplay_layer",
145    ]
146  }
147}
148
149config("graphic_hals_public_config") {
150  include_dirs = [
151    "interfaces/innerkits",
152    "//drivers/peripheral/base",
153    "//drivers/peripheral/display/interfaces/include",
154    "$product_path/graphic_config",
155  ]
156}
157