From 19f605434aca7607208c512fd741eb71219e2419 Mon Sep 17 00:00:00 2001 From: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> Date: Fri, 18 Jul 2025 11:03:49 +0200 Subject: [PATCH] Fix build for CYGWIN Attached patch fixes build on CYGWIN. Hopefully, the patch is small and easy because it is just needed to add CYGWIN to the list of existing UNIX platforms. --- CMakeLists.txt | 2 +- loader/vk_loader_platform.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7963186ab..d20339a42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ elseif(APPLE) if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK) endif() -elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU") +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU|CYGWIN") option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) option(BUILD_WSI_XLIB_XRANDR_SUPPORT "Build X11 Xrandr WSI support" ON) diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index 9a3b9c1c9..272f6f8ec 100644 --- a/loader/vk_loader_platform.h +++ b/loader/vk_loader_platform.h @@ -44,7 +44,7 @@ // Set of platforms with a common set of functionality which is queried throughout the program #if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNX__) || defined(__FreeBSD__) || \ - defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) + defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || defined(__CYGWIN__) #define COMMON_UNIX_PLATFORMS 1 #else #define COMMON_UNIX_PLATFORMS 0 @@ -298,7 +298,7 @@ static inline char *loader_platform_dirname(char *path) { return dirname(path); // loader_platform_executable_path finds application path + name. // Path cannot be longer than 1024, returns NULL if it is greater than that. -#if defined(__linux__) || defined(__GNU__) +#if defined(__linux__) || defined(__GNU__) || defined(__CYGWIN__) static inline char *loader_platform_executable_path(char *buffer, size_t size) { ssize_t count = readlink("/proc/self/exe", buffer, size); if (count == -1) return NULL;