aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/aubio/CMakeLists.txt54
-rw-r--r--ports/aubio/portfile.cmake91
2 files changed, 61 insertions, 84 deletions
diff --git a/ports/aubio/CMakeLists.txt b/ports/aubio/CMakeLists.txt
new file mode 100644
index 000000000..df2c598f9
--- /dev/null
+++ b/ports/aubio/CMakeLists.txt
@@ -0,0 +1,54 @@
+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
+)
+
+find_path(LIBSNDFILE_H sndfile.h)
+find_library(LIBSNDFILE_LIB libsndfile-1)
+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 aubio-5.def)
+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()
diff --git a/ports/aubio/portfile.cmake b/ports/aubio/portfile.cmake
index 714ec3ae8..e8a7d4551 100644
--- a/ports/aubio/portfile.cmake
+++ b/ports/aubio/portfile.cmake
@@ -1,14 +1,3 @@
-# NOTES
-# - if you get a codepage/unicode related error (non-critical) during configuration,
-# ignore it or, try switching the console codepage to windows english (`chcp 1252`)
-# - the build breaks with "missing pthreads" if --enable-fftw3(f) is added (if fftw3
-# is not added, the embedded ooura fft lib is used)
-# - the port uses ffmpeg and libsndfile as dependencies and also depends on possibilty to acquire waf and pkg-config(-lite) in vcpkg.
-# - crt-linkage is handled here, not in the generic waf-configure function because it is controlled via a patch to the aubio wscript
-# Waf seems to have no generic way to switch crt-linkage.
-# - The static build works, but: vcpkg's static ffmpegs build is fake ;), therefore it is still required to make the ffmpeg dlls
-# available in order to run exectables with statically linked aubio.
-
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/aubio-3c230fae309e9ea3298783368dd71bae6172359a)
vcpkg_download_distfile(ARCHIVE
@@ -18,78 +7,14 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
-# Pkg-config is equired by aubio to detect ffmpeg and libsndfile
-vcpkg_find_acquire_program(PKG-CONFIG)
-
-# Waf depends on python, so this also installs python3
-vcpkg_acquire_waf()
-
-# Configure pkg-config dir
-get_filename_component(PKG_CONFIG_DIR ${PKG-CONFIG} DIRECTORY)
-# Add pkg-config and vcpkg-bin-dir to environment search path
-set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/debug/bin;${PKG_CONFIG_DIR};$ENV{PATH}")
-# Set pkg-config search-path
-set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/aubio-5.def ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
-# Add waf executable if missing
-if(NOT EXISTS "${SOURCE_PATH}/waf")
- file(COPY "${WAF_DIR}/waf" DESTINATION "${SOURCE_PATH}")
-endif()
-
-# Add arguments for crt linkage and library linkage
-vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES "${CMAKE_CURRENT_LIST_DIR}/crt_lib_linkage.patch"
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=1
)
-
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/aubio-5.def DESTINATION ${SOURCE_PATH})
-
-vcpkg_configure_waf(
- SOURCE_PATH ${SOURCE_PATH}
- OPTIONS
- --library-linkage=${VCPKG_LIBRARY_LINKAGE}
- --crt-linkage=${VCPKG_CRT_LINKAGE}
- --enable-sndfile
- --enable-avcodec
- --disable-docs
- --verbose
- # OPTIONS_DEBUG
- # OPTIONS_RELEASE
- OPTIONS_BUILD
- --library-linkage=${VCPKG_LIBRARY_LINKAGE}
- --verbose
- --notests
- # OPTIONS_BUILD_RELEASE
- # OPTIONS_BUILD_DEBUG
- # TARGETS
-)
-
-# Postinstall cleanup debug
-message(STATUS "Cleaning up build")
-# Remove unused files
-# Debug executable and include folder
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
-file(GLOB DEBUG_EXECS ${CURRENT_PACKAGES_DIR}/debug/bin/*)
-file(REMOVE ${DEBUG_EXECS})
-# In release branch move execs to tools
-file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/aubio)
-file(GLOB RELEASE_EXECS ${CURRENT_PACKAGES_DIR}/bin/*.exe)
-file(GLOB RELEASE_EXE_SYMBOLS ${CURRENT_PACKAGES_DIR}/bin/*.pdb)
-FILE(COPY ${RELEASE_EXECS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/aubio)
-FILE(REMOVE ${RELEASE_EXECS} ${RELEASE_EXE_SYMBOLS})
-
-# Prepare (re-)moving dynamic libs
-file(GLOB DEBUG_DLLS ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll ${CURRENT_PACKAGES_DIR}/debug/lib/*.pdb)
-file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/*.dll ${CURRENT_PACKAGES_DIR}/lib/*.pdb)
-
-if(${VCPKG_LIBRARY_LINKAGE} MATCHES "dynamic")
- # Move dlls
- file(COPY ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(COPY ${RELEASE_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
- file(REMOVE ${DEBUG_DLLS} ${RELEASE_DLLS})
-elseif(${VCPKG_LIBRARY_LINKAGE} MATCHES "static")
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
-endif()
+vcpkg_install_cmake()
# Handle copyright and credentials
file(COPY
@@ -100,7 +25,5 @@ file(COPY
DESTINATION
${CURRENT_PACKAGES_DIR}/share/aubio)
+vcpkg_copy_pdbs()
file(RENAME ${CURRENT_PACKAGES_DIR}/share/aubio/COPYING ${CURRENT_PACKAGES_DIR}/share/aubio/copyright)
-
-# TODO
-# Add python script for dynamic symbols export in dynamic linking