1# Copyright (c) 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#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//foundation/graphic/graphic_2d/graphic_config.gni")
16
17## Build libcomposer.so
18
19config("composer_config") {
20  visibility = [ ":*" ]
21
22  cflags = [
23    "-Wall",
24    "-Werror",
25    "-g3",
26  ]
27  if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
28    if (!use_libfuzzer) {
29      cflags += [ "-flto=thin" ]
30    }
31  }
32}
33
34config("composer_public_config") {
35  include_dirs = [
36    "$graphic_2d_root/rosen/include/common",
37    "$graphic_2d_root/interfaces/inner_api/common",
38    "$graphic_2d_root/rosen/modules/composer/hdi_backend/include",
39    "$graphic_2d_root/rosen/modules/composer/vsync/include",
40    "$graphic_2d_root/interfaces/inner_api/composer",
41  ]
42}
43
44ohos_shared_library("libcomposer") {
45  sanitize = {
46    boundary_sanitize = true
47    integer_overflow = true
48    ubsan = true
49  }
50  sources = [
51    "hdi_backend/src/hdi_backend.cpp",
52    "hdi_backend/src/hdi_device.cpp",
53    "hdi_backend/src/hdi_device_impl.cpp",
54    "hdi_backend/src/hdi_framebuffer_surface.cpp",
55    "hdi_backend/src/hdi_layer.cpp",
56    "hdi_backend/src/hdi_output.cpp",
57    "hdi_backend/src/hdi_screen.cpp",
58  ]
59
60  include_dirs = [ "$graphic_2d_root/utils/log" ]
61
62  configs = [ ":composer_config" ]
63
64  defines = []
65  defines += gpu_defines
66
67  public_configs = [ ":composer_public_config" ]
68
69  deps = [
70    "$graphic_2d_root/utils:scoped_bytrace",
71    "vsync:libvsync",
72  ]
73
74  public_external_deps = [
75    "c_utils:utils",
76    "graphic_surface:buffer_handle",
77    "graphic_surface:sync_fence",
78  ]
79
80  external_deps = [
81    "drivers_interface_display:libdisplay_buffer_proxy_1.0",
82    "drivers_interface_display:libdisplay_commontype_proxy_1.0",
83    "drivers_interface_display:libdisplay_composer_hdi_impl_1.1",
84    "drivers_interface_display:libdisplay_composer_hdi_impl_1.2",
85    "drivers_interface_display:libdisplay_composer_proxy_1.1",
86    "drivers_interface_display:libdisplay_composer_proxy_1.2",
87    "graphic_surface:surface",
88    "hilog:libhilog",
89    "hitrace:hitrace_meter",
90    "init:libbeget_proxy",
91    "init:libbegetutil",
92    "ipc:ipc_core",
93  ]
94
95  part_name = "graphic_2d"
96  subsystem_name = "graphic"
97}
98
99## Build libcomposer.so
100
101group("test") {
102  testonly = true
103
104  deps = [
105    "hdi_backend/test:test",
106    "vsync/test:test",
107  ]
108}
109