-
Notifications
You must be signed in to change notification settings - Fork 154
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
Don't statically link libxmp #642
Conversation
I cannot reproduce your issue cmake -S path/to/SDL_mixer -B /tmp/SDL_mixer-build --fresh -GNinja -DSDL2MIXER_VENDORED=ON -DCMAKE_INSTALL_PREFIX=/tmp/SDL_mixer-build/prefix -DSDL2MIXER_BUILD_SHARED_LIBS=OFF
cmake --build /tmp/SDL_mixer-build
cmake --install /tmp/SDL_mixer-build
Perhaps you have configured with |
The command I am using is
Where
|
Applying this patch on top of the current SDL2 branch, does this patch what you want? --- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -693,6 +693,8 @@ if(SDL2MIXER_MOD_XMP)
find_package(libxmp REQUIRED)
if(TARGET libxmp::xmp_shared AND SDL2MIXER_MOD_XMP_SHARED)
set(tgt_xmp libxmp::xmp_shared)
+ elseif(TARGET libxmp::xmp_shared)
+ set(tgt_xmp libxmp::xmp_shared)
elseif(TARGET libxmp::xmp_static)
set(tgt_xmp libxmp::xmp_static)
else() |
Yes, that patch also does what I would expect. Further simplifying it to --- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -691,7 +691,7 @@ if(SDL2MIXER_MOD_XMP)
else()
message(STATUS "Using system libxmp")
find_package(libxmp REQUIRED)
- if(TARGET libxmp::xmp_shared AND SDL2MIXER_MOD_XMP_SHARED)
+ if(TARGET libxmp::xmp_shared)
set(tgt_xmp libxmp::xmp_shared)
elseif(TARGET libxmp::xmp_static)
set(tgt_xmp libxmp::xmp_static) also works. Let me know if I need to update this PR to do this patch instead. Personally I don't particularly care about the vendored dependency case so I can leave that part as it is if you think that is better. Also in my opening comment earlier on I confused the |
Your patch looks fine too :) |
Thanks for accepting this fix! I also appreciate that SDL 2.x.x is still getting regular releases. I request the same for SDL2 branches on the SDL satellite libraries, because I have noticed a couple of good fixes across all satellite libraries. |
This needs porting to SDL3 branch too (as noted in the ticket's original message.) |
Should I open the port PR? |
Yes please |
The
libxmp
dependency seems to be inconsistently handled when building withSDL2MIXER_DEPS_SHARED=0
. Every other library uses "standard dynamic linking" instead of the "SDL style dynamic linking" (apologies if this is wrong terminology, but I don't know what else to call it). Butlibxmp
does an actual static linking, which increases the size ofSDL_mixer
shared library. I would expect it to do the "standard dynamic linking" when I passSDL2MIXER_DEPS_SHARED=0
.This is a cmake only issue, the autotools build handles this as expected. This fix if accepted, needs to be frontported to SDL3 branch as well I believe.