-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Enables MSys2 MSYS environment to build SDL3 #15514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
028cc5c
2b6213a
efd2a15
cd866f0
90f0897
c0029a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,7 +130,7 @@ list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${SDL_CHECK_REQUIRED_LINK_OPTIONS}) | |
| SDL_DetectCMakePlatform() | ||
|
|
||
| # Don't mistake macOS for unix | ||
| if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT RISCOS) | ||
| if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT RISCOS AND NOT MSYS) | ||
| set(UNIX_SYS ON) | ||
| else() | ||
| set(UNIX_SYS OFF) | ||
|
|
@@ -272,7 +272,7 @@ if(SDL_FRAMEWORK) | |
| set(SDL_STATIC_AVAILABLE FALSE) | ||
| endif() | ||
|
|
||
| if(UNIX AND NOT ANDROID AND NOT RISCOS AND NOT SDL_FRAMEWORK) | ||
| if(UNIX AND NOT ANDROID AND NOT RISCOS AND NOT SDL_FRAMEWORK AND NOT MSYS) | ||
| set(SDL_RPATH_DEFAULT ON) | ||
| else() | ||
| set(SDL_RPATH_DEFAULT OFF) | ||
|
|
@@ -367,16 +367,16 @@ dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" O | |
| dep_option(SDL_RPI "Use Raspberry Pi video driver" ON "SDL_VIDEO;UNIX_SYS;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF) | ||
| dep_option(SDL_ROCKCHIP "Use ROCKCHIP Hardware Acceleration video driver" ON "SDL_VIDEO;UNIX_SYS;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF) | ||
| dep_option(SDL_COCOA "Use Cocoa video driver" ON "APPLE" OFF) | ||
| dep_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ON "SDL_AUDIO OR SDL_VIDEO;WINDOWS" OFF) | ||
| dep_option(SDL_XINPUT "Use Xinput for Windows" ON "WINDOWS" OFF) | ||
| dep_option(SDL_WASAPI "Use the Windows WASAPI audio driver" ON "WINDOWS;SDL_AUDIO" OFF) | ||
| dep_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ON "SDL_AUDIO OR SDL_VIDEO;WINDOWS OR CYGWIN" OFF) | ||
| dep_option(SDL_XINPUT "Use Xinput for Windows" ON "WINDOWS OR CYGWIN" OFF) | ||
| dep_option(SDL_WASAPI "Use the Windows WASAPI audio driver" ON "WINDOWS OR CYGWIN;SDL_AUDIO" OFF) | ||
| dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) | ||
| dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) | ||
| dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) | ||
| dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;APPLE" OFF) | ||
| dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF) | ||
| dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF) | ||
| dep_option(SDL_VULKAN "Enable Vulkan support" "${SDL_VULKAN_DEFAULT}" "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR OPENBSD OR WINDOWS" OFF) | ||
| dep_option(SDL_VULKAN "Enable Vulkan support" "${SDL_VULKAN_DEFAULT}" "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR OPENBSD OR WINDOWS OR CYGWIN" OFF) | ||
| dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF) | ||
| dep_option(SDL_METAL "Enable Metal support" ON "APPLE" OFF) | ||
| set_option(SDL_OPENVR "Use OpenVR video driver" OFF) | ||
|
|
@@ -563,19 +563,6 @@ else() | |
| endif() | ||
| endif() | ||
|
|
||
| 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() | ||
|
Comment on lines
-566
to
-577
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer relevant?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Tim S.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
|
||
| # General includes | ||
| sdl_compile_definitions(PRIVATE "USING_GENERATED_CONFIG_H") | ||
| sdl_include_directories( | ||
|
|
@@ -1128,7 +1115,7 @@ if(SDL_LIBC) | |
| vsnprintf vsscanf | ||
| wcsnlen wcscmp wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr wcstol | ||
| ) | ||
| if(WINDOWS) | ||
| if(WINDOWS OR CYGWIN) | ||
| list(APPEND symbols_to_check | ||
| _copysign _fseeki64 _strrev _ui64toa _uitoa _ultoa _wcsdup | ||
| ) | ||
|
|
@@ -1407,7 +1394,7 @@ if(SDL_CAMERA) | |
| #endif() | ||
| endif() | ||
|
|
||
| if(UNIX OR APPLE) | ||
| if((UNIX OR APPLE) AND (NOT CYGWIN)) | ||
| # Relevant for Unix/Darwin only | ||
| set(DYNAPI_NEEDS_DLOPEN 1) | ||
| CheckDLOPEN() | ||
|
|
@@ -1806,7 +1793,7 @@ elseif(EMSCRIPTEN) | |
| CheckPTHREAD() | ||
| CheckLibUnwind() | ||
|
|
||
| elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) | ||
| elseif(UNIX AND NOT (APPLE OR RISCOS OR HAIKU OR CYGWIN)) | ||
|
|
||
| set(SDL_DISABLE_DLOPEN_NOTES TRUE) | ||
| if(SDL_DLOPEN_NOTES) | ||
|
|
@@ -2197,7 +2184,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) | |
| set (HAVE_VSNPRINTF 0) | ||
| set (USE_POSIX_SPAWN 1) | ||
| endif() | ||
| elseif(WINDOWS) | ||
| elseif(WINDOWS OR CYGWIN) | ||
| enable_language(CXX) | ||
| check_c_source_compiles(" | ||
| #include <windows.h> | ||
|
|
@@ -2231,7 +2218,7 @@ elseif(WINDOWS) | |
| if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) | ||
| set(USE_WINSDK_DIRECTX TRUE) | ||
| endif() | ||
| if(NOT MINGW AND NOT USE_WINSDK_DIRECTX) | ||
| if(NOT (MINGW OR CYGWIN) AND NOT USE_WINSDK_DIRECTX) | ||
| if("$ENV{DXSDK_DIR}" STREQUAL "") | ||
| message(FATAL_ERROR "DIRECTX requires the \$DXSDK_DIR environment variable to be set") | ||
| endif() | ||
|
|
@@ -2250,7 +2237,7 @@ elseif(WINDOWS) | |
| cmake_pop_check_state() | ||
| if(HAVE_D3D9_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) | ||
| set(HAVE_DIRECTX TRUE) | ||
| if(NOT MINGW AND NOT USE_WINSDK_DIRECTX) | ||
| if(NOT (MINGW OR CYGWIN) AND NOT USE_WINSDK_DIRECTX) | ||
| if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
| set(PROCESSOR_ARCH "x64") | ||
| else() | ||
|
|
@@ -3497,7 +3484,7 @@ if (SDL_DIALOG) | |
| if(ANDROID) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/android/SDL_androiddialog.c) | ||
| set(HAVE_SDL_DIALOG TRUE) | ||
| elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) | ||
| elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU AND NOT MSYS) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/unix/SDL_unixdialog.c) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/unix/SDL_portaldialog.c) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/unix/SDL_portaldialog.h) | ||
|
|
@@ -3507,21 +3494,21 @@ if (SDL_DIALOG) | |
| elseif(HAIKU) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/haiku/SDL_haikudialog.cc) | ||
| set(HAVE_SDL_DIALOG TRUE) | ||
| elseif(WINDOWS) | ||
| elseif(WINDOWS OR MSYS) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/windows/SDL_windowsdialog.c) | ||
| set(HAVE_SDL_DIALOG TRUE) | ||
| elseif(MACOS) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/cocoa/SDL_cocoadialog.m) | ||
| set(HAVE_SDL_DIALOG TRUE) | ||
| endif() | ||
| endif() | ||
| if(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) | ||
| if(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU AND NOT MSYS) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/unix/SDL_zenitymessagebox.h) | ||
| sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/unix/SDL_zenitymessagebox.c) | ||
| endif() | ||
|
|
||
| sdl_sources("${SDL3_SOURCE_DIR}/src/process/SDL_process.c") | ||
| if(WINDOWS) | ||
| if(WINDOWS OR MSYS) | ||
| sdl_glob_sources( | ||
| "${SDL3_SOURCE_DIR}/src/process/windows/*.c" | ||
| "${SDL3_SOURCE_DIR}/src/process/windows/*.h" | ||
|
|
||
There was a problem hiding this comment.
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.dllwith no additional dependencies.We already do a mingw build that I believe uses msys already, is that right @madebr?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.