1# Copyright (c) 2023 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.
13import("//build/ohos.gni")
14import("//foundation/graphic/graphic_2d/graphic_config.gni")
15
16## Build libvulkan_swapchain.so {{{
17config("vulkan_config") {
18  defines = [
19    "VK_USE_PLATFORM_OHOS",
20    "VK_NO_PROTOTYPES",
21  ]
22  if (graphic_2d_feature_use_aps_igameservice_func) {
23    defines += [ "USE_APS_IGAMESERVICE_FUNC=1" ]
24  } else {
25    defines += [ "USE_APS_IGAMESERVICE_FUNC=0" ]
26  }
27
28  cflags = [
29    "-fvisibility=hidden",
30    "-Wall",
31    "-Werror",
32    "-g3",
33  ]
34}
35
36config("vulkan_public_config") {
37  include_dirs = [
38    "swapchain",
39    "include",
40  ]
41  if (graphic_2d_feature_use_aps_igameservice_func) {
42    include_dirs += gameservice_render_slice_report_include_dirs
43  }
44}
45
46ohos_shared_library("vulkan_swapchain_layer") {
47  sources = [ "swapchain_layer/swapchain_layer.cpp" ]
48  if (graphic_2d_feature_use_aps_igameservice_func) {
49    sources += gameservice_render_slice_report_sources
50  }
51
52  configs = [ ":vulkan_config" ]
53
54  public_configs = [ ":vulkan_public_config" ]
55
56  deps = [ "$graphic_2d_root/utils:scoped_bytrace" ]
57
58  external_deps = [
59    "c_utils:utils",
60    "graphic_surface:surface",
61    "graphic_surface:sync_fence",
62    "hilog:libhilog",
63    "vulkan-headers:vulkan_headers",
64    "vulkan-loader:vulkan_loader",
65  ]
66  if (graphic_2d_feature_use_aps_igameservice_func) {
67    external_deps += gameservice_render_slice_report_external_deps
68  }
69
70  output_name = "vulkan_swapchain"
71  output_extension = "so"
72
73  part_name = "graphic_2d"
74  subsystem_name = "graphic"
75}
76
77## Build libvulkan_swapchain.so }}}
78
79## Build VkLayer_swapchain.json {{{
80ohos_prebuilt_etc("vulkan_swapchain_layer_json") {
81  source = "swapchain_layer/VkLayer_swapchain.json"
82  part_name = "graphic_2d"
83  subsystem_name = "graphic"
84  module_install_dir = "etc/vulkan/swapchain/vulkan/implicit_layer.d"
85}
86## Build VkLayer_swapchain.json }}}
87