Expose Wayland only when enabled
VK_USE_PLATFORM_WAYLAND_KHR was unconditionally exposed on Linux, but
the implementation was only built when `ozone_platform_wayland` is
true, leading to builds such as cast_shell_linux to fail linking.
Fix it by only exposing the extension string when the implementation
gets built.
Bug: chromium:1327041
Change-Id: I196956e8916f46517e043f5520e5e264ee90b0da
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/66628
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/BUILD.gn b/src/Vulkan/BUILD.gn
index e61e4c4..e782a3f 100644
--- a/src/Vulkan/BUILD.gn
+++ b/src/Vulkan/BUILD.gn
@@ -13,6 +13,7 @@
# limitations under the License.
import("//build_overrides/build.gni")
+import("//build_overrides/wayland.gni")
import("../swiftshader.gni")
import("vulkan.gni")
@@ -21,9 +22,11 @@
if (is_linux) {
defines = [
"VK_USE_PLATFORM_XCB_KHR",
- "VK_USE_PLATFORM_WAYLAND_KHR",
"VK_EXPORT=__attribute__((visibility(\"default\")))",
]
+ if (ozone_platform_wayland) {
+ defines += [ "VK_USE_PLATFORM_WAYLAND_KHR" ]
+ }
} else if (is_chromeos) {
defines = [
"VK_EXPORT=__attribute__((visibility(\"default\")))",