summaryrefslogtreecommitdiffstats
path: root/gpu/vulkan/BUILD.gn
blob: 274071fbf87bd6c4c63a0f50fd7cc84d3204c744 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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("//build/config/ui.gni")

config("vulkan_config") {
  defines = [ "ENABLE_VULKAN" ]
  if (use_x11) {
    defines += [ "VK_USE_PLATFORM_XLIB_KHR" ]
  }
}

component("vulkan") {
  output_name = "vulkan_wrapper"

  if (is_linux && enable_vulkan) {
    assert(use_x11, "Vulkan only support x11 at this point.")
    sources = [
      "vulkan_export.h",
      "vulkan_implementation.cc",
      "vulkan_implementation.h",
      "vulkan_surface.cc",
      "vulkan_surface.h",
    ]

    configs += [ "//build/config:precompiled_headers" ]
    defines = [ "VULKAN_IMPLEMENTATION" ]

    all_dependent_configs = [ ":vulkan_config" ]
    libs = [ "vulkan" ]

    include_dirs = [ "/usr/include" ]
    if (target_cpu == "x64") {
      lib_dirs = [ "/usr/lib/x86_64-linux-gnu" ]
    } else {
      assert(false, "Unsupported vulkan target: " + target_cpu)
    }

    deps = [
      "//base",
      "//ui/base",
      "//ui/gfx",
    ]

    if (use_x11) {
      deps += [ "//ui/gfx/x" ]
      configs += [ "//build/config/linux:x11" ]
    }
  }
}