Skip to content

Enables MSys2 MSYS environment to build SDL3#15514

Closed
stahta01 wants to merge 6 commits into
libsdl-org:mainfrom
stahta01:msys_main_CI
Closed

Enables MSys2 MSYS environment to build SDL3#15514
stahta01 wants to merge 6 commits into
libsdl-org:mainfrom
stahta01:msys_main_CI

Conversation

@stahta01

@stahta01 stahta01 commented May 5, 2026

Copy link
Copy Markdown
Contributor
  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").
    This PR contains code from PR fix building on CYGWIN #15457

Description

This PR is based on the PR #15457.
The major difference is the PR enable MSYS to build SDL3.
The warning reduction changes are very different in header "SDL_platform_defines.h".
The method to get "d3d12.h" to work is very different.
This PR adds msys CI support and the tests runs.

Existing Issue(s)

Comment thread include/SDL3/SDL_stdinc.h Outdated
Comment thread src/dialog/windows/SDL_windowsdialog.c Outdated
Comment thread src/gpu/d3d12/SDL_gpu_d3d12.c Outdated
Comment thread src/video/directx/SDL_d3d12.h
Comment thread include/SDL3/SDL_egl.h Outdated
Comment thread include/SDL3/SDL_opengl.h Outdated
Comment thread include/SDL3/SDL_opengl.h Outdated
Comment thread include/SDL3/SDL_opengl.h Outdated
Comment thread include/SDL3/SDL_opengl_glext.h Outdated
Comment thread include/SDL3/SDL_platform_defines.h Outdated
@stahta01

stahta01 commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

I decided that most of your rejections can be reduced down to using defined(SDL_PLATFORM_MSYS) when just defined(SDL_PLATFORM_CYGWIN) or defined(__CYGWIN__) would work better or just a well.

So, I am doing those changes and others you posted.

Tim S.

@stahta01 stahta01 force-pushed the msys_main_CI branch 7 times, most recently from f73c392 to 76fec34 Compare May 5, 2026 19:33
@stahta01 stahta01 closed this May 5, 2026
@stahta01 stahta01 reopened this May 5, 2026
@stahta01 stahta01 marked this pull request as ready for review May 5, 2026 19:57
@stahta01

stahta01 commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

Doing many casts in C programming when it is not needed can be a way to hiding programming mistakes after future changes. And if is cleaner to use defines like I have is the correct thing to do! When I was asked to revert my changes in "SDL3/SDL_stdinc.h" and use casts instead I considered that to be a major programming ethical violation! So, either understand or get someone else to either approved or reject this PR. Because I also am finished with it.

stahta01 and others added 6 commits May 12, 2026 11:19
Co-authored-by: TrueCat17 <truecat17@gmail.com>
under Cygwin or MSYS build enviroments
Many ideas are likely from PR 15457

Co-authored-by: TrueCat17 <truecat17@gmail.com>
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

[sdl-ci-filter msys2-msys]

class SharedLibType(Enum):
WIN32 = "SDL3.dll"
MSYS = "msys-SDL3-0.dll"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't done a full review, but the output of the build should be a compatible SDL3.dll with no additional dependencies.

We already do a mingw build that I believe uses msys already, is that right @madebr?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page explains the msys2 environments.
msys is the posix-like build environment, used as a base to target multiple platforms (mingw32, mingw64, clang32, clang64, clangarm64, ucrt64, ...)

Looking at what packages the msys layer provides,all packages are meant for developers, not for users.

I don't think this layer is meant for shipping guis and other user facing programs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MSYS environment under MSys2 is like Cygwin and needs an extra dll to provide some Unix like support.

And you are correct that the MSys2 people have no desire to support GUIs via MSYS environment.

Tim S.

@stahta01 stahta01 May 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you all approve the first 3 commits that support both Cygwin and MSYS builds?
Because I am willing to support the MSYS part just by myself patching the MSys2 [arch Linux style] package I have already created. I could then do a slight rename of the PR to match the change.

Comment thread CMakeLists.txt
Comment on lines -566 to -577
if(CYGWIN)
# We build SDL on cygwin without the UNIX emulation layer
sdl_include_directories(PUBLIC SYSTEM "/usr/include/mingw")
cmake_push_check_state()
string(APPEND CMAKE_REQUIRED_FLAGS " -mno-cygwin")
check_c_source_compiles("int main(int argc, char **argv) { return 0; }"
HAVE_GCC_NO_CYGWIN)
cmake_pop_check_state()
if(HAVE_GCC_NO_CYGWIN)
sdl_shared_link_options("-mno-cygwin")
endif()
endif()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer relevant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct it has not been relevant for about 10 years. Note: The few people using Cygwin 32 might still need it.

Tim S.

@stahta01 stahta01 May 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is a stopper, I can skip removing it at this time. This line is likely needed to be removed to get the CYGWIN CI posted in the other PR to work. And the comment above this line, partly goes with this line.
sdl_include_directories(PUBLIC SYSTEM "/usr/include/mingw")

Tim S.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about cygwin. @sezero might know.

I don't think this is a blocker.
If you're building SDL3 on the cygwin/msys platform, you're also subscribing to its family of runtime dependencies.

@stahta01

Copy link
Copy Markdown
Contributor Author

I did not resolve the two conversations because to me they are closely related and needs to be resolved togother.

@stahta01

Copy link
Copy Markdown
Contributor Author

I have decided to do the Cygwin PR that I have a branch for because the number of people want SDL3 under MSYS is smaller than the number people wanting it under CYGWIN

@stahta01 stahta01 mentioned this pull request May 12, 2026
1 task
@stahta01

Copy link
Copy Markdown
Contributor Author

Please give feedback on which one is more likely to get approved, and I will close one of them

@slouken

slouken commented May 13, 2026

Copy link
Copy Markdown
Collaborator

The Cygwin build PR is more likely to be approved.

@stahta01

Copy link
Copy Markdown
Contributor Author

The Cygwin build PR is more likely to be approved.

Okay I am closing this one.

@stahta01 stahta01 closed this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants