From c2747859a5c0e9588568c8981987c2ab768bbf2e Mon Sep 17 00:00:00 2001 From: Henric Jungheim Date: Sat, 10 Feb 2024 16:45:00 -0700 Subject: [PATCH] Disable WavPack in sdl2-mixer. vcpkg marked it broken for Windows on ARM64. --- .github/workflows/windows.yml | 5 +- .../config-macos/vcpkg-configuration.json | 2 +- .../ports/sdl2-mixer/fix-pkg-prefix.patch | 13 ++++ .../config/ports/sdl2-mixer/portfile.cmake | 64 +++++++++++++++++++ external/vcpkg/config/ports/sdl2-mixer/usage | 4 ++ .../vcpkg/config/ports/sdl2-mixer/vcpkg.json | 56 ++++++++++++++++ .../vcpkg/config/vcpkg-configuration.json | 4 +- 7 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 external/vcpkg/config/ports/sdl2-mixer/fix-pkg-prefix.patch create mode 100644 external/vcpkg/config/ports/sdl2-mixer/portfile.cmake create mode 100644 external/vcpkg/config/ports/sdl2-mixer/usage create mode 100644 external/vcpkg/config/ports/sdl2-mixer/vcpkg.json diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 73cd1b83..8bf72a0a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -71,8 +71,11 @@ jobs: - name: Configure shell: cmd - run: | + run: > cmake -G Ninja --preset "${{matrix.preset}}" "-DTARGET_MSI_NAME=%PROJECT_OUTPUT_NAME%" -S "%PROJECT_SOURCE%" -B "${{env.PROJECT_BUILD}}" + || (dir "%PROJECT_SOURCE%/external/vcpkg/vcpkg/buildtrees/sdl2-mixer" + ; type "%PROJECT_SOURCE%/external/vcpkg/vcpkg/buildtrees/sdl2-mixer/patch-x64-windows-ltcg-static-0-err.log" + ; type "%PROJECT_SOURCE%/external/vcpkg/vcpkg/buildtrees/sdl2-mixer/stdout-x64-windows-ltcg-static.log" - name: Compile shell: cmd diff --git a/external/vcpkg/config-macos/vcpkg-configuration.json b/external/vcpkg/config-macos/vcpkg-configuration.json index ffac774a..05898ac5 100644 --- a/external/vcpkg/config-macos/vcpkg-configuration.json +++ b/external/vcpkg/config-macos/vcpkg-configuration.json @@ -1,6 +1,6 @@ { "overlay-ports": [ - "../config/ports/sdl2" + "../config/ports" ], "overlay-triplets": [ "../config/triplets" diff --git a/external/vcpkg/config/ports/sdl2-mixer/fix-pkg-prefix.patch b/external/vcpkg/config/ports/sdl2-mixer/fix-pkg-prefix.patch new file mode 100644 index 00000000..71fe7847 --- /dev/null +++ b/external/vcpkg/config/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/external/vcpkg/config/ports/sdl2-mixer/portfile.cmake b/external/vcpkg/config/ports/sdl2-mixer/portfile.cmake new file mode 100644 index 00000000..4cfad4ab --- /dev/null +++ b/external/vcpkg/config/ports/sdl2-mixer/portfile.cmake @@ -0,0 +1,64 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libsdl-org/SDL_mixer + REF "release-${VERSION}" + SHA512 e4c9a4418725ce019bb62216c8fd484cf04b34e2099af633d4c84e0e558fe6ba1921e791c5dde319266ffe3a1237f887871c819a249a8df7e9440c36fce181da + PATCHES + fix-pkg-prefix.patch +) + +vcpkg_check_features( + OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + fluidsynth SDL2MIXER_MIDI + 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 + opusfile SDL2MIXER_OPUS + MAYBE_UNUSED_VARIABLES + SDL2MIXER_MP3_DRMP3 +) + +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_MIDI_TIMIDITY=OFF + -DSDL2MIXER_MP3_DRMP3=OFF + -DSDL2MIXER_MOD_XMP_SHARED=${BUILD_SHARED} + -DSDL2MIXER_WAVPACK=OFF +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup( + PACKAGE_NAME "SDL2_mixer" + CONFIG_PATH "lib/cmake/SDL2_mixer" +) +vcpkg_fixup_pkgconfig() + +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/external/vcpkg/config/ports/sdl2-mixer/usage b/external/vcpkg/config/ports/sdl2-mixer/usage new file mode 100644 index 00000000..efcc86b1 --- /dev/null +++ b/external/vcpkg/config/ports/sdl2-mixer/usage @@ -0,0 +1,4 @@ +sdl2-mixer provides CMake targets: + + find_package(SDL2_mixer CONFIG REQUIRED) + target_link_libraries(main PRIVATE $,SDL2_mixer::SDL2_mixer,SDL2_mixer::SDL2_mixer-static>) diff --git a/external/vcpkg/config/ports/sdl2-mixer/vcpkg.json b/external/vcpkg/config/ports/sdl2-mixer/vcpkg.json new file mode 100644 index 00000000..50357675 --- /dev/null +++ b/external/vcpkg/config/ports/sdl2-mixer/vcpkg.json @@ -0,0 +1,56 @@ +{ + "name": "sdl2-mixer", + "version": "2.8.0", + "port-version": 1, + "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 + } + ], + "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" + ] + } + } +} diff --git a/external/vcpkg/config/vcpkg-configuration.json b/external/vcpkg/config/vcpkg-configuration.json index e4efdfc9..43e86dc2 100644 --- a/external/vcpkg/config/vcpkg-configuration.json +++ b/external/vcpkg/config/vcpkg-configuration.json @@ -1,8 +1,8 @@ { "overlay-ports": [ - "./ports/sdl2" + "ports" ], "overlay-triplets": [ - "./triplets" + "triplets" ] }