blob: b18585379ee4f9748a883528434439fce72e24dc [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/package.gni")
import("//src/graphics/examples/vkproto/common/common.gni")
import("//src/graphics/lib/magma/gnbuild/magma.gni")
import("//src/lib/vulkan/build/config.gni")
import("//src/lib/vulkan/build/vulkan_targets.gni")
fuchsia_component("vkproto_cmp") {
manifest = "meta/vkproto.cmx"
deps = [
":bin",
":shaders",
"//src/lib/vulkan:image-pipe-swapchain-fb",
"//src/lib/vulkan:validation-layers",
]
}
resource("shaders") {
sources = [
"common/shaders/frag.spv",
"common/shaders/vert.spv",
]
outputs = [ "data/shaders/{{source_file_part}}" ]
}
fuchsia_test_package("vkproto-pkg") {
test_components = [ ":vkproto_cmp" ]
test_specs = {
environments = magma_hardware_envs
}
}
config("vulkan_sdk_linux_config") {
# Specify the include/lib dirs and linked libraries for use with the
# downloaded LunarG Vulkan SDK.
vulkan_sdk = "//prebuilt/third_party/vulkansdk/linux/x86_64"
include_dirs = [ "$vulkan_sdk/include" ]
lib_dirs = [ "$vulkan_sdk/lib" ]
libs = [ "vulkan" ]
}
vulkan_executable("bin") {
output_name = "vkproto"
sources = common_sources
sources += [ "example/main.cc" ]
include_dirs = [ "//src/graphics/examples/vkproto/common" ]
deps = [ "//src/lib/fxl" ]
if (is_fuchsia) {
include_dirs += [ "//src/graphics/examples/vkproto/fuchsia" ]
deps += [
"//src/lib/vulkan",
"//src/lib/vulkan/swapchain",
]
sources += [
"fuchsia/surface.cc",
"fuchsia/surface.h",
]
} else {
defines = [ "USE_GLFW=1" ]
include_dirs += [ "//src/graphics/examples/vkproto/glfw" ]
sources += [
"glfw/surface.cc",
"glfw/surface.h",
]
deps += [
":spirv_copy",
"//third_party/glfw",
]
}
data = [
"common/shaders/frag.spv",
"common/shaders/vert.spv",
]
}
copy("spirv_copy") {
sources = [
"common/shaders/frag.spv",
"common/shaders/vert.spv",
]
outputs = [ "$target_out_dir/{{source_file_part}}" ]
}
#
# Linux / Mac host Build
#
group("vkproto_glfw") {
deps = []
# Currently vulkan build only supports Linux.
if (is_linux) {
deps += [ ":bin($host_toolchain)" ]
}
}
group("vkproto") {
testonly = true
deps = [ ":vkproto-pkg" ]
}