aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/sdl2-mixer
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/sdl2-mixer')
-rw-r--r--vcpkg/ports/sdl2-mixer/fix-pkg-prefix.patch13
-rw-r--r--vcpkg/ports/sdl2-mixer/portfile.cmake80
-rw-r--r--vcpkg/ports/sdl2-mixer/usage4
-rw-r--r--vcpkg/ports/sdl2-mixer/vcpkg.json68
4 files changed, 165 insertions, 0 deletions
diff --git a/vcpkg/ports/sdl2-mixer/fix-pkg-prefix.patch b/vcpkg/ports/sdl2-mixer/fix-pkg-prefix.patch
new file mode 100644
index 0000000..71fe784
--- /dev/null
+++ b/vcpkg/ports/sdl2-mixer/fix-pkg-prefix.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dc37b28..d139596 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -907,7 +907,7 @@ if(SDL2MIXER_INSTALL)
+ endif()
+
+ ##### export files #####
+- if(WIN32 AND NOT MINGW)
++ if(0)
+ set(SDLMIXER_INSTALL_CMAKEDIR_DEFAULT "cmake")
+ else()
+ set(SDLMIXER_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2_mixer")
diff --git a/vcpkg/ports/sdl2-mixer/portfile.cmake b/vcpkg/ports/sdl2-mixer/portfile.cmake
new file mode 100644
index 0000000..429592e
--- /dev/null
+++ b/vcpkg/ports/sdl2-mixer/portfile.cmake
@@ -0,0 +1,80 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libsdl-org/SDL_mixer
+ REF "release-${VERSION}"
+ SHA512 653ec1f0af0b749b9ed0acd3bfcaa40e1e1ecf34af3127eb74019502ef42a551de226daef4cc89e6a51715f013e0ba0b1e48ae17d6aeee931271f2d10e82058a
+ PATCHES
+ fix-pkg-prefix.patch
+)
+
+vcpkg_check_features(
+ OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ fluidsynth SDL2MIXER_MIDI_FLUIDSYNTH
+ libflac SDL2MIXER_FLAC
+ libflac SDL2MIXER_FLAC_LIBFLAC
+ libmodplug SDL2MIXER_MOD
+ libmodplug SDL2MIXER_MOD_MODPLUG
+ mpg123 SDL2MIXER_MP3
+ mpg123 SDL2MIXER_MP3_MPG123
+ timidity SDL2MIXER_MIDI_TIMIDITY
+ wavpack SDL2MIXER_WAVPACK
+ wavpack SDL2MIXER_WAVPACK_DSD
+ opusfile SDL2MIXER_OPUS
+)
+
+if("fluidsynth" IN_LIST FEATURES OR "timidity" IN_LIST FEATURES)
+ list(APPEND FEATURE_OPTIONS "-DSDL2MIXER_MIDI=ON")
+else()
+ list(APPEND FEATURE_OPTIONS "-DSDL2MIXER_MIDI=OFF")
+endif()
+
+if("fluidsynth" IN_LIST FEATURES)
+ vcpkg_find_acquire_program(PKGCONFIG)
+ list(APPEND EXTRA_OPTIONS "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}")
+endif()
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ ${EXTRA_OPTIONS}
+ -DSDL2MIXER_VENDORED=OFF
+ -DSDL2MIXER_SAMPLES=OFF
+ -DSDL2MIXER_DEPS_SHARED=OFF
+ -DSDL2MIXER_OPUS_SHARED=OFF
+ -DSDL2MIXER_VORBIS_VORBISFILE_SHARED=OFF
+ -DSDL2MIXER_VORBIS="VORBISFILE"
+ -DSDL2MIXER_FLAC_DRFLAC=OFF
+ -DSDL2MIXER_MIDI_NATIVE=OFF
+ -DSDL2MIXER_MP3_DRMP3=OFF
+ -DSDL2MIXER_MOD_XMP_SHARED=${BUILD_SHARED}
+ MAYBE_UNUSED_VARIABLES
+ SDL2MIXER_MP3_DRMP3
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup(
+ PACKAGE_NAME "SDL2_mixer"
+ CONFIG_PATH "lib/cmake/SDL2_mixer"
+)
+vcpkg_fixup_pkgconfig()
+
+set(debug_libname "SDL2_mixerd")
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/SDL2_mixer.pc" "-lSDL2_mixer" "-lSDL2_mixer-static")
+ set(debug_libname "SDL2_mixer-staticd")
+endif()
+
+if(NOT VCPKG_BUILD_TYPE)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/SDL2_mixer.pc" "-lSDL2_mixer" "-l${debug_libname}")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
diff --git a/vcpkg/ports/sdl2-mixer/usage b/vcpkg/ports/sdl2-mixer/usage
new file mode 100644
index 0000000..efcc86b
--- /dev/null
+++ b/vcpkg/ports/sdl2-mixer/usage
@@ -0,0 +1,4 @@
+sdl2-mixer provides CMake targets:
+
+ find_package(SDL2_mixer CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SDL2_mixer::SDL2_mixer>,SDL2_mixer::SDL2_mixer,SDL2_mixer::SDL2_mixer-static>)
diff --git a/vcpkg/ports/sdl2-mixer/vcpkg.json b/vcpkg/ports/sdl2-mixer/vcpkg.json
new file mode 100644
index 0000000..9dc0c1c
--- /dev/null
+++ b/vcpkg/ports/sdl2-mixer/vcpkg.json
@@ -0,0 +1,68 @@
+{
+ "name": "sdl2-mixer",
+ "version": "2.8.1",
+ "port-version": 2,
+ "description": "Multi-channel audio mixer library for SDL.",
+ "homepage": "https://github.com/libsdl-org/SDL_mixer",
+ "license": "Zlib",
+ "dependencies": [
+ "libvorbis",
+ {
+ "name": "sdl2",
+ "default-features": false
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "wavpack"
+ ],
+ "features": {
+ "fluidsynth": {
+ "description": "Use FluidSynth to play MIDI audio format.",
+ "dependencies": [
+ "fluidsynth"
+ ]
+ },
+ "libflac": {
+ "description": "Use libflac to play FLAC audio format.",
+ "dependencies": [
+ "libflac"
+ ]
+ },
+ "libmodplug": {
+ "description": "Use libmodplug to play MOD audio format.",
+ "dependencies": [
+ "libmodplug",
+ "libxmp"
+ ]
+ },
+ "mpg123": {
+ "description": "Use mpg123 to play MP3 audio format.",
+ "dependencies": [
+ "mpg123"
+ ]
+ },
+ "opusfile": {
+ "description": "Use opusfile to play Opus audio format.",
+ "dependencies": [
+ "opusfile"
+ ]
+ },
+ "timidity": {
+ "description": "Use Timidity to play MIDI audio format."
+ },
+ "wavpack": {
+ "description": "Enable WavPack music.",
+ "dependencies": [
+ "wavpack"
+ ]
+ }
+ }
+}