132a6e48fSopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd.
232a6e48fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
332a6e48fSopenharmony_ci# you may not use this file except in compliance with the License.
432a6e48fSopenharmony_ci# You may obtain a copy of the License at
532a6e48fSopenharmony_ci#
632a6e48fSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
732a6e48fSopenharmony_ci#
832a6e48fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
932a6e48fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1032a6e48fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1132a6e48fSopenharmony_ci# See the License for the specific language governing permissions and
1232a6e48fSopenharmony_ci# limitations under the License.
1332a6e48fSopenharmony_ci
1432a6e48fSopenharmony_ciimport("//build/ohos.gni")
1532a6e48fSopenharmony_ciimport("//foundation/graphic/graphic_surface/graphic_surface_config.gni")
1632a6e48fSopenharmony_ci
1732a6e48fSopenharmony_ciif (graphic_2d_ext_delegator && graphic_2d_ext_delegator_gni != "") {
1832a6e48fSopenharmony_ci  import("${graphic_2d_ext_delegator_gni}")
1932a6e48fSopenharmony_ci}
2032a6e48fSopenharmony_ci
2132a6e48fSopenharmony_ci## Build surface.so {{{
2232a6e48fSopenharmony_ciconfig("surface_config") {
2332a6e48fSopenharmony_ci  visibility = [ ":*" ]
2432a6e48fSopenharmony_ci
2532a6e48fSopenharmony_ci  include_dirs = [ "include" ]
2632a6e48fSopenharmony_ci
2732a6e48fSopenharmony_ci  if (graphic_2d_ext_delegator && defined(vendor_root)) {
2832a6e48fSopenharmony_ci    include_dirs += libsurface_ext_delegator_include_dirs
2932a6e48fSopenharmony_ci  }
3032a6e48fSopenharmony_ci
3132a6e48fSopenharmony_ci  cflags = [
3232a6e48fSopenharmony_ci    "-Wall",
3332a6e48fSopenharmony_ci    "-Werror",
3432a6e48fSopenharmony_ci    "-g3",
3532a6e48fSopenharmony_ci  ]
3632a6e48fSopenharmony_ci}
3732a6e48fSopenharmony_ci
3832a6e48fSopenharmony_ciconfig("surface_public_config") {
3932a6e48fSopenharmony_ci  include_dirs = [
4032a6e48fSopenharmony_ci    "$graphic_surface_root/utils/frame_report/export",
4132a6e48fSopenharmony_ci    "$graphic_surface_root/surface/include",
4232a6e48fSopenharmony_ci    "$graphic_surface_root/interfaces/inner_api",
4332a6e48fSopenharmony_ci    "$graphic_surface_root/interfaces/inner_api/surface",
4432a6e48fSopenharmony_ci    "$graphic_surface_root/interfaces/inner_api/common",
4532a6e48fSopenharmony_ci    "$graphic_surface_root/interfaces/inner_api/utils",
4632a6e48fSopenharmony_ci    "$graphic_surface_root/sandbox",
4732a6e48fSopenharmony_ci    "$graphic_surface_root/utils/rs_frame_report_ext/include",
4832a6e48fSopenharmony_ci    "$graphic_surface_root/utils/trace",
4932a6e48fSopenharmony_ci  ]
5032a6e48fSopenharmony_ci
5132a6e48fSopenharmony_ci  cflags = [ "-Wno-error=deprecated-declarations" ]
5232a6e48fSopenharmony_ci}
5332a6e48fSopenharmony_ci
5432a6e48fSopenharmony_ciconfig("surface_headers_config") {
5532a6e48fSopenharmony_ci  include_dirs = [ "$graphic_surface_root/interfaces/inner_api/surface" ]
5632a6e48fSopenharmony_ci}
5732a6e48fSopenharmony_ci
5832a6e48fSopenharmony_ciohos_static_library("surface_headers") {
5932a6e48fSopenharmony_ci  public_configs = [ ":surface_headers_config" ]
6032a6e48fSopenharmony_ci  part_name = "graphic_surface"
6132a6e48fSopenharmony_ci  subsystem_name = "graphic"
6232a6e48fSopenharmony_ci}
6332a6e48fSopenharmony_ci
6432a6e48fSopenharmony_ciohos_shared_library("surface") {
6532a6e48fSopenharmony_ci  sanitize = {
6632a6e48fSopenharmony_ci    boundary_sanitize = true
6732a6e48fSopenharmony_ci    integer_overflow = true
6832a6e48fSopenharmony_ci    ubsan = true
6932a6e48fSopenharmony_ci  }
7032a6e48fSopenharmony_ci  sources = [
7132a6e48fSopenharmony_ci    "src/buffer_client_producer.cpp",
7232a6e48fSopenharmony_ci    "src/buffer_extra_data_impl.cpp",
7332a6e48fSopenharmony_ci    "src/buffer_queue.cpp",
7432a6e48fSopenharmony_ci    "src/buffer_queue_consumer.cpp",
7532a6e48fSopenharmony_ci    "src/buffer_queue_producer.cpp",
7632a6e48fSopenharmony_ci    "src/buffer_utils.cpp",
7732a6e48fSopenharmony_ci    "src/consumer_surface.cpp",
7832a6e48fSopenharmony_ci    "src/consumer_surface_delegator.cpp",
7932a6e48fSopenharmony_ci    "src/metadata_helper.cpp",
8032a6e48fSopenharmony_ci    "src/native_buffer.cpp",
8132a6e48fSopenharmony_ci    "src/native_window.cpp",
8232a6e48fSopenharmony_ci    "src/producer_surface.cpp",
8332a6e48fSopenharmony_ci    "src/producer_surface_delegator.cpp",
8432a6e48fSopenharmony_ci    "src/surface_buffer_impl.cpp",
8532a6e48fSopenharmony_ci    "src/surface_delegate.cpp",
8632a6e48fSopenharmony_ci    "src/surface_tunnel_handle.cpp",
8732a6e48fSopenharmony_ci    "src/surface_utils.cpp",
8832a6e48fSopenharmony_ci    "src/transact_surface_delegator_proxy.cpp",
8932a6e48fSopenharmony_ci    "src/transact_surface_delegator_stub.cpp",
9032a6e48fSopenharmony_ci  ]
9132a6e48fSopenharmony_ci
9232a6e48fSopenharmony_ci  configs = [ ":surface_config" ]
9332a6e48fSopenharmony_ci
9432a6e48fSopenharmony_ci  public_configs = [ ":surface_public_config" ]
9532a6e48fSopenharmony_ci
9632a6e48fSopenharmony_ci  deps = [
9732a6e48fSopenharmony_ci    "$graphic_surface_root/buffer_handle:buffer_handle",
9832a6e48fSopenharmony_ci    "$graphic_surface_root/sandbox:sandbox_utils",
9932a6e48fSopenharmony_ci    "$graphic_surface_root/sync_fence:sync_fence",
10032a6e48fSopenharmony_ci    "$graphic_surface_root/utils/frame_report:frame_report",
10132a6e48fSopenharmony_ci    "$graphic_surface_root/utils/hebc_white_list:hebc_white_list",
10232a6e48fSopenharmony_ci    "$graphic_surface_root/utils/rs_frame_report_ext:rs_frame_report_ext_surface",
10332a6e48fSopenharmony_ci  ]
10432a6e48fSopenharmony_ci
10532a6e48fSopenharmony_ci  external_deps = [
10632a6e48fSopenharmony_ci    "c_utils:utils",
10732a6e48fSopenharmony_ci    "drivers_interface_display:libdisplay_buffer_hdi_impl_v1_2",
10832a6e48fSopenharmony_ci    "drivers_interface_display:libdisplay_buffer_proxy_1.0",
10932a6e48fSopenharmony_ci    "drivers_interface_display:libdisplay_commontype_proxy_1.0",
11032a6e48fSopenharmony_ci    "drivers_interface_display:libdisplay_commontype_proxy_1.1",
11132a6e48fSopenharmony_ci    "drivers_interface_display:libdisplay_commontype_proxy_2.0",
11232a6e48fSopenharmony_ci    "eventhandler:libeventhandler",
11332a6e48fSopenharmony_ci    "hilog:libhilog",
11432a6e48fSopenharmony_ci    "hitrace:hitrace_meter",
11532a6e48fSopenharmony_ci    "init:libbegetutil",
11632a6e48fSopenharmony_ci    "ipc:ipc_capi",
11732a6e48fSopenharmony_ci    "ipc:ipc_single",
11832a6e48fSopenharmony_ci  ]
11932a6e48fSopenharmony_ci
12032a6e48fSopenharmony_ci  symlink_target_name = [
12132a6e48fSopenharmony_ci    "libnative_buffer.so",
12232a6e48fSopenharmony_ci    "libnative_window.so",
12332a6e48fSopenharmony_ci  ]
12432a6e48fSopenharmony_ci
12532a6e48fSopenharmony_ci  if (graphic_2d_ext_delegator && defined(vendor_root)) {
12632a6e48fSopenharmony_ci    sources += libsurface_ext_delegator_sources
12732a6e48fSopenharmony_ci    sources -= libsurface_ext_delegator_sources_del
12832a6e48fSopenharmony_ci    external_deps += libsurface_ext_delegator_external_deps
12932a6e48fSopenharmony_ci  }
13032a6e48fSopenharmony_ci
13132a6e48fSopenharmony_ci  innerapi_tags = [
13232a6e48fSopenharmony_ci    "chipsetsdk",
13332a6e48fSopenharmony_ci    "platformsdk",
13432a6e48fSopenharmony_ci  ]
13532a6e48fSopenharmony_ci
13632a6e48fSopenharmony_ci  part_name = "graphic_surface"
13732a6e48fSopenharmony_ci  subsystem_name = "graphic"
13832a6e48fSopenharmony_ci}
13932a6e48fSopenharmony_ci
14032a6e48fSopenharmony_ci## Build surface.so }}}
14132a6e48fSopenharmony_ci
142