1# Copyright (c) 2024 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_surface/graphic_surface_config.gni")
16
17if (graphic_2d_ext_delegator && graphic_2d_ext_delegator_gni != "") {
18  import("${graphic_2d_ext_delegator_gni}")
19}
20
21## Build surface.so {{{
22config("surface_config") {
23  visibility = [ ":*" ]
24
25  include_dirs = [ "include" ]
26
27  if (graphic_2d_ext_delegator && defined(vendor_root)) {
28    include_dirs += libsurface_ext_delegator_include_dirs
29  }
30
31  cflags = [
32    "-Wall",
33    "-Werror",
34    "-g3",
35  ]
36}
37
38config("surface_public_config") {
39  include_dirs = [
40    "$graphic_surface_root/utils/frame_report/export",
41    "$graphic_surface_root/surface/include",
42    "$graphic_surface_root/interfaces/inner_api",
43    "$graphic_surface_root/interfaces/inner_api/surface",
44    "$graphic_surface_root/interfaces/inner_api/common",
45    "$graphic_surface_root/interfaces/inner_api/utils",
46    "$graphic_surface_root/sandbox",
47    "$graphic_surface_root/utils/rs_frame_report_ext/include",
48    "$graphic_surface_root/utils/trace",
49  ]
50
51  cflags = [ "-Wno-error=deprecated-declarations" ]
52}
53
54config("surface_headers_config") {
55  include_dirs = [ "$graphic_surface_root/interfaces/inner_api/surface" ]
56}
57
58ohos_static_library("surface_headers") {
59  public_configs = [ ":surface_headers_config" ]
60  part_name = "graphic_surface"
61  subsystem_name = "graphic"
62}
63
64ohos_shared_library("surface") {
65  sanitize = {
66    boundary_sanitize = true
67    integer_overflow = true
68    ubsan = true
69  }
70  sources = [
71    "src/buffer_client_producer.cpp",
72    "src/buffer_extra_data_impl.cpp",
73    "src/buffer_queue.cpp",
74    "src/buffer_queue_consumer.cpp",
75    "src/buffer_queue_producer.cpp",
76    "src/buffer_utils.cpp",
77    "src/consumer_surface.cpp",
78    "src/consumer_surface_delegator.cpp",
79    "src/metadata_helper.cpp",
80    "src/native_buffer.cpp",
81    "src/native_window.cpp",
82    "src/producer_surface.cpp",
83    "src/producer_surface_delegator.cpp",
84    "src/surface_buffer_impl.cpp",
85    "src/surface_delegate.cpp",
86    "src/surface_tunnel_handle.cpp",
87    "src/surface_utils.cpp",
88    "src/transact_surface_delegator_proxy.cpp",
89    "src/transact_surface_delegator_stub.cpp",
90  ]
91
92  configs = [ ":surface_config" ]
93
94  public_configs = [ ":surface_public_config" ]
95
96  deps = [
97    "$graphic_surface_root/buffer_handle:buffer_handle",
98    "$graphic_surface_root/sandbox:sandbox_utils",
99    "$graphic_surface_root/sync_fence:sync_fence",
100    "$graphic_surface_root/utils/frame_report:frame_report",
101    "$graphic_surface_root/utils/hebc_white_list:hebc_white_list",
102    "$graphic_surface_root/utils/rs_frame_report_ext:rs_frame_report_ext_surface",
103  ]
104
105  external_deps = [
106    "c_utils:utils",
107    "drivers_interface_display:libdisplay_buffer_hdi_impl_v1_2",
108    "drivers_interface_display:libdisplay_buffer_proxy_1.0",
109    "drivers_interface_display:libdisplay_commontype_proxy_1.0",
110    "drivers_interface_display:libdisplay_commontype_proxy_1.1",
111    "drivers_interface_display:libdisplay_commontype_proxy_2.0",
112    "eventhandler:libeventhandler",
113    "hilog:libhilog",
114    "hitrace:hitrace_meter",
115    "init:libbegetutil",
116    "ipc:ipc_capi",
117    "ipc:ipc_single",
118  ]
119
120  symlink_target_name = [
121    "libnative_buffer.so",
122    "libnative_window.so",
123  ]
124
125  if (graphic_2d_ext_delegator && defined(vendor_root)) {
126    sources += libsurface_ext_delegator_sources
127    sources -= libsurface_ext_delegator_sources_del
128    external_deps += libsurface_ext_delegator_external_deps
129  }
130
131  innerapi_tags = [
132    "chipsetsdk",
133    "platformsdk",
134  ]
135
136  part_name = "graphic_surface"
137  subsystem_name = "graphic"
138}
139
140## Build surface.so }}}
141
142