BUILD.gn 4.07 KB
Newer Older
1
2
3
4
5
# Copyright 2020 The ANGLE Project 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_overrides/swiftshader.gni")
Antonio Caggiano's avatar
Antonio Caggiano committed
6
import("//build_overrides/wayland.gni")
7
8
import("../../../gni/angle.gni")

9
10
11
12
13
14
15
16
17
18
declare_args() {
  angle_use_custom_libvulkan = !is_android && !is_fuchsia && !is_ggp
}

config("angle_libvulkan_config") {
  if (angle_use_custom_libvulkan) {
    defines = [ "ANGLE_USE_CUSTOM_LIBVULKAN" ]
  }
}

19
angle_source_set("angle_libvulkan_loader") {
20
  public_configs = [ ":angle_libvulkan_config" ]
21
22
23
24
25
  sources = [
    "libvulkan_loader.cpp",
    "libvulkan_loader.h",
  ]
  deps = [ "$angle_root:angle_common" ]
26
27
}

28
if (angle_enable_vulkan || angle_build_vulkan_system_info) {
29
30
31
32
  config("angle_vulkan_headers_config") {
    if (angle_shared_libvulkan) {
      defines = [ "ANGLE_SHARED_LIBVULKAN=1" ]
    }
Antonio Caggiano's avatar
Antonio Caggiano committed
33
    if (angle_use_wayland) {
Antonio Caggiano's avatar
Antonio Caggiano committed
34
      include_dirs = [ "$wayland_dir/src" ]
Antonio Caggiano's avatar
Antonio Caggiano committed
35
    }
36
    configs = [ "$angle_root:angle_vulkan_wayland_config" ]
37
38
  }

39
40
41
42
  angle_source_set("angle_vulkan_headers") {
    sources = [
      "vk_google_filtering_precision.h",
      "vk_headers.h",
43
44
    ]
    if (angle_shared_libvulkan) {
45
      public_deps = [ "$angle_root/src/third_party/volk:volk" ]
46
    } else {
47
      public_deps = [ "$angle_vulkan_headers_dir:vulkan_headers" ]
48
    }
49
    public_configs = [ ":angle_vulkan_headers_config" ]
50
51
  }

52
  angle_source_set("angle_vulkan_icd") {
53
54
55
56
    sources = [
      "vulkan_icd.cpp",
      "vulkan_icd.h",
    ]
57

58
59
60
61
62
63
64
    defines =
        [ "ANGLE_VK_MOCK_ICD_JSON=\"$angle_data_dir/VkICD_mock_icd.json\"" ]

    # On Fuchsia use validation layer provided by the SDK.
    if (!is_fuchsia) {
      defines += [ "ANGLE_VK_LAYERS_DIR=\"$angle_data_dir\"" ]
    }
65

66
    data_deps = []
67

68
69
70
71
72
    if (angle_enable_swiftshader) {
      import("$swiftshader_dir/src/Vulkan/vulkan.gni")
      _sws_icd = "./$swiftshader_icd_file_name"
      if (is_win) {
        _sws_icd = ".\\\\$swiftshader_icd_file_name"
73
74
      } else if (is_fuchsia) {
        _sws_icd = "/pkg/$swiftshader_icd_file_name"
75
      }
76

77
      defines += [ "ANGLE_VK_SWIFTSHADER_ICD_JSON=\"${_sws_icd}\"" ]
78

79
80
81
82
83
      data_deps += [
        "$swiftshader_dir/src/Vulkan:icd_file",
        "$swiftshader_dir/src/Vulkan:swiftshader_libvulkan",
      ]
    }
84
85
86
87
88

    public_deps = [
      ":angle_vulkan_headers",
      "$angle_root:angle_common",
    ]
Jamie Madill's avatar
Jamie Madill committed
89
90

    configs += [ "$angle_root:angle_no_cfi_icall" ]
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
  }
}

if (angle_enable_vulkan) {
  group("angle_libvulkan") {
    public_configs = [ ":angle_libvulkan_config" ]
    data_deps = []
    if (angle_use_custom_libvulkan) {
      if (angle_shared_libvulkan) {
        data_deps += [ "$angle_vulkan_loader_dir:libvulkan" ]
      } else {
        public_deps = [ "$angle_vulkan_loader_dir:libvulkan" ]
      }
      data_deps += [ "$angle_vulkan_tools_dir:VkICD_mock_icd" ]
    }
  }

  group("angle_vulkan_entry_points") {
    public_deps = [ ":angle_vulkan_headers" ]
    if (is_fuchsia) {
      public_deps += [
        "$angle_root/src/common/fuchsia_egl",
        "//third_party/fuchsia-sdk/sdk/pkg/vulkan",
      ]
      if (!angle_use_vulkan_null_display) {
        public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/vulkan_layers:VkLayer_image_pipe_swapchain" ]
      }
    } else if (!is_android && !is_ggp) {
      if (angle_shared_libvulkan) {
        data_deps = [ "$angle_vulkan_loader_dir:libvulkan" ]
      } else {
        deps = [ "$angle_vulkan_loader_dir:libvulkan" ]
      }
    }
  }

  angle_source_set("vulkan") {
    public_deps = [
      ":angle_libvulkan",
      ":angle_vulkan_entry_points",
      ":angle_vulkan_icd",
    ]
133
  }
134

135
136
137
138
  if (angle_enable_vulkan_validation_layers) {
    group("vulkan_validation_layers") {
      data_deps = []
      if (is_fuchsia) {
139
        data_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/vulkan_layers:VkLayer_khronos_validation" ]
140
      } else {
141
        data_deps +=
142
143
144
145
146
            [ "$angle_vulkan_validation_layers_dir:vulkan_validation_layers" ]
        if (!is_android) {
          data_deps +=
              [ "$angle_vulkan_validation_layers_dir:vulkan_gen_json_files" ]
        }
147
      }
148
149
150
    }
  }
}