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# https://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") 15 16# Vulkan loader build options 17 18## Build libvulkan.so {{{ 19 20config("vulkan_internal_config") { 21 defines = [ 22 "VULKAN_NON_CMAKE_BUILD", 23 "VK_ENABLE_BETA_EXTENSIONS", 24 ] 25 cflags = [ 26 "-Wno-conversion", 27 "-Wno-extra-semi", 28 "-Wno-implicit-fallthrough", 29 "-Wno-sign-compare", 30 "-Wno-unreachable-code", 31 "-Wno-unused-function", 32 "-Wno-unused-variable", 33 "-fPIC", 34 ] 35 ldflags = [ "-Wl,-Bsymbolic" ] 36 37 defines += [ 38 "SYSCONFDIR=\"/system/etc\"", 39 "FALLBACK_CONFIG_DIRS=\"/vendor/etc\"", 40 "FALLBACK_DATA_DIRS=\"/data\"", 41 "VK_USE_PLATFORM_OHOS", 42 ] 43} 44 45config("vulkan_loader_config") { 46 include_dirs = [ 47 "loader/generated", 48 "loader", 49 "openharmony", 50 ] 51 defines = [ 52 "API_NAME=\"Vulkan\"", 53 "USE_UNSAFE_FILE_SEARCH=1", 54 ] 55} 56 57ohos_shared_library("vulkan_loader") { 58 sources = [ 59 "loader/adapters.h", 60 "loader/allocation.c", 61 "loader/allocation.h", 62 "loader/asm_offset.c", 63 "loader/cJSON.c", 64 "loader/cJSON.h", 65 "loader/debug_utils.c", 66 "loader/debug_utils.h", 67 "loader/dev_ext_trampoline.c", 68 "loader/extension_manual.c", 69 "loader/extension_manual.h", 70 "loader/generated/vk_layer_dispatch_table.h", 71 "loader/generated/vk_loader_extensions.h", 72 "loader/generated/vk_object_types.h", 73 "loader/get_environment.c", 74 "loader/get_environment.h", 75 "loader/gpa_helper.c", 76 "loader/gpa_helper.h", 77 "loader/loader.c", 78 "loader/loader.h", 79 "loader/loader_common.h", 80 "loader/log.c", 81 "loader/log.h", 82 "loader/phys_dev_ext.c", 83 "loader/stack_allocation.h", 84 "loader/terminator.c", 85 "loader/trampoline.c", 86 "loader/unknown_function_handling.c", 87 "loader/unknown_function_handling.h", 88 "loader/vk_loader_layer.h", 89 90 # TODO(jmadill): Use assembler where available. 91 "loader/unknown_ext_chain.c", 92 "loader/vk_loader_platform.h", 93 "loader/wsi.c", 94 "loader/wsi.h", 95 ] 96 97 configs = [ ":vulkan_internal_config" ] 98 public_configs = [ ":vulkan_loader_config" ] 99 external_deps = [ 100 "hilog:libhilog", 101 "vulkan-headers:vulkan_headers", 102 ] 103 104 output_name = "vulkan" 105 output_extension = "so" 106 107 part_name = "graphic_2d" 108 subsystem_name = "graphic" 109 110 license_file = "//third_party/vulkan-loader/LICENSE.txt" 111} 112## Build libvulkan.so }}} 113