1# Copyright (C) 2018-2019 The ANGLE Project Authors.
2# Copyright (C) 2019-2023 LunarG, Inc.
3# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import("//build/ohos.gni")
17
18group("vulkan_loader_test") {
19  testonly = true
20
21  public_deps = [ "openharmony/test:test" ]
22}
23
24# Vulkan loader build options
25
26## Build libvulkan.so {{{
27
28config("vulkan_internal_config") {
29  defines = [ "VK_ENABLE_BETA_EXTENSIONS" ]
30  cflags = [
31    "-Wno-conversion",
32    "-Wno-extra-semi",
33    "-Wno-sign-compare",
34    "-Wno-unreachable-code",
35    "-Wno-unused-function",
36    "-Wno-unused-variable",
37    "-fPIC",
38  ]
39  cflags_cc = [ "-std=c++17" ]
40  ldflags = [ "-Wl,-Bsymbolic" ]
41
42  defines += [
43    "SYSCONFDIR=\"/system/etc:/vendor/etc\"",
44    "VK_USE_PLATFORM_OHOS",
45  ]
46}
47
48config("vulkan_loader_config") {
49  include_dirs = [
50    "loader/generated",
51    "loader",
52    "openharmony",
53  ]
54  defines = [ "LOADER_USE_UNSAFE_FILE_SEARCH=1" ]
55}
56
57ohos_shared_library("vulkan_loader") {
58  sources = [
59    "loader/adapters.h",
60    "loader/allocation.c",
61    "loader/allocation.h",
62    "loader/cJSON.c",
63    "loader/cJSON.h",
64    "loader/debug_utils.c",
65    "loader/debug_utils.h",
66    "loader/dev_ext_trampoline.c",
67    "loader/extension_manual.c",
68    "loader/extension_manual.h",
69    "loader/generated/vk_layer_dispatch_table.h",
70    "loader/generated/vk_loader_extensions.h",
71    "loader/generated/vk_object_types.h",
72    "loader/gpa_helper.c",
73    "loader/gpa_helper.h",
74    "loader/loader.c",
75    "loader/loader.h",
76    "loader/loader_common.h",
77    "loader/loader_environment.c",
78    "loader/loader_environment.h",
79    "loader/log.c",
80    "loader/log.h",
81    "loader/phys_dev_ext.c",
82    "loader/settings.c",
83    "loader/settings.h",
84    "loader/stack_allocation.h",
85    "loader/terminator.c",
86    "loader/trampoline.c",
87    "loader/unknown_function_handling.c",
88    "loader/unknown_function_handling.h",
89    "loader/vk_loader_layer.h",
90
91    # TODO(jmadill): Use assembler where available.
92    "loader/unknown_ext_chain.c",
93    "loader/vk_loader_platform.h",
94    "loader/wsi.c",
95    "loader/wsi.h",
96    "openharmony/bundle_mgr_helper/vk_bundle_mgr_helper.cpp",
97    "openharmony/bundle_mgr_helper/vk_bundle_mgr_helper.h",
98    "openharmony/loader_hilog.h",
99  ]
100
101  configs = [ ":vulkan_internal_config" ]
102  public_configs = [ ":vulkan_loader_config" ]
103  external_deps = [
104    "bundle_framework:appexecfwk_base",
105    "bundle_framework:appexecfwk_core",
106    "c_utils:utils",
107    "hilog:libhilog",
108    "init:libbegetutil",
109    "ipc:ipc_core",
110    "samgr:samgr_proxy",
111  ]
112  public_external_deps = [ "vulkan-headers:vulkan_headers" ]
113
114  output_name = "vulkan"
115  output_extension = "so"
116
117  part_name = "vulkan-loader"
118  subsystem_name = "thirdparty"
119
120  license_file = "//third_party/vulkan-loader/LICENSE.txt"
121}
122## Build libvulkan.so }}}
123