xref: /aosp_15_r20/external/swiftshader/src/WSI/BUILD.gn (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("../swiftshader.gni")
16import("//build_overrides/wayland.gni")
17import("//build/config/ozone.gni")
18
19config("WSI_metal_weak_framework") {
20  if (is_mac) {
21    ldflags = [
22      "-weak_framework",
23      "Metal",
24    ]
25  }
26}
27
28swiftshader_source_set("WSI") {
29  sources = [
30    "HeadlessSurfaceKHR.cpp",
31    "HeadlessSurfaceKHR.hpp",
32    "VkSurfaceKHR.cpp",
33    "VkSurfaceKHR.hpp",
34    "VkSwapchainKHR.cpp",
35    "VkSwapchainKHR.hpp",
36  ]
37
38  if (is_linux) {
39    if (ozone_platform_x11) {
40      sources += [
41        "XcbSurfaceKHR.cpp",
42        "XcbSurfaceKHR.hpp",
43        "libXCB.cpp",
44        "libXCB.hpp",
45      ]
46    }
47
48    if (ozone_platform_wayland) {
49      sources += [
50        "WaylandSurfaceKHR.cpp",
51        "WaylandSurfaceKHR.hpp",
52        "libWaylandClient.cpp",
53        "libWaylandClient.hpp",
54      ]
55    }
56  }
57
58  if (is_win) {
59    sources += [
60      "Win32SurfaceKHR.cpp",
61      "Win32SurfaceKHR.hpp",
62    ]
63  }
64
65  if (is_mac) {
66    sources += [
67      "MetalSurface.hpp",
68      "MetalSurface.mm",
69    ]
70    frameworks = [
71      "Cocoa.framework",
72      "QuartzCore.framework",
73    ]
74    public_configs = [ ":WSI_metal_weak_framework" ]
75  }
76
77  include_dirs = [
78    "..",
79    "../../include",
80    "../../third_party/SPIRV-Headers/include",
81  ]
82
83  deps = [
84    "../../third_party/SPIRV-Tools:spvtools_headers",
85    "../../third_party/marl:Marl_headers",
86    "../System",
87    "../Vulkan:swiftshader_libvulkan_headers",
88  ]
89
90  # Do not try to depend on Wayland if the |wayland_gn_dir| is not set.
91  if (is_linux && ozone_platform_wayland && wayland_gn_dir != "") {
92    # Use third-party targets
93    deps += [ "$wayland_gn_dir:wayland_client" ]
94  }
95
96  configs = [ "../Vulkan:swiftshader_libvulkan_private_config" ]
97}
98