| # Copyright 2017 The Fuchsia Authors |
| # |
| # Permission is hereby granted, free of charge, to any person obtaining a |
| # copy of this software and associated documentation files (the "Software"), |
| # to deal in the Software without restriction, including without limitation |
| # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| # and/or sell copies of the Software, and to permit persons to whom the |
| # Software is furnished to do so, subject to the following conditions: |
| # |
| # The above copyright notice and this permission notice (including the next |
| # paragraph) shall be included in all copies or substantial portions of the |
| # Software. |
| # |
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| # IN THE SOFTWARE. |
| |
| import("//build/cpp/sdk_shared_library.gni") |
| import("//build/package.gni") |
| |
| declare_args() { |
| vk_loader_debug = "warn,error" |
| } |
| |
| package("vulkan_loader") { |
| deprecated_system_image = true |
| |
| deps = [ |
| ":loader", |
| ] |
| |
| libraries = [ |
| { |
| name = "libvulkan.so" |
| }, |
| ] |
| } |
| |
| sdk_shared_library("loader") { |
| # The Vulkan loader is named libvulkan |
| output_name = "vulkan" |
| |
| category = "partner" |
| |
| # The Vulkan loader's interface is defined by standard Khronos vulkan headers |
| # which can be obtained separately from the loader implementation itself. |
| no_headers = true |
| |
| configs += [ |
| "../:vulkan_build_config", |
| "../:include_extra_vulkan_headers", |
| ] |
| |
| include_dirs = [ "." ] |
| |
| cflags_c = [ |
| "-Wno-missing-field-initializers", |
| |
| # TODO(DX-1059): Remove this when -Wextra-semi clean. |
| "-Wno-extra-semi", |
| |
| "-DSYSCONFDIR=\"/config\"", |
| "-DEXTRASYSCONFDIR=\"/pkg/data\"", |
| "-DDATADIR=\"/usr/share\"", |
| ] |
| |
| defines = [ "VK_LOADER_DEBUG=\"$vk_loader_debug\"" ] |
| |
| sources = [ |
| "cJSON.c", |
| "debug_utils.c", |
| "dev_ext_trampoline.c", |
| "dlopen_fuchsia.c", |
| "extension_manual.c", |
| "loader.c", |
| "murmurhash.c", |
| "phys_dev_ext.c", |
| "trampoline.c", |
| "unknown_ext_chain.c", |
| "wsi.c", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.vulkan.loader:fuchsia.vulkan.loader_c_client", |
| "//zircon/public/lib/fdio", |
| ] |
| |
| # TODO(MA-488) - while these shared libraries are needed by vulkan icd |
| # the app must provide them, so we add the deps here. |
| deps += [ "//zircon/public/lib/trace-engine" ] |
| deps += [ "//zircon/public/lib/async-default" ] |
| |
| # TODO(MA-488): The //zircon/public/lib/async-default dep gives us a dep |
| # on //zircon/public/lib/async, which uses the C++ standard library and |
| # is linked statically (built from source, though async-default is a |
| # prebuilt shared library). So link in the C++ standard library |
| # statically just to satisfy those references. When the async-default |
| # dep is dropped, this can change to "none" (i.e. be removed). |
| libcxx_linkage = "static" |
| |
| libs = [ "zircon" ] |
| |
| runtime_deps = [ "//zircon/public/lib/fdio:fdio_sdk" ] |
| |
| # TODO(MA-488): remove this too |
| runtime_deps += [ "//zircon/public/lib/trace-engine:trace-engine_sdk" ] |
| runtime_deps += [ "//zircon/public/lib/async-default:async-default_sdk" ] |
| } |
| |
| # Loader config and definition for building with the linux toolchain. |
| # This is intended for use with VM guest binaries. Guest binaries are |
| # not required to use this loader; it is used here only to avoid |
| # creating a duplicate instance of the vulkan loader repo. |
| config("vulkan_linux_build_config") { |
| include_dirs = [ |
| "../include", |
| "../build-fuchsia/generated/include", |
| ] |
| defines = [ |
| "VK_USE_PLATFORM_XLIB_KHR=1", |
| ] |
| } |
| |
| shared_library("loader_linux") { |
| output_name = "vulkan_linux" |
| |
| public_configs = [ |
| ":vulkan_linux_build_config" |
| ] |
| |
| # Copied from ../CMakeLists.txt and ./loader_cmake_config.h.in |
| cflags_c = [ |
| "-DSYSCONFDIR=\"/etc\"", |
| "-DFALLBACK_CONFIG_DIRS=\"/etc/xdg\"", |
| "-DFALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"", |
| "-DHAVE_SECURE_GETENV", |
| ] |
| |
| defines = [ "VK_LOADER_DEBUG=\"$vk_loader_debug\"" ] |
| |
| include_dirs = [ |
| ".", |
| ] |
| |
| sources = [ |
| "cJSON.c", |
| "debug_utils.c", |
| "dev_ext_trampoline.c", |
| "extension_manual.c", |
| "loader.c", |
| "murmurhash.c", |
| "phys_dev_ext.c", |
| "trampoline.c", |
| "unknown_ext_chain.c", |
| "wsi.c", |
| ] |
| } |