| # 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("//src/graphics/examples/vkproto/common/common.gni") |
| import("//src/lib/vulkan/build/config.gni") |
| import("//src/lib/vulkan/build/vulkan_targets.gni") |
| import("//src/lib/vulkan/vulkan.gni") |
| |
| resource("override") { |
| sources = [ "VkLayer_override.json" ] |
| outputs = [ "data/vulkan/implicit_layer.d/VkLayer_override.json" ] |
| } |
| |
| fuchsia_component("vkproto-cmp") { |
| manifest = "meta/vkproto.cml" |
| |
| deps = [ |
| ":bin", |
| ":override", |
| ":shaders", |
| "//src/lib/vulkan/swapchain:image_pipe_swapchain_fb_layer", |
| "//src/lib/vulkan/validation_layers", |
| ] |
| } |
| |
| resource("shaders") { |
| sources = [ |
| "common/shaders/frag.spv", |
| "common/shaders/vert.spv", |
| ] |
| outputs = [ "data/shaders/{{source_file_part}}" ] |
| } |
| |
| fuchsia_package("vkproto-pkg") { |
| deps = [ ":vkproto-cmp" ] |
| } |
| |
| 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 = [ "example/main.cc" ] |
| |
| include_dirs = [ "//src/graphics/examples/vkproto/common" ] |
| |
| defines = [ "VULKAN_HPP_NO_EXCEPTIONS" ] |
| |
| if (is_fuchsia) { |
| include_dirs += [ "//src/graphics/examples/vkproto/fuchsia" ] |
| |
| deps = [ |
| # TODO(https://fxbug.dev/42180987): workaround for toolchain issues, see bug |
| "//build/config/fuchsia:uses-outline-atomics-fxbug98632", |
| "//src/lib/vulkan", |
| "//src/lib/vulkan/swapchain", |
| ] |
| |
| sources += [ |
| "fuchsia/fuchsia_surface.cc", |
| "fuchsia/fuchsia_surface.h", |
| ] |
| } else { |
| defines += [ "USE_GLFW=1" ] |
| |
| include_dirs += [ "//src/graphics/examples/vkproto/glfw" ] |
| |
| sources += [ |
| "glfw/glfw_surface.cc", |
| "glfw/glfw_surface.h", |
| ] |
| |
| deps = [ |
| ":spirv_copy", |
| "//third_party/glfw", |
| ] |
| |
| if (is_linux) { |
| configs += [ ":vulkan_sdk_linux_config($host_toolchain)" ] |
| } else if (is_mac) { |
| include_dirs += [ "${vulkan_sdk}/include" ] |
| |
| lib_dirs = [ "${vulkan_sdk}/lib" ] |
| |
| libs = [ "vulkan" ] |
| } |
| } |
| |
| deps += [ "common:srcs" ] |
| |
| data = [ |
| "common/shaders/frag.spv", |
| "common/shaders/vert.spv", |
| ] |
| } |
| |
| copy("spirv_copy") { |
| sources = [ |
| "common/shaders/frag.spv", |
| "common/shaders/vert.spv", |
| ] |
| |
| outputs = [ "$root_out_dir/{{source_file_part}}" ] |
| } |
| |
| group("vkproto-glfw") { |
| if (is_host) { |
| deps = [ ":bin($host_toolchain)" ] |
| } |
| } |
| |
| group("vkproto") { |
| deps = [ ":vkproto-pkg" ] |
| } |