OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/ui.gni") | 5 import("//build/config/ui.gni") |
| 6 import("//testing/test.gni") |
6 | 7 |
7 config("vulkan_config") { | 8 if (enable_vulkan) { |
8 defines = [ "ENABLE_VULKAN" ] | 9 component("vulkan") { |
9 if (use_x11) { | 10 output_name = "vulkan_wrapper" |
10 defines += [ "VK_USE_PLATFORM_XLIB_KHR" ] | 11 |
| 12 if (is_linux) { |
| 13 assert(use_x11, "Vulkan only support x11 at this point.") |
| 14 sources = [ |
| 15 "vulkan_command_buffer.cc", |
| 16 "vulkan_command_buffer.h", |
| 17 "vulkan_command_pool.cc", |
| 18 "vulkan_command_pool.h", |
| 19 "vulkan_export.h", |
| 20 "vulkan_image_view.cc", |
| 21 "vulkan_image_view.h", |
| 22 "vulkan_implementation.cc", |
| 23 "vulkan_implementation.h", |
| 24 "vulkan_platform.h", |
| 25 "vulkan_render_pass.cc", |
| 26 "vulkan_render_pass.h", |
| 27 "vulkan_surface.cc", |
| 28 "vulkan_surface.h", |
| 29 "vulkan_swap_chain.cc", |
| 30 "vulkan_swap_chain.h", |
| 31 ] |
| 32 |
| 33 configs += [ "//build/config:precompiled_headers" ] |
| 34 defines = [ "VULKAN_IMPLEMENTATION" ] |
| 35 |
| 36 libs = [ "vulkan" ] |
| 37 |
| 38 include_dirs = [ "/usr/include" ] |
| 39 if (target_cpu == "x64") { |
| 40 lib_dirs = [ "/usr/lib/x86_64-linux-gnu" ] |
| 41 } else { |
| 42 assert(false, "Unsupported vulkan target: " + target_cpu) |
| 43 } |
| 44 |
| 45 deps = [ |
| 46 "//base", |
| 47 "//ui/base", |
| 48 "//ui/gfx", |
| 49 ] |
| 50 |
| 51 if (use_x11) { |
| 52 deps += [ "//ui/gfx/x" ] |
| 53 configs += [ "//build/config/linux:x11" ] |
| 54 } |
| 55 } |
11 } | 56 } |
12 } | |
13 | 57 |
14 component("vulkan") { | 58 test("vulkan_tests") { |
15 output_name = "vulkan_wrapper" | |
16 | |
17 if (is_linux && enable_vulkan) { | |
18 assert(use_x11, "Vulkan only support x11 at this point.") | |
19 sources = [ | 59 sources = [ |
20 "vulkan_export.h", | 60 "tests/native_window.h", |
21 "vulkan_implementation.cc", | 61 "tests/vulkan_test.cc", |
22 "vulkan_implementation.h", | 62 "tests/vulkan_tests_main.cc", |
23 "vulkan_surface.cc", | |
24 "vulkan_surface.h", | |
25 ] | 63 ] |
26 | 64 |
27 configs += [ "//build/config:precompiled_headers" ] | |
28 defines = [ "VULKAN_IMPLEMENTATION" ] | |
29 | |
30 all_dependent_configs = [ ":vulkan_config" ] | |
31 libs = [ "vulkan" ] | |
32 | |
33 include_dirs = [ "/usr/include" ] | 65 include_dirs = [ "/usr/include" ] |
34 if (target_cpu == "x64") { | 66 if (target_cpu == "x64") { |
35 lib_dirs = [ "/usr/lib/x86_64-linux-gnu" ] | 67 lib_dirs = [ "/usr/lib/x86_64-linux-gnu" ] |
36 } else { | 68 } else { |
37 assert(false, "Unsupported vulkan target: " + target_cpu) | 69 assert(false, "Unsupported vulkan target: " + target_cpu) |
38 } | 70 } |
39 | 71 |
40 deps = [ | 72 deps = [ |
41 "//base", | 73 ":vulkan", |
42 "//ui/base", | 74 "//base/test:test_support", |
43 "//ui/gfx", | 75 "//testing/gmock", |
| 76 "//testing/gtest", |
44 ] | 77 ] |
45 | 78 |
46 if (use_x11) { | 79 if (use_x11) { |
| 80 sources += [ "tests/native_window_x11.cc" ] |
47 deps += [ "//ui/gfx/x" ] | 81 deps += [ "//ui/gfx/x" ] |
48 configs += [ "//build/config/linux:x11" ] | 82 configs += [ "//build/config/linux:x11" ] |
49 } | 83 } |
50 } | 84 } |
51 } | 85 } |
OLD | NEW |