[sdl2-mixer] Fix FLAC symbol export when static linking, add nativemidi default feature (#12374)

* [sdl2-mixer] Fix FLAC symbol export when static linking

Fix regression introduced by #11152

* [sdl2-mixer] Add nativemidi default feature

Closes #10318

* [libsndfile] Revert to port version 8 as version 10

* [libflac] Use BUILD_SHARED_LIBS to properly export FLAC__NO_DLL via CMake

* [libflac] Force FLAC__NO_DLL in installed headers in static triplets

* [libflac] Modify headers on installation
This commit is contained in:
Kevin Lu 2020-07-31 14:23:27 -04:00 committed by GitHub
parent 4b0f9cbaec
commit 62d4320409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 9 deletions

View File

@ -1,5 +1,6 @@
Source: libflac
Version: 1.3.3-1
Version: 1.3.3
Port-Version: 2
Homepage: https://xiph.org/flac/
Description: Library for manipulating FLAC files
Build-Depends: libogg

View File

@ -9,6 +9,12 @@ vcpkg_from_github(
"${CMAKE_CURRENT_LIST_DIR}/uwp-createfile2.patch"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(BUILD_SHARED_LIBS ON)
else()
set(BUILD_SHARED_LIBS OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
@ -16,7 +22,8 @@ vcpkg_configure_cmake(
-DBUILD_PROGRAMS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_DOCS=OFF
-DBUILD_TESTING=OFF)
-DBUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS})
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(
@ -28,6 +35,26 @@ vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/FLAC/export.h
"#if defined(FLAC__NO_DLL)"
"#if 0"
)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h
"#if defined(FLAC__NO_DLL)"
"#if 0"
)
else()
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/FLAC/export.h
"#if defined(FLAC__NO_DLL)"
"#if 1"
)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h
"#if defined(FLAC__NO_DLL)"
"#if 1"
)
endif()
# This license (BSD) is relevant only for library - if someone would want to install
# FLAC cmd line tools as well additional license (GPL) should be included
file(COPY ${SOURCE_PATH}/COPYING.Xiph DESTINATION ${CURRENT_PACKAGES_DIR}/share/libflac)

View File

@ -1,5 +1,6 @@
Source: libsndfile
Version: 1.0.29-9
Version: 1.0.29
Port-Version: 10
Description: Library to read, write and manipulate many soundfile types. Authored by Eric de Castro Lopo
Homepage: https://github.com/erikd/libsndfile
Default-Features: external-libs

View File

@ -19,9 +19,6 @@ option(BUILD_EXECUTABLES "Build sndfile tools and install to folder tools" OFF)
if("external-libs" IN_LIST FEATURES)
set(SNDFILE_WITHOUT_EXTERNAL_LIBS OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(FLAC_EXPORT_DEFINITION "-DFLAC__NO_DLL")
endif()
else()
set(SNDFILE_WITHOUT_EXTERNAL_LIBS ON)
endif()
@ -37,7 +34,6 @@ vcpkg_configure_cmake(
-DENABLE_STATIC_RUNTIME=${CRT_LIB_STATIC}
-DBUILD_STATIC_LIBS=${BUILD_STATIC}
-DDISABLE_EXTERNAL_LIBS=${SNDFILE_WITHOUT_EXTERNAL_LIBS}
-DCMAKE_C_FLAGS=${FLAC_EXPORT_DEFINITION}
OPTIONS_RELEASE
-DBUILD_PROGRAMS=${BUILD_EXECUTABLES}
OPTIONS_DEBUG

View File

@ -91,7 +91,7 @@ add_library(SDL2_mixer
music_wav.c
version.rc)
if(WIN32 OR APPLE)
if((WIN32 OR APPLE) AND SDL_MIXER_ENABLE_NATIVEMIDI)
list(APPEND SDL_MIXER_DEFINES MUSIC_MID_NATIVE)
target_sources(SDL2_mixer PRIVATE music_nativemidi.c native_midi/native_midi_common.c)
target_link_libraries(SDL2_mixer ${SDL_MIXER_LIBRARIES})

View File

@ -1,12 +1,17 @@
Source: sdl2-mixer
Version: 2.0.4-9
Version: 2.0.4
Port-Version: 10
Homepage: https://www.libsdl.org/projects/SDL_mixer
Description: Multi-channel audio mixer library for SDL.
Build-Depends: sdl2
Default-Features: nativemidi
Feature: dynamic-load
Description: Load plugins with dynamic call
Feature: nativemidi
Description: Support for MIDI audio format on Windows and macOS.
Feature: libflac
Description: Support for FLAC audio format.
Build-Depends: libflac

View File

@ -34,6 +34,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
libmodplug SDL_MIXER_ENABLE_MOD
libvorbis SDL_MIXER_ENABLE_OGGVORBIS
opusfile SDL_MIXER_ENABLE_OPUS
nativemidi SDL_MIXER_ENABLE_NATIVEMIDI
)
vcpkg_configure_cmake(