Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aubio] allow to build without dependencies #16051

Merged
merged 8 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions ports/aubio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,64 @@
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
-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

-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)
autoantwort marked this conversation as resolved.
Show resolved Hide resolved

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(${LIBLZMA_INCLUDE_DIRS})
endif()

include_directories(src ${LIBLZMA_INCLUDE_DIRS})
include_directories(src)

file(GLOB_RECURSE SOURCES src/*.c)

set_source_files_properties(src/io/sink_wavwrite.c PROPERTIES COMPILE_FLAGS /FIWinsock2.h)
if(WIN32 AND NOT MINGW)
set_source_files_properties(src/io/sink_wavwrite.c PROPERTIES COMPILE_FLAGS /FIWinsock2.h)
endif()

add_library(aubio ${SOURCES})
target_link_libraries(aubio PUBLIC
SndFile::sndfile
${FFMPEG_LIBRARIES}
BZip2::BZip2
${LIBLZMA_LIBRARIES}
)
if(WITH_DEPENDENCIES)
target_link_libraries(aubio PUBLIC
SndFile::sndfile
${FFMPEG_LIBRARIES}
BZip2::BZip2
${LIBLZMA_LIBRARIES}
)
endif()

if(BUILD_TOOLS)
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)
Expand Down
7 changes: 0 additions & 7 deletions ports/aubio/CONTROL

This file was deleted.

11 changes: 11 additions & 0 deletions ports/aubio/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
autoantwort marked this conversation as resolved.
Show resolved Hide resolved
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
autoantwort marked this conversation as resolved.
Show resolved Hide resolved
-DTOOLS_INSTALLDIR=tools/aubio
-DBUILD_TOOLS=ON
Expand Down
24 changes: 24 additions & 0 deletions ports/aubio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
],
autoantwort marked this conversation as resolved.
Show resolved Hide resolved
"features": {
"tools": {
"description": "Build tools and add extra dependencies",
"dependencies": [
"bzip2",
"ffmpeg",
"libflac",
"liblzma",
"libogg",
"libsndfile",
"libvorbis"
]
}
}
}
5 changes: 5 additions & 0 deletions versions/a-/aubio.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a5fd622dc9d70a1f4cca1e6bc09829e1844b7e0f",
"version-string": "0.4.9",
"port-version": 4
},
{
"git-tree": "4623a0698d9f9775a12e41f282e2b131f32ea09f",
"version-string": "0.4.9",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
},
"aubio": {
"baseline": "0.4.9",
"port-version": 3
"port-version": 4
},
"audiofile": {
"baseline": "1.0.7",
Expand Down