usse vcpkg just for the libsndfile build chain

This commit is contained in:
marauder2k7 2025-10-29 01:40:27 +00:00
parent a577d36679
commit 873fbbf1fe
1856 changed files with 1019 additions and 466624 deletions

View file

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9396130..11ef59d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,7 +122,7 @@ else()
endif()
-if(ANDROID AND CMAKE_SYSTEM_VERSION VERSION_LESS 24 AND (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a"))
+if(ANDROID AND ANDROID_NATIVE_API_LEVEL VERSION_LESS "24" AND (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a"))
# fseeko/ftello may link, but it's not usable before Android API 24 on 32-bit Android
# https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
message(STATUS "Disabling fseeko/ftello for 32-bit Android before API 24")

View file

@ -0,0 +1,18 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c83dd83..2d1a7e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,9 +82,11 @@ if(HAVE_WERROR_FLAG)
option(ENABLE_WERROR "Enable -Werror in all Makefiles" OFF)
endif()
+if(MSVC AND NOT WITH_ASM)
+ add_compile_options(/wd4267 /wd4996)
+endif()
+
add_compile_options(
- $<$<BOOL:${MSVC}>:/wd4267>
- $<$<BOOL:${MSVC}>:/wd4996>
$<$<BOOL:${ENABLE_WERROR}>:-Werror>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:${HAVE_WEFFCXX_FLAG}>>:-Weffc++>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:${HAVE_DECL_AFTER_STMT_FLAG}>>:-Wdeclaration-after-statement>)

View file

@ -0,0 +1,15 @@
diff --git a/flac-config.cmake.in b/flac-config.cmake.in
index bcafc4c8..dcf299dd 100644
--- a/flac-config.cmake.in
+++ b/flac-config.cmake.in
@@ -5,6 +5,10 @@ if(NOT TARGET Ogg::ogg)
find_dependency(Ogg)
endif()
+if (@ENABLE_MULTITHREADING@)
+ find_dependency(Threads)
+endif()
+
include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake")
if(TARGET FLAC::FLAC)

View file

@ -0,0 +1,80 @@
set(LOCAL_ARCHIVE "$ENV{VCPKG_LIB_SOURCE_ROOT}/xiph-flac-1.5.0.tar.gz")
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${LOCAL_ARCHIVE}"
PATCHES
android-cmake.diff
fix-compile-options.patch
fix-find-threads.patch
)
if("asm" IN_LIST FEATURES)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_PATH "${NASM}" DIRECTORY)
vcpkg_add_to_path("${NASM_PATH}")
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
asm WITH_ASM
stack-protector WITH_STACK_PROTECTOR
multithreading ENABLE_MULTITHREADING
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_PROGRAMS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_DOCS=OFF
-DBUILD_TESTING=OFF
-DINSTALL_MANPAGES=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME FLAC CONFIG_PATH lib/cmake/FLAC)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE "${CURRENT_PACKAGES_DIR}/share/LICENSE")
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()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/flac.pc" " -lm" "")
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
endif()
endif()
vcpkg_fixup_pkgconfig()
# 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
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING.Xiph")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

View file

@ -0,0 +1,8 @@
The package libflac provides CMake targets:
find_package(FLAC CONFIG REQUIRED)
target_link_libraries(main PRIVATE FLAC::FLAC)
# Or use the C++ API
find_package(FLAC CONFIG REQUIRED)
target_link_libraries(main PRIVATE FLAC::FLAC++)

View file

@ -0,0 +1,37 @@
{
"name": "libflac",
"version": "1.5.0",
"description": "Library for manipulating FLAC files",
"homepage": "https://xiph.org/flac/",
"license": "BSD-3-Clause",
"dependencies": [
"libogg",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
{
"name": "stack-protector",
"platform": "!emscripten"
}
],
"features": {
"asm": {
"description": "Use any assembly optimization routines",
"supports": "x86"
},
"multithreading": {
"description": "Enable multithreading if pthreads is available"
},
"stack-protector": {
"description": "Build with stack smashing protection",
"supports": "!emscripten"
}
}
}