2011-03-02 07:37:39 -05:00
|
|
|
#!/usr/bin/env python
|
2011-09-29 15:17:54 -04:00
|
|
|
from waflib.extras import autowaf as autowaf
|
2011-03-02 07:37:39 -05:00
|
|
|
import os
|
|
|
|
|
|
|
|
# Version of this package (even if built as a child)
|
2016-10-06 21:59:38 -04:00
|
|
|
QM_DSP_VERSION = '1.7.1'
|
2011-03-02 07:37:39 -05:00
|
|
|
|
|
|
|
# Library version (UNIX style major, minor, micro)
|
|
|
|
# major increment <=> incompatible changes
|
|
|
|
# minor increment <=> compatible changes (additions)
|
|
|
|
# micro increment <=> no interface changes
|
2016-10-06 21:59:38 -04:00
|
|
|
QM_DSP_LIB_VERSION = '1.7.1'
|
2011-03-02 07:37:39 -05:00
|
|
|
|
|
|
|
# Variables for 'waf dist'
|
|
|
|
APPNAME = 'qm-dsp'
|
|
|
|
VERSION = QM_DSP_VERSION
|
|
|
|
|
|
|
|
# Mandatory variables
|
2011-09-29 15:17:54 -04:00
|
|
|
top = '.'
|
|
|
|
out = 'build'
|
2011-03-02 07:37:39 -05:00
|
|
|
|
2011-09-29 15:17:54 -04:00
|
|
|
def options(opt):
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.set_options(opt)
|
2011-03-02 07:37:39 -05:00
|
|
|
|
|
|
|
def configure(conf):
|
2016-08-14 17:49:53 -04:00
|
|
|
if conf.is_defined('USE_EXTERNAL_LIBS'):
|
2022-01-22 16:17:26 -05:00
|
|
|
conf.check_cxx(header_name="base/Pitch.h", mandatory=True, msg="Checking for qm-dsp headers")
|
2016-08-14 17:49:53 -04:00
|
|
|
conf.check_cxx(lib="qm-dsp", uselib_store="QMDSP", mandatory=True)
|
2011-03-02 07:37:39 -05:00
|
|
|
|
2022-01-27 11:25:35 -05:00
|
|
|
# Verify that qm-dsp is self-contained and that FFT transforms actually works
|
|
|
|
if not conf.check_cxx(msg = 'Checking qm-dsp without explicit kiss linking',
|
|
|
|
features = 'cxx cxxprogram',
|
|
|
|
fragment = """#include "dsp/transforms/FFT.h"\nint main(void) {\nFFT(4).process(false, nullptr, 0, nullptr, nullptr);\nFFTReal(4).forward(nullptr, nullptr, nullptr);\nreturn 0;\n}""",
|
|
|
|
uselib = 'QMDSP',
|
|
|
|
okmsg = 'ok',
|
|
|
|
errmsg = "-lqm-dsp by itself failed",
|
|
|
|
mandatory = False,
|
|
|
|
):
|
|
|
|
# The external qm-dsp might be built without embedded kiss - try to link with it explicitly and check again
|
|
|
|
conf.check_cxx(lib="kiss_fft_double", uselib_store="KISSFFT", mandatory=True)
|
|
|
|
conf.check_cxx(lib="kiss_fftr_double", uselib_store="KISSFFTR", mandatory=True)
|
|
|
|
conf.env.append_value('LIB_QMDSP', conf.env['LIB_KISSFFT'] + conf.env['LIB_KISSFFTR'])
|
|
|
|
|
|
|
|
conf.check_cxx(msg = 'Checking qm-dsp with explicit kiss linking',
|
|
|
|
features = 'cxx cxxprogram',
|
|
|
|
fragment = """#include "dsp/transforms/FFT.h"\nint main(void) {\nFFT(4).process(false, nullptr, 0, nullptr, nullptr);\nFFTReal(4).forward(nullptr, nullptr, nullptr);\nreturn 0;\n}""",
|
|
|
|
uselib = 'QMDSP',
|
|
|
|
okmsg = '-lqm-dsp needs explicit kiss linking',
|
|
|
|
errmsg = "qm-dsp doesn't work, even with kiss libraries",
|
|
|
|
mandatory = True,
|
|
|
|
)
|
|
|
|
|
2011-03-02 07:37:39 -05:00
|
|
|
def build(bld):
|
2016-08-14 17:49:53 -04:00
|
|
|
if bld.is_defined('USE_EXTERNAL_LIBS'):
|
|
|
|
return
|
|
|
|
|
2011-04-22 18:15:21 -04:00
|
|
|
# Host Library
|
2016-10-07 08:28:36 -04:00
|
|
|
obj = bld(features = 'c cxx cxxstlib')
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.source = '''
|
2016-10-05 18:16:44 -04:00
|
|
|
base/Pitch.cpp
|
|
|
|
base/KaiserWindow.cpp
|
|
|
|
base/SincWindow.cpp
|
|
|
|
dsp/chromagram/Chromagram.cpp
|
|
|
|
dsp/chromagram/ConstantQ.cpp
|
|
|
|
dsp/keydetection/GetKeyMode.cpp
|
|
|
|
dsp/mfcc/MFCC.cpp
|
2011-04-22 18:15:21 -04:00
|
|
|
dsp/onsets/DetectionFunction.cpp
|
|
|
|
dsp/onsets/PeakPicking.cpp
|
|
|
|
dsp/phasevocoder/PhaseVocoder.cpp
|
|
|
|
dsp/rateconversion/Decimator.cpp
|
2016-10-05 18:16:44 -04:00
|
|
|
dsp/rateconversion/DecimatorB.cpp
|
2011-04-22 18:15:21 -04:00
|
|
|
dsp/rhythm/BeatSpectrum.cpp
|
|
|
|
dsp/signalconditioning/DFProcess.cpp
|
|
|
|
dsp/signalconditioning/Filter.cpp
|
|
|
|
dsp/signalconditioning/FiltFilt.cpp
|
|
|
|
dsp/signalconditioning/Framer.cpp
|
2016-10-05 18:16:44 -04:00
|
|
|
dsp/tempotracking/DownBeat.cpp
|
|
|
|
dsp/tempotracking/TempoTrack.cpp
|
|
|
|
dsp/tempotracking/TempoTrackV2.cpp
|
|
|
|
dsp/tonal/ChangeDetectionFunction.cpp
|
|
|
|
dsp/tonal/TCSgram.cpp
|
|
|
|
dsp/tonal/TonalEstimator.cpp
|
2011-04-22 18:15:21 -04:00
|
|
|
dsp/transforms/FFT.cpp
|
|
|
|
dsp/wavelet/Wavelet.cpp
|
|
|
|
maths/Correlation.cpp
|
|
|
|
maths/CosineDistance.cpp
|
|
|
|
maths/KLDivergence.cpp
|
|
|
|
maths/MathUtilities.cpp
|
2016-10-05 18:16:44 -04:00
|
|
|
maths/pca/pca.c
|
|
|
|
ext/kissfft/kiss_fft.c
|
|
|
|
ext/kissfft/tools/kiss_fftr.c
|
2011-04-22 18:15:21 -04:00
|
|
|
'''
|
2016-10-07 08:28:36 -04:00
|
|
|
autowaf.ensure_visible_symbols (obj, False)
|
2011-09-29 15:17:54 -04:00
|
|
|
obj.export_includes = ['.']
|
2016-10-05 19:54:21 -04:00
|
|
|
obj.includes = ['.', 'ext/kissfft', 'ext/kissfft/tools/']
|
2016-10-05 18:16:44 -04:00
|
|
|
obj.defines = ['kiss_fft_scalar=double']
|
2016-08-14 17:49:53 -04:00
|
|
|
obj.name = 'libqm-dsp'
|
|
|
|
obj.target = 'qm-dsp'
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.vnum = QM_DSP_VERSION
|
2016-10-05 18:16:44 -04:00
|
|
|
if bld.env['build_target'] != 'mingw':
|
Fix Ardour VAMP plugins (FFT)
Bug was introduced in 8ed33f1bc714c1 symbol visibility setting
in CFLAGS, CXXFLAGS was overridden. This resulted in publicly exposed
and bound kiss_fft symbols in libqm-dsp.
At runtime those symbols were resolved using previously bound
symbols in libcodec (see below) that uses a mismatching implementation
(ardour/qm-dsp uses -Dkiss_fft_scalar=double)
#0 0x00007fffea793d40 in kiss_fftr () at /usr/lib/x86_64-linux-gnu/libcodec2.so.0.8.1
#1 0x00007fffcf4516ab in FFTReal::D::forward(double const*, double*, double*) (this=0x5555571d73a0, ri=0x55555a734810, ro=0x55555a7262b0, io=0x55555a728590)
at ../libs/qm-dsp/dsp/transforms/FFT.cpp:121
#2 0x00007fffcf4510fd in FFTReal::forward(double const*, double*, double*) (this=0x555559868190, ri=0x55555a734810, ro=0x55555a7262b0, io=0x55555a728590)
at ../libs/qm-dsp/dsp/transforms/FFT.cpp:186
2020-01-13 18:43:34 -05:00
|
|
|
obj.cxxflags += [ bld.env['compiler_flags_dict']['pic'] ]
|
|
|
|
obj.cflags += [ bld.env['compiler_flags_dict']['pic'] ]
|
2018-10-14 22:06:11 -04:00
|
|
|
|
2011-03-02 07:37:39 -05:00
|
|
|
|
|
|
|
def shutdown():
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.shutdown()
|