diff --git a/.azure/azure-pipelines-android.yml b/.azure/azure-pipelines-android.yml index c12380d8c..a696b473d 100644 --- a/.azure/azure-pipelines-android.yml +++ b/.azure/azure-pipelines-android.yml @@ -55,7 +55,7 @@ variables: # Must be the same as $ANDROID_NDK_HOME see: # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md # We cannot use $ANDROID_NDK_HOME because this is an environment variable, but here, we need a compile-time constant. - NDK: '/usr/local/lib/android/sdk/ndk/27.1.12297006' + NDK: '/usr/local/lib/android/sdk/ndk/27.2.12479018' # All the built binaries, libs and their headers will be installed here PREFIX: '$(DEV)/opt/android' diff --git a/.azure/azure-pipelines-win.yml b/.azure/azure-pipelines-win.yml index ff498d645..a0b85ef52 100644 --- a/.azure/azure-pipelines-win.yml +++ b/.azure/azure-pipelines-win.yml @@ -29,6 +29,7 @@ jobs: artifact-prefix: "fluidsynth" CFLAGS: "/arch:IA32" CXXFLAGS: "/arch:IA32" + CMAKEFLAGS: "-Denable-libinstpatch=0" x64: platform: x64 gtk-bundle: $(gtk-bundle-x64) @@ -36,6 +37,7 @@ jobs: artifact-prefix: "fluidsynth" CFLAGS: "" CXXFLAGS: "" + CMAKEFLAGS: "" pool: vmImage: 'windows-2019' steps: @@ -56,14 +58,18 @@ jobs: curl -LfsS -o libsndfile-dev.zip $(libsndfile-url) || exit -1 7z x -aos -- gtk-bundle-dev.zip > NUL || exit -1 7z x -aos -- libsndfile-dev.zip > NUL || exit -1 - REM need to fix the naming of libsndfile otherwise the linker won't find it - mv lib\libsndfile-1.lib lib\sndfile.lib || exit -1 - mv lib\libsndfile-1.def lib\sndfile.def || exit -1 + rm *.zip + cd libsndfile-* + cp -rf * .. + cd .. + rm -rf libsndfile-* cd $(Build.ArtifactStagingDirectory)\libinstpatch-XP-$(platform) cp -rf * d:\deps\ mv -f * .. cd .. rmdir $(Build.ArtifactStagingDirectory)\libinstpatch-XP-$(platform)\ + cd d:\deps + dir DEL /F C:\Strawberry\perl\bin\pkg-config.bat displayName: 'Prerequisites' - script: | @@ -71,7 +77,7 @@ jobs: SET "PATH=d:\deps\bin;%PATH%" pkg-config --list-all mkdir build && cd build || exit -1 - cmake -Werror=dev -A $(platform) -T $(toolset) -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -Denable-readline=0 -Denable-floats=1 -Denable-jack=0 -Denable-sdl2=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 -Dwindows-version=0x0501 .. || exit -1 + cmake -Werror=dev -A $(platform) -T $(toolset) -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -Denable-readline=0 -Denable-floats=1 -Denable-jack=0 -Denable-sdl2=0 $(CMAKEFLAGS) -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 -Dwindows-version=0x0501 .. || exit -1 cmake --build . --config Release --parallel 3 || exit -1 displayName: 'Compile fluidsynth' - script: | @@ -135,9 +141,13 @@ jobs: curl -LfsS -o libsndfile-dev.zip $(libsndfile-url) || exit -1 7z x -aos -- gtk-bundle-dev.zip > NUL || exit -1 7z x -aos -- libsndfile-dev.zip > NUL || exit -1 - REM need to fix the naming of libsndfile otherwise the linker won't find it - mv lib\libsndfile-1.lib lib\sndfile.lib || exit -1 - mv lib\libsndfile-1.def lib\sndfile.def || exit -1 + rm *.zip + cd libsndfile-* + cp -rf * .. + cd .. + rm -rf libsndfile-* + cd d:\deps + dir DEL /F C:\Strawberry\perl\bin\pkg-config.bat displayName: 'Prerequisites' - script: | @@ -200,9 +210,10 @@ jobs: 7z x -aos -- libsndfile-dev.zip > NUL || exit -1 7z x -aos -- mingw.zip > NUL || exit -1 rm *.zip - REM need to fix the naming of libsndfile otherwise the linker won't find it - mv lib\libsndfile-1.lib lib\sndfile.lib || exit -1 - mv lib\libsndfile-1.def lib\sndfile.def || exit -1 + cd libsndfile-* + cp -rf * .. + cd .. + rm -rf libsndfile-* cd mingw*\ && cp -rf * .. && cd .. && rm -rf mingw* || exit -1 cd $(Build.ArtifactStagingDirectory)\libinstpatch-$(platform) && cp -rf * d:\deps\ && mv -f * .. && cd .. && rmdir $(Build.ArtifactStagingDirectory)\libinstpatch-$(platform)\ || exit -1 DEL /F C:\Strawberry\perl\bin\pkg-config.bat diff --git a/cmake_admin/FindFLAC.cmake b/cmake_admin/FindFLAC.cmake deleted file mode 100644 index 2de2f41a8..000000000 --- a/cmake_admin/FindFLAC.cmake +++ /dev/null @@ -1,106 +0,0 @@ -#[=======================================================================[.rst: -FindFLAC -------- - -Finds the FLAC library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``FLAC::FLAC`` - The FLAC C library. -``FLAC::FLAC++`` - The FLAC C++ library. - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``FLAC_FOUND`` - True if both libraries were found. -``FLAC_FLAC_FOUND`` - True if the C library was found. -``FLAC_FLAC++_FOUND`` - True if the C++ library was found.. - -#]=======================================================================] - -# Use pkg-config if available -find_package(PkgConfig QUIET) -pkg_check_modules(PC_FLAC QUIET flac) -pkg_check_modules(PC_FLAC++ QUIET flac++) - -# Find the headers and libraries -find_path( - FLAC_INCLUDE_DIR - NAMES "FLAC/all.h" - HINTS "PC_FLAC_INCLUDEDIR") - -find_path( - FLAC++_INCLUDE_DIR - NAMES "FLAC++/all.h" - HINTS "PC_FLAC++_INCLUDEDIR") - -find_library( - FLAC_LIBRARY - NAMES "FLAC" - HINTS "${PC_FLAC_LIBDIR}") - -find_library( - FLAC++_LIBRARY - NAMES "FLAC++" - HINTS "${PC_FLAC++_LIBDIR}") - -# Handle transitive dependencies -if(PC_FLAC_FOUND) - get_target_properties_from_pkg_config("${FLAC_LIBRARY}" "PC_FLAC" "_flac") -else() - if(NOT TARGET "Ogg::ogg") - find_package(Ogg QUIET) - endif() - set(_flac_link_libraries "Ogg::ogg" ${MATH_LIBRARY}) -endif() - -if(PC_FLAC++_FOUND) - get_target_properties_from_pkg_config("${FLAC++_LIBRARY}" "PC_FLAC++" - "_flac++") -else() - set(_flac++_link_libraries "FLAC::FLAC") -endif() - -# Forward the result to CMake -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - FLAC REQUIRED_VARS "FLAC_LIBRARY" "FLAC_INCLUDE_DIR" "FLAC++_LIBRARY" - "FLAC++_INCLUDE_DIR") - -# Create the target -if(FLAC_FOUND AND NOT TARGET FLAC::FLAC) - add_library(FLAC::FLAC UNKNOWN IMPORTED) - set_target_properties( - FLAC::FLAC - PROPERTIES IMPORTED_LOCATION "${FLAC_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${_flac_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_flac_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_flac_link_directories}") - set(FLAC_FLAC_FOUND TRUE) -endif() - -if(FLAC_FOUND AND NOT TARGET FLAC::FLAC++) - add_library(FLAC::FLAC++ UNKNOWN IMPORTED) - set_target_properties( - FLAC::FLAC++ - PROPERTIES IMPORTED_LOCATION "${FLAC++_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${_flac++_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${FLAC++_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_flac++_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_flac++_link_directories}") - set(FLAC_FLAC++_FOUND TRUE) -endif() - -mark_as_advanced(FLAC_LIBRARY FLAC_INCLUDE_DIR FLAC++_LIBRARY - FLAC++_INCLUDE_DIR) diff --git a/cmake_admin/FindOgg.cmake b/cmake_admin/FindOgg.cmake deleted file mode 100644 index 8044c9414..000000000 --- a/cmake_admin/FindOgg.cmake +++ /dev/null @@ -1,84 +0,0 @@ -#[=======================================================================[.rst: -FindOgg -------- - -Finds the Ogg library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``Ogg::ogg`` - The Ogg library - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``Ogg_FOUND`` - True if the system has the Ogg library. - -For compatibility with upstream, the following variables are also set: - -``Ogg_INCLUDE_DIR`` -``Ogg_INCLUDE_DIRS`` -``Ogg_LIBRARY`` -``Ogg_LIBRARIES`` -``OGG_INCLUDE_DIR`` -``OGG_INCLUDE_DIRS`` -``OGG_LIBRARY`` -``OGG_LIBRARIES`` -``OGG_FOUND`` - -#]=======================================================================] - -# Use pkg-config if available -find_package(PkgConfig QUIET) -pkg_check_modules(PC_OGG QUIET ogg) - -# Find the headers and library -find_path( - Ogg_INCLUDE_DIR - NAMES "ogg/ogg.h" - HINTS "${PC_OGG_INCLUDEDIR}") - -find_library( - _ogg_library - NAMES "ogg" - HINTS "${PC_OGG_LIBDIR}") - -# Extract additional flags if pkg-config is available -if(PC_OGG_FOUND) - get_target_properties_from_pkg_config("${_ogg_library}" "PC_OGG" "_ogg") -endif() - -# Forward the result to CMake -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Ogg REQUIRED_VARS "_ogg_library" - "Ogg_INCLUDE_DIR") - -# Create the target -if(Ogg_FOUND AND NOT TARGET Ogg::ogg) - add_library(Ogg::ogg UNKNOWN IMPORTED) - set_target_properties( - Ogg::ogg - PROPERTIES IMPORTED_LOCATION "${_ogg_library}" - INTERFACE_COMPILE_OPTIONS "${_ogg_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${Ogg_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_ogg_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_ogg_link_directories}") - - # Set additional variables for compatibility with upstream config - set(Ogg_INCLUDE_DIRS "${Ogg_INCLUDE_DIR}") - set(Ogg_LIBRARY Ogg::ogg) - set(Ogg_LIBRARIES Ogg::ogg) - set(OGG_INCLUDE_DIR "${${Ogg_INCLUDE_DIR}}") - set(OGG_INCLUDE_DIRS "${${Ogg_INCLUDE_DIR}}") - set(OGG_LIBRARY Ogg::ogg) - set(OGG_LIBRARIES Ogg::ogg) - set(OGG_FOUND TRUE) -endif() - -mark_as_advanced(_ogg_library) diff --git a/cmake_admin/FindSndFile.cmake b/cmake_admin/FindSndFile.cmake deleted file mode 100644 index 271bb061f..000000000 --- a/cmake_admin/FindSndFile.cmake +++ /dev/null @@ -1,181 +0,0 @@ -#[=======================================================================[.rst: -FindSndFile -------- - -Finds the SndFile library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``SndFile::sndfile`` - The SndFile library - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``SndFile_FOUND`` - True if the system has the SndFile library. -``SndFile_VERSION`` - The version of the SndFile library which was found. -``SndFile_WITH_EXTERNAL_LIBS`` - True if the library was built with Xiph codecs. - -For compatibility with upstream, the following variables are also set: - -``SndFile_WITH_MPEG`` -``SndFile_VERSION_MAJOR`` -``SndFile_VERSION_MINOR`` -``SndFile_VERSION_PATCH`` -``SndFile_LIBRARY`` -``SndFile_LIBRARIES`` -``SNDFILE_LIBRARY`` -``SNDFILE_LIBRARIES`` -``SNDFILE_INCLUDE_DIR`` - -#]=======================================================================] - -# Use pkg-config if available -find_package(PkgConfig QUIET) -pkg_check_modules(PC_SNDFILE QUIET sndfile) - -# Find the headers and libraries -find_path( - SndFile_INCLUDE_DIR - NAMES "sndfile.h" - HINTS "${PC_SNDFILE_INCLUDEDIR}") - -find_library( - _sndfile_library - NAMES "sndfile" "sndfile-1" - HINTS "${PC_SNDFILE_LIBDIR}") - -# Get version from pkg-config or read the config header -if(PC_SNDFILE_VERSION) - set(SndFile_VERSION "${PC_SNDFILE_VERSION}") - string(REPLACE "." ";" _sndfile_version_list "${SndFile_VERSION}") - list(GET _sndfile_version_list 0 SndFile_VERSION_MAJOR) - list(GET _sndfile_version_list 1 SndFile_VERSION_MINOR) - list(GET _sndfile_version_list 2 SndFile_VERSION_PATCH) -elseif(SndFile_INCLUDE_DIR) - file(READ "${SndFile_INCLUDE_DIR}/sndfile.h" _sndfile_h) - if("#define SNDFILE_1" MATCHES _snfile_h) - set(SndFile_VERSION "1") - set(SndFile_VERSION_MAJOR "1") - endif() -endif() - -# Check the features SndFile was built with -# 2024-01-02: Recent versions of libsndfile don't seem to provide a pkgconfig file and older version who did are lacking private libraries like OGG. -if(FALSE) #PC_SNDFILE_FOUND - if("vorbis" IN_LIST PC_SNDFILE_STATIC_LIBRARIES) - set(SndFile_WITH_EXTERNAL_LIBS TRUE) - endif() - if("mpg123" IN_LIST PC_SNDFILE_STATIC_LIBRARIES) - set(SndFile_WITH_MPEG TRUE) - endif() -elseif(_sndfile_library) - # sndfile may need any of these libraries - find_package(Ogg 1.3 QUIET) - find_package(Vorbis QUIET) - find_package(FLAC QUIET) - find_package(Opus QUIET) - find_package(mp3lame QUIET) - find_package(mpg123 QUIET) - - if(NOT CMAKE_CROSSCOMPILING) - include(CheckSourceRuns) - set(_backup_includes ${CMAKE_REQUIRED_INCLUDES}) - set(_backup_libraries ${CMAKE_REQUIRED_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES "${SndFile_INCLUDE_DIR}") - set(CMAKE_REQUIRED_LIBRARIES "${_sndfile_library}") - - set(_optional_libs "MPG123::libmpg123" "mp3lame::mp3lame" "FLAC::FLAC" - "Opus::opus" "Vorbis::vorbisenc" "Ogg::ogg") - foreach(_target ${_optional_libs}) - if(TARGET "${_target}") - list(APPEND CMAKE_REQUIRED_LIBRARIES "${_target}") - endif() - endforeach() - - check_source_runs( - C - "#include -#include -int main() { - SF_FORMAT_INFO info = {SF_FORMAT_VORBIS}; - sf_command(NULL, SFC_GET_FORMAT_INFO, &info, sizeof info); - return info.name != NULL ? EXIT_SUCCESS : EXIT_FAILURE; -}" - SNDFILE_SUPPORTS_VORBIS) - - check_source_runs( - C - "#include -#include -int main() { - SF_FORMAT_INFO info = {SF_FORMAT_MPEG_LAYER_III}; - sf_command(NULL, SFC_GET_FORMAT_INFO, &info, sizeof info); - return info.name != NULL ? EXIT_SUCCESS : EXIT_FAILURE; -}" - SNDFILE_SUPPORTS_MPEG) - - set(SndFile_WITH_EXTERNAL_LIBS ${SNDFILE_SUPPORTS_VORBIS}) - set(SndFile_WITH_MPEG ${SNDFILE_SUPPORTS_MPEG}) - set(CMAKE_REQUIRED_INCLUDES ${_backup_includes}) - set(CMAKE_REQUIRED_LIBRARIES ${_backup_libraries}) - else() - message( - STATUS - "Cross-compiling without pkg-config - cannot check for external libraries." - "If you have the upstream CMake config set CMAKE_FIND_PACKAGE_PREFER_CONFIG to true for accurate results." - ) - set(SndFile_WITH_EXTERNAL_LIBS FALSE) - set(SndFile_WITH_MPEG FALSE) - endif() -endif() - -# Handle transitive dependencies -if(PC_SNDFILE_FOUND) - get_target_properties_from_pkg_config("${_sndfile_library}" "PC_SNDFILE" - "_sndfile") -else() - if(SndFile_WITH_EXTERNAL_LIBS) - list(APPEND _sndfile_link_libraries "FLAC::FLAC" "Opus::opus" - "Vorbis::vorbisenc" "Ogg::ogg") - endif() - if(SndFile_WITH_MPEG) - list(APPEND _sndfile_link_libraries "MPG123::libmpg123" "mp3lame::mp3lame") - endif() -endif() - -# Forward the result to CMake -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - SndFile - REQUIRED_VARS "_sndfile_library" "SndFile_INCLUDE_DIR" - VERSION_VAR "SndFile_VERSION") - -if(SndFile_FOUND AND NOT TARGET SndFile::sndfile) - add_library(SndFile::sndfile UNKNOWN IMPORTED) - set_target_properties( - SndFile::sndfile - PROPERTIES IMPORTED_LOCATION "${_sndfile_library}" - INTERFACE_COMPILE_OPTIONS "${_sndfile_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${SndFile_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sndfile_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_sndfile_link_directories}") - - # Set additional variables for compatibility with upstream config - set(SNDFILE_FOUND TRUE) - set(SndFile_LIBRARY SndFile::sndfile) - set(SndFile_LIBRARIES SndFile::sndfile) - set(SNDFILE_LIBRARY SndFile::sndfile) - set(SNDFILE_LIBRARIES SndFile::sndfile) - set(SNDFILE_INCLUDE_DIR "${SndFile_INCLUDE_DIR}") -endif() - -mark_as_advanced(_sndfile_library) diff --git a/cmake_admin/FindVorbis.cmake b/cmake_admin/FindVorbis.cmake deleted file mode 100644 index 0865c3ea2..000000000 --- a/cmake_admin/FindVorbis.cmake +++ /dev/null @@ -1,127 +0,0 @@ -#[=======================================================================[.rst: -FindVorbis -------- - -Finds the Vorbis library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``Vorbis::vorbisc`` - The Vorbis core library -``Vorbis::vorbisenc`` - The Vorbis encoder library -``Vorbis::vorbisfile`` - The Vorbis file library - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``Vorbis_FOUND`` - True if all vorbis libraries were found. -``Vorbis_Vorbis_FOUND`` - True if the base vorbis library was found. -``Vorbis_Enc_FOUND`` - True if the encoder library was found. -``Vorbis_File_FOUND`` - True if the file library was found. - -#]=======================================================================] - -# Use pkg-config if available -find_package(PkgConfig QUIET) -pkg_check_modules(PC_VORBIS QUIET vorbis) -pkg_check_modules(PC_VORBISENC QUIET vorbisenc) -pkg_check_modules(PC_VORBISFILE QUIET vorbisfile) - -# Find the headers and libraries -find_path( - Vorbis_INCLUDE_DIR - NAMES "vorbis/codec.h" - HINTS "${PC_VORBIS_INCLUDEDIR}") - -find_library( - Vorbis_LIBRARY - NAMES "vorbis" - HINTS "${PC_VORBIS_LIBDIR}") - -find_library( - Vorbis_Enc_LIBRARY - NAMES "vorbisenc" - HINTS "${PC_VORBISENC_LIBDIR}") - -find_library( - Vorbis_File_LIBRARY - NAMES "vorbisfile" - HINTS "${PC_VORBISFILE_LIBDIR}") - -# Handle transitive dependencies -if(PC_VORBIS_FOUND) - get_target_properties_from_pkg_config("${Vorbis_LIBRARY}" "PC_VORBIS" - "_vorbis") -else() - if(NOT TARGET Ogg::ogg) - find_package(Ogg QUIET) - endif() - set(_vorbis_link_libraries "Ogg::ogg" ${MATH_LIBRARY}) -endif() - -# Extract additional flags if pkg-config is available -if(PC_VORBISENC_FOUND) - get_target_properties_from_pkg_config("${Vorbis_Enc_LIBRARY}" "PC_VORBISENC" - "_vorbis_enc") -endif() - -if(PC_VORBISFILE_FOUND) - get_target_properties_from_pkg_config("${Vorbis_File_LIBRARY}" - "PC_VORBISFILE" "_vorbis_file") -endif() - -# Forward the result to CMake -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - Vorbis REQUIRED_VARS "Vorbis_LIBRARY" "Vorbis_Enc_LIBRARY" - "Vorbis_File_LIBRARY" "Vorbis_INCLUDE_DIR") - -# Create the targets -if(Vorbis_FOUND AND NOT TARGET Vorbis::vorbis) - add_library(Vorbis::vorbis UNKNOWN IMPORTED) - set_target_properties( - Vorbis::vorbis - PROPERTIES IMPORTED_LOCATION "${Vorbis_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${_vorbis_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_vorbis_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_vorbis_link_directories}") - set(Vorbis_Vorbis_FOUND TRUE) -endif() - -if(Vorbis_FOUND AND NOT TARGET Vorbis::vorbisenc) - add_library(Vorbis::vorbisenc UNKNOWN IMPORTED) - set_target_properties( - Vorbis::vorbisenc - PROPERTIES IMPORTED_LOCATION "${Vorbis_Enc_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${_vorbis_enc_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "Vorbis::vorbis" - INTERFACE_LINK_DIRECTORIES "${_vorbis_enc_link_directories}") - set(Vorbis_Enc_FOUND TRUE) -endif() - -if(Vorbis_FOUND AND NOT TARGET Vorbis::vorbisfile) - add_library(Vorbis::vorbisfile UNKNOWN IMPORTED) - set_target_properties( - Vorbis::vorbisfile - PROPERTIES IMPORTED_LOCATION "${Vorbis_File_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${_vorbis_file_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "Vorbis::vorbis" - INTERFACE_LINK_DIRECTORIES "${_vorbis_file_link_directories}") - set(Vorbis_File_FOUND TRUE) -endif() - -mark_as_advanced(Vorbis_LIBRARY Vorbis_Enc_LIBRARY Vorbis_File_LIBRARY) diff --git a/cmake_admin/Findmp3lame.cmake b/cmake_admin/Findmp3lame.cmake deleted file mode 100644 index cd8b4c8a1..000000000 --- a/cmake_admin/Findmp3lame.cmake +++ /dev/null @@ -1,63 +0,0 @@ -#[=======================================================================[.rst: -Findmp3lame -------- - -Finds the mp3lame library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``mp3lame::mp3lame`` - The mp3lame library. -``mp3lame::mpghip`` - The mpghip library. - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``mp3lame_FOUND`` - True if the mp3lame library was found. -``mp3lame_mpghip_FOUND`` - True if the mpghip library was found. - -#]=======================================================================] - -# Find the headers and libraries -find_path(mp3lame_INCLUDE_DIR NAMES "lame/lame.h") - -find_library(mp3lame_mp3lame_LIBRARY NAMES "mp3lame" "libmp3lame" - "libmp3lame-static") -find_library(mp3lame_mpghip_LIBRARY NAMES "mpghip" "libmpghip" - "libmpghip-static") - -# Forward the result to CMake -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - mp3lame REQUIRED_VARS "mp3lame_mp3lame_LIBRARY" - "mp3lame_INCLUDE_DIR") - -# Create the targets -if(mp3lame_FOUND AND NOT TARGET mp3lame::mp3lame) - add_library(mp3lame::mp3lame UNKNOWN IMPORTED) - set_target_properties( - mp3lame::mp3lame - PROPERTIES IMPORTED_LOCATION "${mp3lame_mp3lame_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}") - set(mp3lame_mp3lame_FOUND TRUE) -endif() - -if(mp3lame_mpghip_LIBRARY AND NOT TARGET mp3lame::mpghip) - add_library(mp3lame::mpghip UNKNOWN IMPORTED) - set_target_properties( - mp3lame::mpghip - PROPERTIES IMPORTED_LOCATION "${mp3lame_mpghip_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}") - set(mp3lame_mpghip_FOUND) -endif() - -mark_as_advanced(mp3lame_INCLUDE_DIR mp3lame_mp3lame_LIBRARY - mp3lame_mpghip_LIBRARY) diff --git a/cmake_admin/Findmpg123.cmake b/cmake_admin/Findmpg123.cmake deleted file mode 100644 index 3cb351679..000000000 --- a/cmake_admin/Findmpg123.cmake +++ /dev/null @@ -1,108 +0,0 @@ -#[=======================================================================[.rst: -Findmpg123 -------- - -Finds the mpg123 library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``MPG123::libmpg123`` - The mpg123 decoder library -``MPG123::libout123`` - The mpg123 output library -``MPG123::libsyn123`` - The mpg123 signal synthesis library - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``mpg123_FOUND`` - True if the package was found. -``mpg123_libmpg123_FOUND`` - True if the decoder library was found. -``mpg123_libout123_FOUND`` - True if the output library was found. -``mpg123_libsyn123_FOUND`` - True if the signal synthesis library was found. - -#]=======================================================================] - -# Use pkg-config if available -find_package(PkgConfig QUIET) -pkg_check_modules(PC_MPG123 QUIET libmpg123) -pkg_check_modules(PC_OUT123 QUIET libout123) -pkg_check_modules(PC_SYN123 QUIET libsyn123) - -# Find the headers and libraries -find_path( - mpg123_INCLUDE_DIR - NAMES "mpg123.h" - HINTS "${PC_MPG123_INCLUDEDIR}") - -find_library( - mpg123_libmpg123_LIBRARY - NAMES "mpg123" - HINTS "${PC_MPG123_LIBDIR}") - -find_library( - mpg123_libout123_LIBRARY - NAMES "out123" - HINTS "${PC_OUT123_LIBDIR}") - -find_library( - mpg123_libsyn123_LIBRARY - NAMES "syn123" - HINTS "${PC_SYN123_LIBDIR}") - -# Extract additional flags if pkg-config is available -if(PC_MPG123_FOUND) - get_target_properties_from_pkg_config("${mpg123_libmpg123_LIBRARY}" - "PC_MPG123" "_libmpg123") -endif() -if(PC_OUT123_FOUND) - get_target_properties_from_pkg_config("${mpg123_libout123_LIBRARY}" - "PC_OUT123" "_libout123") -endif() -if(PC_SYN123_FOUND) - get_target_properties_from_pkg_config("${mpg123_libsyn123_LIBRARY}" - "PC_SYN123" "_libsyn123") -endif() - -# Mark which component were found -foreach(_component libmpg123 libout123 libsyn123) - if(mpg123_${_component}_LIBRARY) - set(mpg123_${_component}_FOUND TRUE) - else() - set(mpg123_${_component}_FOUND FALSE) - endif() -endforeach() - -# Forward the result to CMake -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - mpg123 - REQUIRED_VARS "mpg123_libmpg123_LIBRARY" "mpg123_INCLUDE_DIR" - HANDLE_COMPONENTS) - -# Create the targets -foreach(_component libmpg123 libout123 libsyn123) - if(mpg123_${_component}_FOUND AND NOT TARGET MPG123::${_component}) - add_library(MPG123::${_component} UNKNOWN IMPORTED) - set_target_properties( - MPG123::${_component} - PROPERTIES IMPORTED_LOCATION "${mpg123_${_component}_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${mpg123_INCLUDE_DIR}" - INTERFACE_COMPILE_OPTIONS "${_${_component}_compile_options}" - INTERFACE_LINK_LIBRARIES "${_${_component}_link_libraries}" - INTERFACE_LINK_DIRECTORIES - "${_${_component}_link_directories}") - endif() -endforeach() - -mark_as_advanced(mpg123_libmpg123_LIBRARY mpg123_libout123_LIBRARY - mpg123_libsyn123_LIBRARY mpg123_INCLUDE_DIR) diff --git a/src/fluidsynth.c b/src/fluidsynth.c index cb2628798..73f0cd940 100644 --- a/src/fluidsynth.c +++ b/src/fluidsynth.c @@ -357,6 +357,10 @@ int main(int argc, char **argv) static const char optchars[] = "a:C:c:dE:f:F:G:g:hijK:L:lm:nO:o:p:QqR:r:sT:Vvz:"; #if defined(_WIN32) +// WC_ERR_INVALID_CHARS is only supported on Windows Vista and newer. To support older Windows, our only chance is to use zero for this flag. +#ifndef WC_ERR_INVALID_CHARS +#define WC_ERR_INVALID_CHARS 0 +#endif char **argv = NULL; // console output will be utf-8 SetConsoleOutputCP(CP_UTF8);