libsdl-org / SDL_mixer

An audio mixer that supports various file formats for Simple Directmedia Layer.
zlib License
432 stars 147 forks source link

cmake: allow building SDL_mixer with not all dependencies present + disable libflac by default #555

Closed madebr closed 1 year ago

madebr commented 1 year ago

fixes #553

sezero commented 1 year ago

Make drflac and libflac mutually exclusive. By default, drflac is used.

Note that, as far as I can see, the issue doesn't happen with the drmp3 / mpg123 pair or with the libxmp / libmodplug pair: only happens with the drflac / libflac.

madebr commented 1 year ago

You can still configure with -DSDL3MIXER_MP3_DRMP3=ON -DSDL3MIXER_MP3_MPG123=ON. This pr also added a small post-configuration summary of enabled/disabled backends.

sezero commented 1 year ago

You can still configure with -DSDL3MIXER_MP3_DRMP3=ON -DSDL3MIXER_MP3_MPG123=ON.

Yes, but now that you made drflac and libflac mutually exclusive, the same won't be true for them: That's why I added my note.

madebr commented 1 year ago

You can still configure with -DSDL3MIXER_MP3_DRMP3=ON -DSDL3MIXER_MP3_MPG123=ON.

Yes, but now that you made drflac and libflac mutually exclusive, the same won't be true for them: That's why I added my note.

Sorry for me being so verbose, your use of the word "issue" confused me.

sezero commented 1 year ago

FWIW, the following 'remedies' the original issue I reported

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d344b77..c28ff08 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -101,7 +101,7 @@ option(SDL3MIXER_SNDFILE_SHARED "Dynamically load libsndfile" "${SDL3MIXER_DEPS_

 option(SDL3MIXER_FLAC "Enable FLAC music" ON)

-cmake_dependent_option(SDL3MIXER_FLAC_LIBFLAC "Enable FLAC music using libFLAC" ON SDL3MIXER_FLAC OFF)
+cmake_dependent_option(SDL3MIXER_FLAC_LIBFLAC "Enable FLAC music using libFLAC" OFF SDL3MIXER_FLAC OFF)
 cmake_dependent_option(SDL3MIXER_FLAC_LIBFLAC_SHARED "Dynamically load LIBFLAC" "${SDL3MIXER_DEPS_SHARED}" SDL3MIXER_FLAC_LIBFLAC OFF)

 cmake_dependent_option(SDL3MIXER_FLAC_DRFLAC "Enable FLAC music using drflac" ON SDL3MIXER_FLAC OFF)
sezero commented 1 year ago

P.S.: Having an equivalent of it for SDL2 branch would be good (or at least a bare minimum fix for drflac/libfac thing).

P.S./2: Having an equivalent of this for SDL_image would be good.