Fix Cygwin building and add CI (#15566)

Co-authored-by: TrueCat17 <truecat17@gmail.com>
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
This commit is contained in:
stahta01 2026-05-15 11:48:24 -04:00 committed by GitHub
parent be97a18d82
commit 6586bebfec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 116 additions and 78 deletions

View file

@ -374,7 +374,7 @@ if(MACOS)
testnativecocoa.m
testnativex11.c
)
elseif(WINDOWS)
elseif(WINDOWS OR CYGWIN)
add_sdl_test_executable(testnative BUILD_DEPENDENT NEEDS_RESOURCES TESTUTILS SOURCES testnative.c testnativew32.c)
elseif(HAVE_X11 OR HAVE_WAYLAND)
add_sdl_test_executable(testnative BUILD_DEPENDENT NEEDS_RESOURCES TESTUTILS SOURCES testnative.c)
@ -671,7 +671,7 @@ function(add_sdl_test TEST TARGET)
COMMAND ${command}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
if(WIN32 AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.27")
if((WIN32 OR CYGWIN) AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.27")
set_property(TEST ${TEST} APPEND PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_RUNTIME_DLL_DIRS:${TARGET}>")
endif()
if(NOT notrackmem)

View file

@ -107,7 +107,7 @@ int main(int argc, char *argv[]) {
if (print_arguments) {
int print_i;
#ifdef SDL_PLATFORM_WINDOWS
#if defined(SDL_PLATFORM_WINDOWS) && !defined(SDL_PLATFORM_CYGWIN)
/* reopen stdout as binary to prevent newline conversion */
_setmode(_fileno(stdout), _O_BINARY);
#endif
@ -145,7 +145,7 @@ int main(int argc, char *argv[]) {
continue;
}
#ifdef SDL_PLATFORM_WINDOWS
#if defined(SDL_PLATFORM_WINDOWS) && !defined(SDL_PLATFORM_CYGWIN)
if (strerror_s(error, sizeof(error), errno) != 0) {
SDL_strlcpy(error, "Unknown error", sizeof(error));
}

View file

@ -934,7 +934,9 @@ static int SDLCALL stdlib_sscanf(void *arg)
#pragma GCC diagnostic pop
#endif
#ifdef _WIN64
#if defined(SDL_PLATFORM_CYGWIN)
#define SIZE_FORMAT "zu"
#elif defined(_WIN64)
#define SIZE_FORMAT "I64u"
#elif defined(SDL_PLATFORM_WIN32)
#define SIZE_FORMAT "I32u"