early-access version 2853
This commit is contained in:
166
externals/vcpkg/ports/sdl2-mixer/CMakeLists.txt
vendored
Executable file
166
externals/vcpkg/ports/sdl2-mixer/CMakeLists.txt
vendored
Executable file
@@ -0,0 +1,166 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(SDL2_MIXER C)
|
||||
|
||||
find_path(SDL_INCLUDE_DIR SDL.h PATH_SUFFIXES SDL2)
|
||||
find_package(SDL2 CONFIG REQUIRED)
|
||||
set(SDL_MIXER_INCLUDES ${SDL_INCLUDE_DIR})
|
||||
|
||||
set(SDL_MIXER_LIBRARIES SDL2::SDL2)
|
||||
|
||||
# builtin formats
|
||||
set(SDL_MIXER_DEFINES MUSIC_WAV)
|
||||
|
||||
# MP3 support
|
||||
if(SDL_MIXER_ENABLE_MP3)
|
||||
find_path(MPG123_INCLUDE_DIR mpg123.h)
|
||||
find_library(MPG123_LIBRARY NAMES libmpg123 mpg123)
|
||||
list(APPEND SDL_MIXER_INCLUDES ${MPG123_INCLUDE_DIR})
|
||||
list(APPEND SDL_MIXER_DEFINES MUSIC_MP3_MPG123)
|
||||
list(APPEND SDL_MIXER_LIBRARIES ${MPG123_LIBRARY})
|
||||
if (SDL_DYNAMIC_LOAD)
|
||||
get_filename_component(MPG123_LIBRARY_NAME "${MPG123_LIBRARY}" NAME_WE)
|
||||
list(APPEND SDL_MIXER_LOAD_DEFINES -DMPG123_DYNAMIC="${MPG123_LIBRARY_NAME}${LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# FLAC support
|
||||
if(SDL_MIXER_ENABLE_FLAC)
|
||||
find_path(FLAC_INCLUDE_DIR FLAC/all.h)
|
||||
find_library(FLAC_LIBRARY FLAC)
|
||||
list(APPEND SDL_MIXER_INCLUDES ${FLAC_INCLUDE_DIR})
|
||||
list(APPEND SDL_MIXER_DEFINES MUSIC_FLAC)
|
||||
list(APPEND SDL_MIXER_LIBRARIES ${FLAC_LIBRARY})
|
||||
if (SDL_DYNAMIC_LOAD)
|
||||
get_filename_component(FLAC_LIBRARY_NAME "${FLAC_LIBRARY}" NAME_WE)
|
||||
list(APPEND SDL_MIXER_LOAD_DEFINES -DFLAC_DYNAMIC="${FLAC_LIBRARY_NAME}${LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# MOD support
|
||||
if(SDL_MIXER_ENABLE_MOD)
|
||||
find_path(MODPLUG_INCLUDE_DIR libmodplug/modplug.h)
|
||||
find_library(MODPLUG_LIBRARY modplug)
|
||||
list(APPEND SDL_MIXER_INCLUDES ${MODPLUG_INCLUDE_DIR})
|
||||
list(APPEND SDL_MIXER_DEFINES MUSIC_MOD_MODPLUG)
|
||||
list(APPEND SDL_MIXER_LIBRARIES ${MODPLUG_LIBRARY})
|
||||
if (SDL_DYNAMIC_LOAD)
|
||||
get_filename_component(MODPLUG_LIBRARY_NAME "${MODPLUG_LIBRARY}" NAME_WE)
|
||||
list(APPEND SDL_MIXER_LOAD_DEFINES -DMODPLUG_DYNAMIC="${MODPLUG_LIBRARY_NAME}${LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Ogg-Vorbis support
|
||||
if(SDL_MIXER_ENABLE_OGGVORBIS)
|
||||
find_path(VORBIS_INCLUDE_DIR vorbis/codec.h)
|
||||
find_library(VORBISFILE_LIBRARY vorbisfile)
|
||||
list(APPEND SDL_MIXER_INCLUDES ${VORBIS_INCLUDE_DIR})
|
||||
list(APPEND SDL_MIXER_DEFINES MUSIC_OGG)
|
||||
list(APPEND SDL_MIXER_LIBRARIES ${VORBISFILE_LIBRARY})
|
||||
if (SDL_DYNAMIC_LOAD)
|
||||
get_filename_component(VORBISFILE_LIBRARY_NAME "${VORBISFILE_LIBRARY}" NAME_WE)
|
||||
list(APPEND SDL_MIXER_LOAD_DEFINES -DOGG_DYNAMIC="${VORBISFILE_LIBRARY_NAME}${LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Opus support
|
||||
if(SDL_MIXER_ENABLE_OPUS)
|
||||
find_path(OPUS_INCLUDE_DIR opus/opusfile.h)
|
||||
find_library(OPUSFILE_LIBRARY opusfile)
|
||||
list(APPEND SDL_MIXER_INCLUDES ${OPUS_INCLUDE_DIR})
|
||||
list(APPEND SDL_MIXER_DEFINES MUSIC_OPUS)
|
||||
list(APPEND SDL_MIXER_LIBRARIES ${OPUSFILE_LIBRARY})
|
||||
if (SDL_DYNAMIC_LOAD)
|
||||
get_filename_component(OPUSFILE_LIBRARY_NAME "${OPUSFILE_LIBRARY}" NAME_WE)
|
||||
list(APPEND SDL_MIXER_LOAD_DEFINES -DOPUS_DYNAMIC="${OPUSFILE_LIBRARY_NAME}${LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Fluidsynth support
|
||||
if(SDL_MIXER_ENABLE_FLUIDSYNTH)
|
||||
find_path(FLUIDSYNTH_INCLUDE_DIR fluidsynth.h)
|
||||
find_library(FLUIDSYNTH_LIBRARY fluidsynth)
|
||||
list(APPEND SDL_MIXER_INCLUDES ${FLUIDSYNTH_INCLUDE_DIR})
|
||||
list(APPEND SDL_MIXER_DEFINES MUSIC_MID_FLUIDSYNTH)
|
||||
list(APPEND SDL_MIXER_LIBRARIES ${FLUIDSYNTH_LIBRARY})
|
||||
if (SDL_DYNAMIC_LOAD)
|
||||
get_filename_component(FLUIDSYNTH_LIBRARY_NAME "${FLUIDSYNTH_LIBRARY}" NAME_WE)
|
||||
list(APPEND SDL_MIXER_LOAD_DEFINES -DFLUIDSYNTH_DYNAMIC="${FLUIDSYNTH_LIBRARY_NAME}${LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(SDL2_mixer
|
||||
effect_position.c
|
||||
effect_stereoreverse.c
|
||||
effects_internal.c
|
||||
load_aiff.c
|
||||
load_voc.c
|
||||
mixer.c
|
||||
music.c
|
||||
music_cmd.c
|
||||
music_flac.c
|
||||
music_fluidsynth.c
|
||||
music_mad.c
|
||||
music_mikmod.c
|
||||
music_modplug.c
|
||||
music_mpg123.c
|
||||
music_ogg.c
|
||||
music_opus.c
|
||||
music_timidity.c
|
||||
music_wav.c
|
||||
version.rc)
|
||||
|
||||
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})
|
||||
if(WIN32)
|
||||
target_sources(SDL2_mixer PRIVATE native_midi/native_midi_win32.c)
|
||||
target_link_libraries(SDL2_mixer Winmm)
|
||||
elseif(APPLE)
|
||||
target_sources(SDL2_mixer PRIVATE native_midi/native_midi_macosx.c)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(SDL2_mixer PROPERTIES DEFINE_SYMBOL DLL_EXPORT)
|
||||
target_compile_definitions(SDL2_mixer PRIVATE ${SDL_MIXER_DEFINES} ${SDL_MIXER_LOAD_DEFINES})
|
||||
target_include_directories(SDL2_mixer PRIVATE ${SDL_MIXER_INCLUDES} ./native_midi)
|
||||
|
||||
install(TARGETS SDL2_mixer
|
||||
EXPORT SDL2_mixer
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib)
|
||||
|
||||
install(EXPORT SDL2_mixer
|
||||
DESTINATION share/sdl2-mixer/
|
||||
FILE sdl2-mixer-config.cmake
|
||||
NAMESPACE SDL2::
|
||||
)
|
||||
|
||||
set(prefix "")
|
||||
set(exec_prefix [[${prefix}]])
|
||||
set(libdir [[${prefix}/lib]])
|
||||
set(includedir [[${prefix}/include]])
|
||||
set(PACKAGE "SDL2_mixer")
|
||||
file(READ "SDL_mixer.h" header_contents)
|
||||
# #define SDL_MIXER_MAJOR_VERSION 2
|
||||
# #define SDL_MIXER_MINOR_VERSION 0
|
||||
# #define SDL_MIXER_PATCHLEVEL 5
|
||||
string(REGEX MATCH "define *SDL_MIXER_MAJOR_VERSION *([0-9]+)" _ "${header_contents}")
|
||||
set(VERSION ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "define *SDL_MIXER_MINOR_VERSION *([0-9]+)" _ "${header_contents}")
|
||||
string(APPEND VERSION ".${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "define *SDL_MIXER_PATCHLEVEL *([0-9]+)" _ "${header_contents}")
|
||||
string(APPEND VERSION ".${CMAKE_MATCH_1}")
|
||||
set(SDL_VERSION 0.0)
|
||||
configure_file(SDL2_mixer.pc.in "${CMAKE_CURRENT_BINARY_DIR}/SDL2_mixer.pc" @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SDL2_mixer.pc DESTINATION lib/pkgconfig)
|
||||
|
||||
if(NOT SDL_MIXER_SKIP_HEADERS)
|
||||
install(FILES SDL_mixer.h DESTINATION include/SDL2)
|
||||
endif()
|
||||
|
||||
message(STATUS "Link-time dependencies:")
|
||||
foreach(LIBRARY ${SDL_MIXER_LIBRARIES})
|
||||
message(STATUS " " ${LIBRARY})
|
||||
endforeach()
|
||||
47
externals/vcpkg/ports/sdl2-mixer/fix-featurempg123.patch
vendored
Executable file
47
externals/vcpkg/ports/sdl2-mixer/fix-featurempg123.patch
vendored
Executable file
@@ -0,0 +1,47 @@
|
||||
diff --git a/music_mpg123.c b/music_mpg123.c
|
||||
index cd151b9..b4294ab 100644
|
||||
--- a/music_mpg123.c
|
||||
+++ b/music_mpg123.c
|
||||
@@ -31,7 +31,11 @@
|
||||
#include "music_mpg123.h"
|
||||
|
||||
#include <mpg123.h>
|
||||
-
|
||||
+#ifdef _MSC_VER
|
||||
+typedef ptrdiff_t MIX_SSIZE_T;
|
||||
+#else
|
||||
+typedef ssize_t MIX_SSIZE_T;
|
||||
+#endif
|
||||
|
||||
typedef struct {
|
||||
int loaded;
|
||||
@@ -49,7 +53,7 @@ typedef struct {
|
||||
const char* (*mpg123_plain_strerror)(int errcode);
|
||||
void (*mpg123_rates)(const long **list, size_t *number);
|
||||
int (*mpg123_read)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done );
|
||||
- int (*mpg123_replace_reader_handle)( mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) );
|
||||
+ int (*mpg123_replace_reader_handle)( mpg123_handle *mh, MIX_SSIZE_T (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) );
|
||||
off_t (*mpg123_seek)( mpg123_handle *mh, off_t sampleoff, int whence );
|
||||
const char* (*mpg123_strerror)(mpg123_handle *mh);
|
||||
} mpg123_loader;
|
||||
@@ -96,7 +100,7 @@ static int MPG123_Load(void)
|
||||
FUNCTION_LOADER(mpg123_plain_strerror, const char* (*)(int errcode))
|
||||
FUNCTION_LOADER(mpg123_rates, void (*)(const long **list, size_t *number));
|
||||
FUNCTION_LOADER(mpg123_read, int (*)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done ))
|
||||
- FUNCTION_LOADER(mpg123_replace_reader_handle, int (*)( mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) ))
|
||||
+ FUNCTION_LOADER(mpg123_replace_reader_handle, int (*)( mpg123_handle *mh, MIX_SSIZE_T (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) ))
|
||||
FUNCTION_LOADER(mpg123_seek, off_t (*)( mpg123_handle *mh, off_t sampleoff, int whence ))
|
||||
FUNCTION_LOADER(mpg123_strerror, const char* (*)(mpg123_handle *mh))
|
||||
}
|
||||
@@ -181,9 +185,9 @@ static char const* mpg_err(mpg123_handle* mpg, int result)
|
||||
}
|
||||
|
||||
/* we're gonna override mpg123's I/O with these wrappers for RWops */
|
||||
-static ssize_t rwops_read(void* p, void* dst, size_t n)
|
||||
+static MIX_SSIZE_T rwops_read(void* p, void* dst, size_t n)
|
||||
{
|
||||
- return (ssize_t)SDL_RWread((SDL_RWops*)p, dst, 1, n);
|
||||
+ return (MIX_SSIZE_T )SDL_RWread((SDL_RWops*)p, dst, 1, n);
|
||||
}
|
||||
|
||||
static off_t rwops_seek(void* p, off_t offset, int whence)
|
||||
60
externals/vcpkg/ports/sdl2-mixer/portfile.cmake
vendored
Executable file
60
externals/vcpkg/ports/sdl2-mixer/portfile.cmake
vendored
Executable file
@@ -0,0 +1,60 @@
|
||||
set(SDL2_MIXER_VERSION 2.0.4)
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-${SDL2_MIXER_VERSION}.zip"
|
||||
FILENAME "SDL2_mixer-${SDL2_MIXER_VERSION}.zip"
|
||||
SHA512 359b4f9877804f9c4b3cb608ca6082aab684f07a20a816ab71c8cdf85d26f76d67eeb5aee44daf52b7935d82aa3b45941f8f53f07ca3dd5150d6c58ed99e1492
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
REF ${SDL2_MIXER_VERSION}
|
||||
PATCHES
|
||||
fix-featurempg123.patch
|
||||
)
|
||||
|
||||
if ("dynamic-load" IN_LIST FEATURES)
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
message("Building static library, disable dynamic loading")
|
||||
elseif (NOT "mpg123" IN_LIST FEATURES
|
||||
AND NOT "libflac" IN_LIST FEATURES
|
||||
AND NOT "libmodplug" IN_LIST FEATURES
|
||||
AND NOT "libvorbis" IN_LIST FEATURES
|
||||
AND NOT "opusfile" IN_LIST FEATURES
|
||||
)
|
||||
message("No features selected, dynamic loading will not be enabled")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
dynamic-load SDL_DYNAMIC_LOAD
|
||||
mpg123 SDL_MIXER_ENABLE_MP3
|
||||
libflac SDL_MIXER_ENABLE_FLAC
|
||||
libmodplug SDL_MIXER_ENABLE_MOD
|
||||
libvorbis SDL_MIXER_ENABLE_OGGVORBIS
|
||||
opusfile SDL_MIXER_ENABLE_OPUS
|
||||
nativemidi SDL_MIXER_ENABLE_NATIVEMIDI
|
||||
fluidsynth SDL_MIXER_ENABLE_FLUIDSYNTH
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
-DLIBRARY_SUFFIX=${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX} # It should always be dynamic suffix
|
||||
OPTIONS_DEBUG
|
||||
-DSDL_MIXER_SKIP_HEADERS=ON
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_cmake_config_fixup()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/COPYING.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
65
externals/vcpkg/ports/sdl2-mixer/vcpkg.json
vendored
Executable file
65
externals/vcpkg/ports/sdl2-mixer/vcpkg.json
vendored
Executable file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "sdl2-mixer",
|
||||
"version": "2.0.4",
|
||||
"port-version": 16,
|
||||
"description": "Multi-channel audio mixer library for SDL.",
|
||||
"homepage": "https://www.libsdl.org/projects/SDL_mixer",
|
||||
"dependencies": [
|
||||
"sdl2",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
"nativemidi"
|
||||
],
|
||||
"features": {
|
||||
"dynamic-load": {
|
||||
"description": "Load plugins with dynamic call."
|
||||
},
|
||||
"fluidsynth": {
|
||||
"description": "Support for FluidSynth MIDI/SF2 audio format.",
|
||||
"dependencies": [
|
||||
"fluidsynth"
|
||||
]
|
||||
},
|
||||
"libflac": {
|
||||
"description": "Support for FLAC audio format.",
|
||||
"dependencies": [
|
||||
"libflac"
|
||||
]
|
||||
},
|
||||
"libmodplug": {
|
||||
"description": "Support for MOD audio format.",
|
||||
"dependencies": [
|
||||
"libmodplug"
|
||||
]
|
||||
},
|
||||
"libvorbis": {
|
||||
"description": "Support for OGG Vorbis audio format.",
|
||||
"dependencies": [
|
||||
"libvorbis"
|
||||
]
|
||||
},
|
||||
"mpg123": {
|
||||
"description": "Support for MP3 audio format.",
|
||||
"dependencies": [
|
||||
"mpg123"
|
||||
]
|
||||
},
|
||||
"nativemidi": {
|
||||
"description": "Support for MIDI audio format on Windows and macOS."
|
||||
},
|
||||
"opusfile": {
|
||||
"description": "Support for Opus audio format.",
|
||||
"dependencies": [
|
||||
"opusfile"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user