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("utils_lite") {
27  features = [ ":graphic_utils_lite" ]
28  public_deps = features
29}
30
31ndk_lib("graphic_utils_lite_ndk") {
32  lib_extension = ".so"
33  deps = [ ":graphic_utils_lite" ]
34  head_files = [ "interfaces/kits" ]
35}
36
37lite_library("graphic_utils_lite") {
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/common/paint.cpp",
60    "frameworks/diagram/depiction/depict_curve.cpp",
61    "frameworks/diagram/rasterizer/rasterizer_cells_antialias.cpp",
62    "frameworks/diagram/rasterizer/rasterizer_scanline_antialias.cpp",
63    "frameworks/diagram/rasterizer/rasterizer_scanline_clip.cpp",
64    "frameworks/diagram/vertexgenerate/vertex_generate_dash.cpp",
65    "frameworks/diagram/vertexgenerate/vertex_generate_stroke.cpp",
66    "frameworks/diagram/vertexprimitive/geometry_arc.cpp",
67    "frameworks/diagram/vertexprimitive/geometry_bezier_arc.cpp",
68    "frameworks/diagram/vertexprimitive/geometry_curves.cpp",
69    "frameworks/diagram/vertexprimitive/geometry_shorten_path.cpp",
70    "frameworks/geometry2d.cpp",
71    "frameworks/graphic_math.cpp",
72    "frameworks/graphic_performance.cpp",
73    "frameworks/graphic_timer.cpp",
74    "frameworks/hal_cpu.cpp",
75    "frameworks/hal_tick.cpp",
76    "frameworks/mem_api.cpp",
77    "frameworks/pixel_format_utils.cpp",
78    "frameworks/style.cpp",
79    "frameworks/trans_affine.cpp",
80    "frameworks/transform.cpp",
81    "frameworks/version.cpp",
82  ]
83  public_configs = [ ":graphic_utils_public_config" ]
84  if (ohos_kernel_type == "liteos_m") {
85    deps = [ "//third_party/bounds_checking_function:libsec_static" ]
86    public_deps =
87        [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static" ]
88  } else {
89    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
90    public_deps =
91        [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ]
92  }
93}
94
95config("graphic_utils_public_config") {
96  include_dirs = [
97    "interfaces/innerkits",
98    "interfaces/kits",
99    "$product_path/graphic_config",
100  ]
101
102  defines += [
103    "GRAPHIC_ENABLE_LINECAP_FLAG=1",
104    "GRAPHIC_ENABLE_LINEJOIN_FLAG=1",
105    "GRAPHIC_ENABLE_ELLIPSE_FLAG=1",
106    "GRAPHIC_ENABLE_BEZIER_ARC_FLAG=1",
107    "GRAPHIC_ENABLE_ARC_FLAG=1",
108    "GRAPHIC_ENABLE_ROUNDEDRECT_FLAG=1",
109    "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1",
110    "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1",
111    "GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG=1",
112    "GRAPHIC_ENABLE_GRADIENT_FILL_FLAG=1",
113    "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1",
114    "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1",
115    "GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1",
116  ]
117}
118
119if (ohos_kernel_type != "liteos_m") {
120  lite_component("lite_graphic_hals") {
121    features = [ ":graphic_hals" ]
122    public_deps = features
123  }
124
125  ndk_lib("lite_graphic_hals_ndk") {
126    lib_extension = ".so"
127    deps = [ ":graphic_hals" ]
128    head_files = []
129  }
130
131  shared_library("graphic_hals") {
132    sources = [
133      "frameworks/hals/gfx_engines.cpp",
134      "frameworks/hals/hi_fbdev.cpp",
135    ]
136    include_dirs =
137        [ "//foundation/window/window_manager_lite/interfaces/innerkits" ]
138    deps = [
139      ":utils_lite",
140      "//drivers/peripheral/display/hal:hdi_display",
141    ]
142    public_configs = [ ":graphic_hals_public_config" ]
143    ldflags = [
144      "-ldisplay_gfx",
145      "-ldisplay_gralloc",
146      "-ldisplay_layer",
147    ]
148  }
149}
150
151config("graphic_hals_public_config") {
152  include_dirs = [
153    "interfaces/innerkits",
154    "//drivers/peripheral/base",
155    "//drivers/peripheral/display/interfaces/include",
156    "$product_path/graphic_config",
157  ]
158}
159