| # Copyright 2016 The Chromium 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("features.gni") |
| import("//build/config/ui.gni") |
| import("//build/buildflag_header.gni") |
| import("//testing/test.gni") |
| |
| # Generate a buildflag header for compile-time checking of Vulkan support. |
| buildflag_header("features") { |
| header = "features.h" |
| flags = [ "ENABLE_VULKAN=$enable_vulkan" ] |
| } |
| if (enable_vulkan) { |
| vulkan_lib_dir = getenv("VULKAN_SDK") + "/lib" |
| component("vulkan") { |
| output_name = "vulkan_wrapper" |
| |
| if (is_linux) { |
| assert(use_x11, "Vulkan only support x11 at this point.") |
| sources = [ |
| "vulkan_command_buffer.cc", |
| "vulkan_command_buffer.h", |
| "vulkan_command_pool.cc", |
| "vulkan_command_pool.h", |
| "vulkan_descriptor_layout.cc", |
| "vulkan_descriptor_layout.h", |
| "vulkan_descriptor_pool.cc", |
| "vulkan_descriptor_pool.h", |
| "vulkan_descriptor_set.cc", |
| "vulkan_descriptor_set.h", |
| "vulkan_device_queue.cc", |
| "vulkan_device_queue.h", |
| "vulkan_export.h", |
| "vulkan_image_view.cc", |
| "vulkan_image_view.h", |
| "vulkan_implementation.cc", |
| "vulkan_implementation.h", |
| "vulkan_platform.h", |
| "vulkan_render_pass.cc", |
| "vulkan_render_pass.h", |
| "vulkan_sampler.cc", |
| "vulkan_sampler.h", |
| "vulkan_shader_module.cc", |
| "vulkan_shader_module.h", |
| "vulkan_surface.cc", |
| "vulkan_surface.h", |
| "vulkan_swap_chain.cc", |
| "vulkan_swap_chain.h", |
| ] |
| |
| configs += [ "//build/config:precompiled_headers" ] |
| defines = [ "VULKAN_IMPLEMENTATION" ] |
| |
| all_dependent_configs = [ "//third_party/vulkan:vulkan_headers" ] |
| libs = [ "vulkan" ] |
| |
| if (current_cpu == "x64") { |
| lib_dirs = [ |
| "/usr/lib/x86_64-linux-gnu", |
| vulkan_lib_dir, |
| ] |
| } else { |
| assert(false, "Unsupported vulkan target: " + current_cpu) |
| } |
| |
| deps = [ |
| "//base", |
| "//third_party/shaderc:libshaderc", |
| "//ui/base", |
| "//ui/gfx", |
| ] |
| |
| if (use_x11) { |
| deps += [ "//ui/gfx/x" ] |
| configs += [ "//build/config/linux:x11" ] |
| } |
| } |
| } |
| |
| test("vulkan_tests") { |
| sources = [ |
| "tests/basic_vulkan_test.cc", |
| "tests/basic_vulkan_test.h", |
| "tests/native_window.h", |
| "tests/shader_module_unittest.cc", |
| "tests/vulkan_test.cc", |
| "tests/vulkan_tests_main.cc", |
| ] |
| |
| include_dirs = [ "/usr/include" ] |
| if (current_cpu == "x64") { |
| lib_dirs = [ |
| "/usr/lib/x86_64-linux-gnu", |
| vulkan_lib_dir, |
| ] |
| } else { |
| assert(false, "Unsupported vulkan target: " + current_cpu) |
| } |
| |
| deps = [ |
| ":vulkan", |
| "//base/test:test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| |
| if (use_x11) { |
| sources += [ "tests/native_window_x11.cc" ] |
| deps += [ "//ui/gfx/x" ] |
| configs += [ "//build/config/linux:x11" ] |
| } |
| } |
| } |