diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/aubio | |
Diffstat (limited to 'vcpkg/ports/aubio')
| -rw-r--r-- | vcpkg/ports/aubio/CMakeLists.txt | 130 | ||||
| -rw-r--r-- | vcpkg/ports/aubio/ffmpeg7.patch | 15 | ||||
| -rw-r--r-- | vcpkg/ports/aubio/portfile.cmake | 42 | ||||
| -rw-r--r-- | vcpkg/ports/aubio/vcpkg.json | 46 |
4 files changed, 233 insertions, 0 deletions
diff --git a/vcpkg/ports/aubio/CMakeLists.txt b/vcpkg/ports/aubio/CMakeLists.txt new file mode 100644 index 0000000..790a046 --- /dev/null +++ b/vcpkg/ports/aubio/CMakeLists.txt @@ -0,0 +1,130 @@ +cmake_minimum_required(VERSION 3.8) +project(aubio C) + +option(WITH_DEPENDENCIES "Adds extra dependencies" ON) +option(BUILD_TOOLS "Build and install tools" ON) + +add_definitions( + -DHAVE_STDLIB_H=1 + -DHAVE_STDIO_H=1 + -DHAVE_MATH_H=1 + -DHAVE_STRING_H=1 + -DHAVE_LIMITS_H=1 + -DHAVE_STDARG_H=1 + -DHAVE_ERRNO_H=1 + -DHAVE_C99_VARARGS_MACROS=1 + -D_CRT_SECURE_NO_WARNINGS=1 +) + +if(WITH_DEPENDENCIES) + add_definitions( + -DHAVE_SNDFILE=1 + -DHAVE_WAVWRITE=1 + -DHAVE_WAVREAD=1 + -DHAVE_LIBAV=1 + -DHAVE_SWRESAMPLE=1 + ) +endif() + +set(TOOLS_INSTALLDIR "bin" CACHE STRING "Target directory for installed tools") + +if(WITH_DEPENDENCIES) + find_package(FFMPEG COMPONENTS avcodec avutil avformat swresample REQUIRED) + find_package(BZip2 REQUIRED) + find_package(LibLZMA REQUIRED) + find_package(SndFile REQUIRED) + + include_directories(${LIBLZMA_INCLUDE_DIRS}) +endif() + +include_directories(src) + +file(GLOB_RECURSE SOURCES src/*.c) + +if(WIN32 AND NOT MINGW) + set_source_files_properties(src/io/sink_wavwrite.c PROPERTIES COMPILE_FLAGS /FIWinsock2.h) +endif() + +add_library(aubio ${SOURCES}) +if(WITH_DEPENDENCIES) + target_link_libraries(aubio PUBLIC + SndFile::sndfile + ${FFMPEG_LIBRARIES} + BZip2::BZip2 + ${LIBLZMA_LIBRARIES} + ) +endif() + +if(WIN32) + target_compile_definitions(aubio PRIVATE -DHAVE_WIN_HACKS=1) + target_link_libraries(aubio PUBLIC ws2_32) +endif() + +if(BUILD_TOOLS AND WITH_DEPENDENCIES) + set(EXAMPLE_EXECS aubiomfcc aubionotes aubioonset aubiopitch aubioquiet aubiotrack) + foreach(EXAMPLE_EXEC ${EXAMPLE_EXECS}) + add_executable(${EXAMPLE_EXEC} examples/${EXAMPLE_EXEC}.c examples/utils.c examples/jackio.c) + target_link_libraries(${EXAMPLE_EXEC} PRIVATE aubio) + if(WIN32) + target_compile_definitions(${EXAMPLE_EXEC} PRIVATE -DHAVE_WIN_HACKS=1) + target_link_libraries(${EXAMPLE_EXEC} PUBLIC ws2_32) + else() + target_compile_definitions(${EXAMPLE_EXEC} PRIVATE -DHAVE_UNISTD_H=1) + endif() + endforeach() + # Create and add fake config.h to avoid build errors (file is generated for + # cross-platform requirements in waf build-system) + file(WRITE "${CMAKE_BINARY_DIR}/config.h" "") + include_directories(${CMAKE_BINARY_DIR}) + + install( + TARGETS ${EXAMPLE_EXECS} + RUNTIME DESTINATION ${TOOLS_INSTALLDIR} + ) +endif() + +install( + TARGETS aubio EXPORT AubioTargets + INCLUDES DESTINATION include + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(EXPORT AubioTargets NAMESPACE Aubio:: DESTINATION share/aubio) + +install( + DIRECTORY src/ + DESTINATION include/aubio + FILES_MATCHING + PATTERN "*.h" + PATTERN "*_priv.h" EXCLUDE + PATTERN "config.h" EXCLUDE +) + +# Create CMake configuration export file. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AubioConfig.cmake.in "@PACKAGE_INIT@\n") +if(WITH_DEPENDENCIES) +file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AubioConfig.cmake.in " + include(CMakeFindDependencyMacro) + find_dependency(FFMPEG COMPONENTS avcodec avutil avformat swresample REQUIRED) + find_dependency(BZip2 REQUIRED) + find_dependency(LibLZMA REQUIRED) + find_dependency(SndFile REQUIRED) + ") +endif() +file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AubioConfig.cmake.in "include(\${CMAKE_CURRENT_LIST_DIR}/AubioTargets.cmake)") + +# Install CMake configuration export file. +include(CMakePackageConfigHelpers) +configure_package_config_file( + ${CMAKE_CURRENT_BINARY_DIR}/AubioConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/AubioConfig.cmake + INSTALL_DESTINATION share/aubio +) +install( + FILES + ${CMAKE_BINARY_DIR}/AubioConfig.cmake + DESTINATION + share/aubio +) diff --git a/vcpkg/ports/aubio/ffmpeg7.patch b/vcpkg/ports/aubio/ffmpeg7.patch new file mode 100644 index 0000000..cf0fe6e --- /dev/null +++ b/vcpkg/ports/aubio/ffmpeg7.patch @@ -0,0 +1,15 @@ +diff --git a/src/io/source_avcodec.c b/src/io/source_avcodec.c +index 71ea8b5f..ad91f5eb 100644 +--- a/src/io/source_avcodec.c ++++ b/src/io/source_avcodec.c +@@ -345,8 +345,8 @@ void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s) + av_channel_layout_default(&input_layout, s->input_channels); + av_channel_layout_default(&output_layout, s->input_channels); + +- av_opt_set_chlayout(avr, "in_channel_layout", &input_layout, 0); +- av_opt_set_chlayout(avr, "out_channel_layout", &output_layout, 0); ++ av_opt_set_chlayout(avr, "in_chlayout", &input_layout, 0); ++ av_opt_set_chlayout(avr, "out_chlayout", &output_layout, 0); + #else + int64_t input_layout = av_get_default_channel_layout(s->input_channels); + int64_t output_layout = av_get_default_channel_layout(s->input_channels); diff --git a/vcpkg/ports/aubio/portfile.cmake b/vcpkg/ports/aubio/portfile.cmake new file mode 100644 index 0000000..59128ae --- /dev/null +++ b/vcpkg/ports/aubio/portfile.cmake @@ -0,0 +1,42 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO aubio/aubio + REF 152d6819b360c2e7b379ee3f373d444ab3df0895 + SHA512 923529eb27e460293bd2b8b8c53d5eb96553e3e1ece7071904808d8f20f86b7af70bde97d271da9a07ee1898d0840190f265e326e67f48c6f5cadefa034abf0f + HEAD_REF master + PATCHES + ffmpeg7.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tools WITH_DEPENDENCIES +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${FEATURE_OPTIONS} + OPTIONS_RELEASE + -DTOOLS_INSTALLDIR=tools/aubio + -DBUILD_TOOLS=ON + OPTIONS_DEBUG + -DBUILD_TOOLS=OFF +) +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_copy_pdbs() +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES aubiomfcc aubionotes aubioonset aubiopitch aubioquiet aubiotrack + SEARCH_DIR ${CURRENT_PACKAGES_DIR}/tools/aubio + AUTO_CLEAN) +endif() + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/aubio/vcpkg.json b/vcpkg/ports/aubio/vcpkg.json new file mode 100644 index 0000000..0418877 --- /dev/null +++ b/vcpkg/ports/aubio/vcpkg.json @@ -0,0 +1,46 @@ +{ + "name": "aubio", + "version-date": "2024-01-03", + "description": "Aubio is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.", + "homepage": "https://github.com/aubio/aubio", + "license": "GPL-3.0-or-later", + "supports": "!xbox", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "tools" + ], + "features": { + "tools": { + "description": "Build tools and add extra dependencies", + "dependencies": [ + "bzip2", + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "avcodec", + "avformat", + "swresample" + ] + }, + "libflac", + "liblzma", + "libogg", + { + "name": "libsndfile", + "default-features": false + }, + "libvorbis" + ] + } + } +} |