-
Notifications
You must be signed in to change notification settings - Fork 435
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
Fix FindSDL to work with SDL built with MSVC and CMake #553
Comments
Hi, This is strange. Yes, you're right, this is an implementation detail and as such you should only need to enable Is there something special about your setup? What CMake flags do you use to build Corrade and Magnum? Is |
Found it. I've been setting up all the The Please expose |
If you set |
Since CMake 3.12, It needs a CMake policy enabled to work, I can push the needed changes. Then you should get the expected behavior either by setting |
It's fine with Using |
Actually, that's what I wanted to avoid by using a builtin CMake feature -- to not have to update twenty or how many Find modules 😅 But maybe CMake can do that on its own, I'll investigate. For Config modules CMake auto-creates cache
If you tell me how the SDL directory you have is organized, I can fix that. Currently the Find module is adapted to layout of the official MSVC and MinGW binary distribution (the ZIP file from the website), so if you have something else it may not work. |
It doesn't create FOO_DIR. My normal workflow is repeatedly generating, looking for errors and filling up
This is a shared MSVC build of SDL2 straight from their repo: dev/magnum/install % ls -ld cmake/SDL2Config.cmake bin/SDL2.dll lib/SDL2*
-rwxr-xr-x 1 sthalik None 1956352 Feb 16 13:40 bin/SDL2.dll
-rw-r--r-- 1 sthalik None 5385 Feb 16 13:30 cmake/SDL2Config.cmake
-rw-r--r-- 1 sthalik None 174356 Feb 16 13:39 lib/SDL2.lib
-rw-r--r-- 1 sthalik None 174678 Feb 16 13:40 lib/SDL2main.lib |
It does, as the documentation says, when For SDL, would this simple patch make the DLL found? diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake
index 800d26457..311b05211 100644
--- a/modules/FindSDL2.cmake
+++ b/modules/FindSDL2.cmake
@@ -168,10 +168,10 @@ find_path(SDL2_INCLUDE_DIR
if(CORRADE_TARGET_WINDOWS)
find_file(SDL2_DLL_RELEASE
NAMES SDL2.dll
- PATH_SUFFIXES ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX})
+ PATH_SUFFIXES bin ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX})
find_file(SDL2_DLL_DEBUG
NAMES SDL2d.dll # not sure?
- PATH_SUFFIXES ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX})
+ PATH_SUFFIXES bin ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX})
endif()
# (Static) macOS / iOS dependencies. On macOS these were mainly needed when Oh and I see |
The patch is correct. Also, the |
Just for the record (forgot to update this issue), the patch was merged as 317d67f. I still need to look into using the |
Autodetection of GL context type in
src/Magnum/Platform/CMakeLists.txt
fails due to OS flags not being set. This should be hit, but isn't:This results in a build error:
The solution is to manually enable
WITH_WGLCONTEXT
at build time for Magnum. But this shouldn't happen, as context type is an implementation detail for Magnum and isn't mentioned anywhere inside the documentation?The text was updated successfully, but these errors were encountered: