blob: 2da7d2002a9bd42d2cd2e847abdd36fe1cb7c0d9 [file] [log] [blame]
# Copyright 2016 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/package.gni")
import("//third_party/vulkan_loader_and_validation_layers/layers/layers.gni")
# Some targets take over a minute to compile with -O2 or -O3 optimization
# levels on an unloaded Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz. This
# drops the optimization level down to -O1, which is still slow but
# bearable.
# TODO(TC-298): Remove once the pathological compiler behavior is fixed.
# We also need -O > 0 for debug to prevent stack overflows with static
# constructors when asan is enabled.
config("validation_layer_optimization") {
visibility = [ ":*" ]
cflags = [ "-O1" ]
}
package("vulkan_loader_and_layers_tests") {
testonly = true
deps = [
"//third_party/vulkan_loader_and_validation_layers/tests",
]
tests = [
{
name = "loader_validation_tests"
dest = "vulkan_loader_validation_tests"
disabled = true
},
{
name = "layer_validation_tests"
dest = "vulkan_layer_validation_tests"
disabled = true
},
]
public_deps = vulkan_validation_layers.public_deps
loadable_modules = vulkan_validation_layers.loadable_modules
resources = vulkan_validation_layers.resources
}
group("layers") {
public_deps = [
":libVkLayer_core_validation",
":libVkLayer_object_tracker",
":libVkLayer_parameter_validation",
":libVkLayer_threading",
":libVkLayer_unique_objects",
]
}
config("layer_include_config") {
cflags_cc = [
"-Wno-unused-function",
# TODO(DX-1059): Remove this when -Wextra-semi clean.
"-Wno-extra-semi",
]
include_dirs = [
".",
"../include",
"../loader",
]
}
config("static_stdlib") {
visibility = [ ":layer_common" ]
ldflags = [ "-static-libstdc++" ]
}
# This source_set doesn't include the validation layer strings by default, though including some
# files (e.g. vk_layer_logging.h or vk_layer_utils.h) might still bring them in to a target.
source_set("micro_layer_common") {
public_configs = [ ":layer_include_config" ]
sources = [
"vk_layer_extension_utils.cpp",
"vk_layer_table.cpp",
]
public_deps = [
"../:extra_vulkan_headers",
"../:vulkan",
]
}
source_set("layer_common") {
visibility = [ ":*" ]
public_configs = [
":layer_include_config",
":static_stdlib",
]
sources = [
"vk_layer_config.cpp",
"vk_layer_extension_utils.cpp",
"vk_layer_table.cpp",
"vk_layer_utils.cpp",
]
public_deps = [
"../:extra_vulkan_headers",
"../:vulkan",
]
configs += [ ":validation_layer_optimization" ]
}
template("validation_layer") {
loadable_module(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs += [ ":validation_layer_optimization" ]
}
}
validation_layer("libVkLayer_core_validation") {
cflags_cc = [ "-Wno-missing-field-initializers" ]
sources = [
"buffer_validation.cpp",
"core_validation.cpp",
"descriptor_sets.cpp",
"shader_validation.cpp",
"vk_format_utils.cpp",
"xxhash.c",
]
deps = [
":layer_common",
"//third_party/glslang:glslang_sources",
"//third_party/spirv-tools:SPIRV-Tools",
"//third_party/spirv-tools:spvtools_headers",
]
}
config("VkLayer_parameter_validation_config") {
cflags_cc = [ "-Wno-unused-const-variable" ]
}
validation_layer("libVkLayer_parameter_validation") {
configs = [ ":VkLayer_parameter_validation_config" ]
sources = [
"../build-fuchsia/generated/include/parameter_validation.cpp",
"parameter_validation_utils.cpp",
"vk_format_utils.cpp",
]
deps = [
":layer_common",
]
}
validation_layer("libVkLayer_threading") {
sources = [
"threading.cpp",
]
deps = [
":layer_common",
]
}
validation_layer("libVkLayer_unique_objects") {
sources = [
"unique_objects.cpp",
]
deps = [
":layer_common",
]
}
validation_layer("libVkLayer_object_tracker") {
sources = [
"../build-fuchsia/generated/include/object_tracker.cpp",
"object_tracker_utils.cpp",
]
deps = [
":layer_common",
]
}