blob: 084c5bb6f749672357763085777bfe5fa5a34229 [file] [log] [blame]
# 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"
}
source_set("loader_static") {
public_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",
]
if (is_fuchsia) {
cflags_c += [
"-DSYSCONFDIR=\"/config\"",
"-DEXTRASYSCONFDIR=\"/pkg/data\"",
"-DDATADIR=\"/usr/share\"",
]
}
if (is_linux) {
# 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\"" ]
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",
]
if (is_fuchsia) {
sources += [ "dlopen_fuchsia.c" ]
}
if (is_fuchsia) {
deps = [
"//sdk/fidl/fuchsia.vulkan.loader:fuchsia.vulkan.loader_c_client",
"//zircon/public/lib/fdio",
]
}
if (is_linux) {
public_deps = [ "//third_party/wayland:client_headers" ]
}
}
if (is_fuchsia) {
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
deps = [
":loader_static",
]
# 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" ]
}
}
if (is_linux) {
shared_library("loader") {
# The Vulkan loader is named libvulkan
output_name = "vulkan"
deps = [ ":loader_static" ]
}
}