[aubio] Add capability to build tools (note: currently fails due to missing config.h)

This commit is contained in:
Robert Schumacher 2017-06-28 13:56:24 -07:00
parent b7efd0e07d
commit 196b48ef5f
3 changed files with 97 additions and 58 deletions

View File

@ -1,56 +1,90 @@
cmake_minimum_required(VERSION 3.8)
project(aubio C)
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_C99_VARARGS_MACROS=1
-DHAVE_SNDFILE=1
-DHAVE_WAVWRITE=1
-DHAVE_WAVREAD=1
-DHAVE_LIBAV=1
-DHAVE_SWRESAMPLE=1
)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
find_path(LIBSNDFILE_H sndfile.h)
find_library(LIBSNDFILE_LIB NAMES libsndfile-1 libsndfile)
find_library(AVCODEC_LIB avcodec)
find_library(AVUTIL_LIB avutil)
find_library(AVDEVICE_LIB avdevice)
find_library(AVFILTER_LIB avfilter)
find_library(AVFORMAT_LIB avformat)
find_library(SWRESAMPLE_LIB swresample)
include_directories(src ${LIBSNDFILE_H})
link_libraries(${LIBSNDFILE_LIB} ${AVCODEC_LIB} ${AVUTIL_LIB} ${AVDEVICE_LIB} ${AVFILTER_LIB} ${AVFORMAT_LIB} ${SWRESAMPLE_LIB} ws2_32.lib)
file(GLOB_RECURSE SOURCES src/*.c)
set_source_files_properties(src/io/sink_wavwrite.c PROPERTIES COMPILE_FLAGS /FIWinsock2.h)
add_library(aubio ${SOURCES})
set(CMAKE_DEBUG_POSTFIX d)
install(
TARGETS aubio
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(
DIRECTORY src/
DESTINATION include/aubio
FILES_MATCHING
PATTERN "*.h"
PATTERN "*_priv.h" EXCLUDE
PATTERN "config.h" EXCLUDE
)
endif()
cmake_minimum_required(VERSION 3.8)
project(aubio C)
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_C99_VARARGS_MACROS=1
-DHAVE_SNDFILE=1
-DHAVE_WAVWRITE=1
-DHAVE_WAVREAD=1
-DHAVE_LIBAV=1
-DHAVE_SWRESAMPLE=1
)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
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_path(LIBSNDFILE_H sndfile.h)
find_library(LIBSNDFILE_LIB NAMES libsndfile-1 libsndfile)
find_library(AVCODEC_LIB avcodec)
find_library(AVUTIL_LIB avutil)
find_library(AVDEVICE_LIB avdevice)
find_library(AVFILTER_LIB avfilter)
find_library(AVFORMAT_LIB avformat)
find_library(SWRESAMPLE_LIB swresample)
find_library(OGG_LIB ogg)
find_library(FLAC_LIB flac)
find_library(VORBIS_LIB vorbis)
find_library(VORBISENC_LIB vorbisenc)
include_directories(src ${LIBSNDFILE_H})
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
${LIBSNDFILE_LIB}
${OGG_LIB}
${FLAC_LIB}
${VORBIS_LIB}
${VORBISENC_LIB}
${AVCODEC_LIB}
${AVUTIL_LIB}
${AVDEVICE_LIB}
${AVFILTER_LIB}
${AVFORMAT_LIB}
${SWRESAMPLE_LIB}
ws2_32.lib
)
if(BUILD_TOOLS)
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)
endforeach()
install(
TARGETS ${EXAMPLE_EXECS}
RUNTIME DESTINATION ${TOOLS_INSTALLDIR}
)
endif()
install(
TARGETS aubio
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(
DIRECTORY src/
DESTINATION include/aubio
FILES_MATCHING
PATTERN "*.h"
PATTERN "*_priv.h" EXCLUDE
PATTERN "config.h" EXCLUDE
)
endif()

View File

@ -1,4 +1,4 @@
Source: aubio
Version: 0.46~alpha
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
Build-Depends: ffmpeg, libsndfile, libogg, libflac, libvorbis

View File

@ -12,7 +12,12 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=1
OPTIONS_RELEASE
#-DTOOLS_INSTALLDIR=tools/aubio
-DBUILD_TOOLS=OFF
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=1
-DBUILD_TOOLS=OFF
)
vcpkg_install_cmake()