vcpkg/ports/sdl2-mixer/fix-deps-targets.patch
Pierre Wendling 812080c89a
[sdl2-mixer] Update features and fix static linking (#29681)
* [sdl2-mixer] Update features behaviour.

- Reword feature description.
- Disable FLAC and MP3 support when libflac and mpg123 are not selected.
- Make libvorbis a dependency instead of a feature.
Unlike the FLAC/MP3 backends, the vorbis backend cannot be disabled.

* [sdl2-mixer] Remove alternative midi features.

The priority for MIDI backends is: fluidsynth > timidity > nativemidi.

- Turn off implicitely enabled timidity backend which shadows the
nativemidi backend.
- Remove nativemidi as it offers the same functionalities as fluidsynth
but is not available outside of Windows and Apple platforms. Moreover it
may give the false impression that MIDI is supported out of the box

* [sdl2-mixer] Use targets provided by dependencies.

This allows the dependencies to inform the sdl2-mixer about their usage
requirements, making it much easier to statically link the library.

* [sdl2-mixer] FluidSynth now requires pkg-config.

Since 2.3.1#1 FluidSynth's CMake config required pkg-config to find its
dependencies.

* [sdl2-mixer] UWP builds should work again.

* [sdl2-mixer] Update baseline.

* [sdl2-mixer] Add back a dummy libvorbis feature.

This is to keep compatibility with downstream users.

* [sdl2-mixer] Update version.

* [sdl2-mixer] Remove the dummy libvorbis feature.

Since vcpkg tool version 2023-02-16, this is no longer needed.

* [sdl2-mixer] Update version.

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
2023-03-21 12:40:45 -07:00

138 lines
5.0 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54317572..5f84dd22 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -366,7 +366,7 @@ if(SDL2MIXER_OPUS)
endif()
else()
message(STATUS "Using system opusfile")
- find_package(opusfile REQUIRED)
+ find_package(OpusFile CONFIG REQUIRED)
if(NOT SDL2MIXER_OPUS_SHARED)
list(APPEND PC_REQUIRES opusfile)
endif()
@@ -384,7 +384,7 @@ if(SDL2MIXER_OPUS)
add_dependencies(SDL2_mixer opusfile::opusfile)
endif()
else()
- target_link_libraries(SDL2_mixer PRIVATE opusfile::opusfile)
+ target_link_libraries(SDL2_mixer PRIVATE OpusFile::opusfile)
endif()
endif()
@@ -467,7 +467,7 @@ if(SDL2MIXER_VORBIS_VORBISFILE)
endif()
else()
message(STATUS "Using system vorbisfile")
- find_package(vorbisfile REQUIRED)
+ find_package(Vorbis CONFIG REQUIRED)
if(NOT SDL2MIXER_VORBIS_VORBISFILE_SHARED)
list(APPEND PC_REQUIRES vorbisfile)
endif()
@@ -485,7 +485,7 @@ if(SDL2MIXER_VORBIS_VORBISFILE)
add_dependencies(SDL2_mixer vorbisfile::vorbisfile)
endif()
else()
- target_link_libraries(SDL2_mixer PRIVATE vorbisfile::vorbisfile)
+ target_link_libraries(SDL2_mixer PRIVATE Vorbis::vorbisfile)
endif()
endif()
@@ -510,7 +510,7 @@ if(SDL2MIXER_FLAC_LIBFLAC)
endif()
else()
message(STATUS "Using system libflac")
- find_package(FLAC REQUIRED)
+ find_package(FLAC CONFIG REQUIRED)
if(NOT SDL2MIXER_FLAC_LIBFLAC_SHARED)
list(APPEND PC_REQUIRES flac)
endif()
@@ -528,7 +528,7 @@ if(SDL2MIXER_FLAC_LIBFLAC)
add_dependencies(SDL2_mixer FLAC)
endif()
else()
- target_link_libraries(SDL2_mixer PRIVATE FLAC)
+ target_link_libraries(SDL2_mixer PRIVATE FLAC::FLAC)
endif()
endif()
@@ -643,7 +643,7 @@ if(SDL2MIXER_MP3_MPG123)
endif()
else()
message(STATUS "Using system mpg123")
- find_package(MPG123 REQUIRED)
+ find_package(MPG123 CONFIG REQUIRED)
if(NOT SDL2MIXER_MP3_MPG123_SHARED)
list(APPEND PC_REQUIRES libmpg123)
endif()
@@ -661,7 +661,7 @@ if(SDL2MIXER_MP3_MPG123)
add_dependencies(SDL2_mixer MPG123::mpg123)
endif()
else()
- target_link_libraries(SDL2_mixer PRIVATE MPG123::mpg123)
+ target_link_libraries(SDL2_mixer PRIVATE MPG123::libmpg123)
endif()
endif()
@@ -672,7 +672,7 @@ if(SDL2MIXER_MIDI_FLUIDSYNTH)
message(FATAL_ERROR "FluidSynth is not vendored.")
else()
message(STATUS "Using system FluidSynth")
- find_package(FluidSynth REQUIRED)
+ find_package(FluidSynth CONFIG REQUIRED)
if(NOT SDL2MIXER_MIDI_FLUIDSYNTH_SHARED)
list(APPEND PC_REQUIRES fluidsynth)
endif()
@@ -690,7 +690,7 @@ if(SDL2MIXER_MIDI_FLUIDSYNTH)
add_dependencies(SDL2_mixer FluidSynth::FluidSynth)
endif()
else()
- target_link_libraries(SDL2_mixer PRIVATE FluidSynth::FluidSynth)
+ target_link_libraries(SDL2_mixer PRIVATE FluidSynth::libfluidsynth)
endif()
endif()
diff --git a/SDL2_mixerConfig.cmake.in b/SDL2_mixerConfig.cmake.in
index d65a43ce..29866349 100644
--- a/SDL2_mixerConfig.cmake.in
+++ b/SDL2_mixerConfig.cmake.in
@@ -54,7 +54,7 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2_mixer-static-targets.cmake")
include(CMakeFindDependencyMacro)
if(SDL2MIXER_FLAC_LIBFLAC AND NOT SDL2MIXER_VENDORED AND NOT TARGET FLAC::FLAC)
- find_dependency(FLAC)
+ find_dependency(FLAC CONFIG)
endif()
if(SDL2MIXER_MOD_MODPLUG AND NOT SDL2MIXER_VENDORED AND NOT TARGET modplug::modplug)
@@ -69,20 +69,23 @@ include(CMakeFindDependencyMacro)
find_dependency(libxmp-lite)
endif()
- if(SDL2MIXER_MP3_MPG123 AND NOT SDL2MIXER_VENDORED AND NOT TARGET MPG123::mpg123)
- find_dependency(MPG123)
+ if(SDL2MIXER_MP3_MPG123 AND NOT SDL2MIXER_VENDORED AND NOT TARGET MPG123::libmpg123)
+ find_dependency(MPG123 CONFIG)
endif()
- if(SDL2MIXER_MIDI_FLUIDSYNTH AND NOT SDL2MIXER_VENDORED AND NOT TARGET FluidSynth::FluidSynth)
- find_dependency(FluidSynth)
+ if(SDL2MIXER_MIDI_FLUIDSYNTH AND NOT SDL2MIXER_VENDORED AND NOT TARGET FluidSynth::libfluidsynth)
+ find_dependency(FluidSynth CONFIG)
endif()
if(SDL2MIXER_VORBIS_TREMOR AND NOT SDL2MIXER_VENDORED AND NOT TARGET tremor::tremor)
find_dependency(tremor)
endif()
- if(SDL2MIXER_VORBIS_VORBISFILE AND NOT SDL2MIXER_VENDORED AND NOT TARGET vorbisfile::vorbisfile)
- find_dependency(vorbisfile)
+ if(SDL2MIXER_VORBIS_VORBISFILE AND NOT SDL2MIXER_VENDORED AND NOT TARGET Vorbis::vorbisfile)
+ find_dependency(Vorbis CONFIG)
+ endif()
+ if(SDL2MIXER_OPUS AND NOT SDL2MIXER_VENDORED AND NOT TARGET OpusFile::opusfile)
+ find_dependency(OpusFile CONFIG)
endif()
if((NOT SDL2MIXER_VENDORED AND SDL2MIXER_MOD_MODPLUG) OR (HAIKU AND SDL2MIXER_MIDI_NATIVE))