[aubio] allow to build without dependencies (#16051)

* Make it possible to build aubio without dependencies

* Update ports/aubio/portfile.cmake

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* [aubio] add suggestions

* add version files

* Update ports/aubio/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* add version files

* [aubio] fix wrong defines

* add version files

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
This commit is contained in:
autoantwort 2021-03-25 20:36:00 +01:00 committed by GitHub
parent 70f73854cb
commit dc8f5b6d99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 29 deletions

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.8)
project(aubio C)
option(WITH_DEPENDENCIES "Adds extra dependencies" ON)
add_definitions(
-DHAVE_STDLIB_H=1
-DHAVE_STDIO_H=1
@ -8,46 +10,55 @@ add_definitions(
-DHAVE_STRING_H=1
-DHAVE_LIMITS_H=1
-DHAVE_STDARG_H=1
-DHAVE_ERRNO_H=1
-DHAVE_C99_VARARGS_MACROS=1
-DHAVE_SNDFILE=1
-DHAVE_WAVWRITE=1
-DHAVE_WAVREAD=1
-DHAVE_LIBAV=1
-DHAVE_SWRESAMPLE=1
-D_CRT_SECURE_NO_WARNINGS=1
)
set(CMAKE_DEBUG_POSTFIX d)
option(BUILD_TOOLS "Build and install tools" ON)
set(TOOLS_INSTALLDIR "bin" CACHE STRING "Target directory for installed tools")
find_package(FFmpeg COMPONENTS avcodec avutil avdevice avfilter avformat swresample REQUIRED)
find_package(BZip2 REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(SndFile REQUIRED)
if(WITH_DEPENDENCIES)
find_package(FFMPEG COMPONENTS avcodec avutil avdevice avfilter avformat swresample REQUIRED)
find_package(BZip2 REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(SndFile REQUIRED)
include_directories(src ${LIBLZMA_INCLUDE_DIRS})
include_directories(${LIBLZMA_INCLUDE_DIRS})
endif()
include_directories(src)
file(GLOB_RECURSE SOURCES src/*.c)
set_source_files_properties(src/io/sink_wavwrite.c PROPERTIES COMPILE_FLAGS /FIWinsock2.h)
add_library(aubio ${SOURCES})
target_link_libraries(aubio PUBLIC
SndFile::sndfile
${FFMPEG_LIBRARIES}
BZip2::BZip2
${LIBLZMA_LIBRARIES}
)
if(WIN32 AND NOT MINGW)
set_source_files_properties(src/io/sink_wavwrite.c PROPERTIES COMPILE_FLAGS /FIWinsock2.h)
endif()
if(BUILD_TOOLS)
add_library(aubio ${SOURCES})
if(WITH_DEPENDENCIES)
target_link_libraries(aubio PUBLIC
SndFile::sndfile
${FFMPEG_LIBRARIES}
BZip2::BZip2
${LIBLZMA_LIBRARIES}
)
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)
target_compile_definitions(${EXAMPLE_EXEC} PRIVATE -DHAVE_WIN_HACKS=1)
if(WIN32)
target_compile_definitions(${EXAMPLE_EXEC} PRIVATE -DHAVE_WIN_HACKS=1)
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)

View File

@ -1,7 +0,0 @@
Source: aubio
Version: 0.4.9
Port-Version: 3
Homepage: https://github.com/aubio/aubio
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.
Build-Depends: ffmpeg, libsndfile, libogg, libflac, libvorbis, bzip2, liblzma
Supports: windows

View File

@ -10,9 +10,20 @@ vcpkg_from_github(
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools WITH_DEPENDENCIES
tools HAVE_SNDFILE
tools HAVE_WAVWRITE
tools HAVE_WAVREAD
tools HAVE_LIBAV
tools HAVE_SWRESAMPLE
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
OPTIONS_RELEASE
-DTOOLS_INSTALLDIR=tools/aubio
-DBUILD_TOOLS=ON

24
ports/aubio/vcpkg.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "aubio",
"version-string": "0.4.9",
"port-version": 4,
"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",
"default-features": [
"tools"
],
"features": {
"tools": {
"description": "Build tools and add extra dependencies",
"dependencies": [
"bzip2",
"ffmpeg",
"libflac",
"liblzma",
"libogg",
"libsndfile",
"libvorbis"
]
}
}
}

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a5fd622dc9d70a1f4cca1e6bc09829e1844b7e0f",
"version-string": "0.4.9",
"port-version": 4
},
{
"git-tree": "4623a0698d9f9775a12e41f282e2b131f32ea09f",
"version-string": "0.4.9",

View File

@ -190,7 +190,7 @@
},
"aubio": {
"baseline": "0.4.9",
"port-version": 3
"port-version": 4
},
"audiofile": {
"baseline": "1.0.7",