[aubio] Add support for find_package (#19996)

* [aubio] Add support for find_package

* Add include(CMakeFindDependencyMacro)

* x-add-version

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
autoantwort 2021-09-08 23:58:24 +02:00 committed by GitHub
parent f0c569e3e5
commit 3f4c4a61eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 15 deletions

View File

@ -83,13 +83,15 @@ if(BUILD_TOOLS AND WITH_DEPENDENCIES)
endif()
install(
TARGETS aubio
TARGETS aubio EXPORT AubioTargets
INCLUDES DESTINATION include
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(EXPORT AubioTargets NAMESPACE Aubio:: DESTINATION share/aubio)
install(
DIRECTORY src/
DESTINATION include/aubio
@ -98,4 +100,30 @@ if(NOT DISABLE_INSTALL_HEADERS)
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
)

View File

@ -15,7 +15,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
tools WITH_DEPENDENCIES
)
vcpkg_configure_cmake(
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
@ -23,10 +23,13 @@ vcpkg_configure_cmake(
-DTOOLS_INSTALLDIR=tools/aubio
-DBUILD_TOOLS=ON
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=1
-DBUILD_TOOLS=OFF
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
# Handle copyright and credentials
file(COPY

View File

@ -1,9 +1,19 @@
{
"name": "aubio",
"version-semver": "0.4.9",
"port-version": 6,
"port-version": 7,
"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",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"tools"
],

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b7115b787e5f71bf65454f4c3cff3ec85b4eb264",
"version-semver": "0.4.9",
"port-version": 7
},
{
"git-tree": "0abf18908332cd2ccfe8e298f8fd90c0db42dcd9",
"version-semver": "0.4.9",

View File

@ -214,7 +214,7 @@
},
"aubio": {
"baseline": "0.4.9",
"port-version": 6
"port-version": 7
},
"audiofile": {
"baseline": "1.0.7",