| # Copyright 2020 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/components.gni") |
| import("//src/graphics/examples/vkproto/common/common.gni") |
| import("//src/lib/vulkan/vulkan.gni") |
| |
| fuchsia_test_component("vkproto_test") { |
| manifest = "meta/vkproto_test.cml" |
| deps = [ |
| ":bin", |
| "//src/graphics/examples/vkproto:shaders", |
| "//src/lib/vulkan/swapchain:image_pipe_swapchain_fb_layer", |
| "//src/lib/vulkan/validation_layers", |
| ] |
| test_type = "vulkan" |
| } |
| |
| 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" ] |
| } |
| |
| executable("bin") { |
| output_name = "vkproto-test" |
| testonly = true |
| |
| sources = [ "main.cc" ] |
| |
| include_dirs = [ "//src/graphics/examples/vkproto/common" ] |
| |
| defines = [ "VULKAN_HPP_NO_EXCEPTIONS" ] |
| |
| deps = [ |
| "../common:srcs", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| ] |
| |
| if (is_fuchsia) { |
| include_dirs += [ "//src/graphics/examples/vkproto/fuchsia" ] |
| |
| deps += [ |
| "//src/lib/vulkan", |
| "//src/lib/vulkan/swapchain", |
| ] |
| |
| sources += [ |
| "../fuchsia/fuchsia_surface.cc", |
| "../fuchsia/fuchsia_surface.h", |
| ] |
| } else { |
| 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" ] |
| } |
| } |
| |
| 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 Build |
| # |
| group("vkproto-test-glfw") { |
| testonly = true |
| deps = [ ":bin($host_toolchain)" ] |
| } |
| |
| fuchsia_test_package("vkproto-test") { |
| package_name = "vkproto-test" |
| test_components = [ ":vkproto_test" ] |
| test_specs = { |
| environments = vulkan_envs |
| } |
| } |
| |
| group("test") { |
| testonly = true |
| deps = [ ":vkproto-test" ] |
| } |