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  cflags = [
28    "-Wall",
29    "-Werror",
30    "-g3",
31  ]
32}
33
34config("surface_public_config") {
35  include_dirs = [
36    "$graphic_surface_root/utils/frame_report/export",
37    "$graphic_surface_root/surface/include",
38    "$graphic_surface_root/interfaces/inner_api",
39    "$graphic_surface_root/interfaces/inner_api/surface",
40    "$graphic_surface_root/interfaces/inner_api/common",
41    "$graphic_surface_root/interfaces/inner_api/utils",
42    "$graphic_surface_root/sandbox",
43    "$graphic_surface_root/utils/rs_frame_report_ext/include",
44    "$graphic_surface_root/utils/trace",
45  ]
46
47  if (graphic_2d_ext_delegator && defined(vendor_root)) {
48    include_dirs += libsurface_ext_delegator_include_dirs
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/rs_frame_report_ext:rs_frame_report_ext_surface",
102  ]
103
104  external_deps = [
105    "c_utils:utils",
106    "drivers_interface_display:libdisplay_buffer_hdi_impl_v1_2",
107    "drivers_interface_display:libdisplay_buffer_proxy_1.0",
108    "drivers_interface_display:libdisplay_commontype_proxy_1.0",
109    "drivers_interface_display:libdisplay_commontype_proxy_1.1",
110    "eventhandler:libeventhandler",
111    "hilog:libhilog",
112    "hitrace:hitrace_meter",
113    "init:libbegetutil",
114    "ipc:ipc_capi",
115    "ipc:ipc_single",
116  ]
117
118  symlink_target_name = [
119    "libnative_buffer.so",
120    "libnative_window.so",
121  ]
122
123  if (graphic_2d_ext_delegator && defined(vendor_root)) {
124    sources += libsurface_ext_delegator_sources
125    sources -= libsurface_ext_delegator_sources_del
126    external_deps += libsurface_ext_delegator_external_deps
127  }
128
129  innerapi_tags = [
130    "chipsetsdk",
131    "platformsdk",
132  ]
133
134  part_name = "graphic_surface"
135  subsystem_name = "graphic"
136}
137
138## Build surface.so }}}
139
140