From 98ab11d7a9b749013b67405b4c728f63284b3196 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Wed, 25 Aug 2021 22:21:54 +0200 Subject: [PATCH] Added Codec2 dependency as meson subproject --- meson.build | 10 ++++- subprojects/codec2.wrap | 4 ++ .../packagefiles/codec2/codec2/version.h | 37 +++++++++++++++++++ subprojects/packagefiles/codec2/meson.build | 37 +++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 subprojects/codec2.wrap create mode 100644 subprojects/packagefiles/codec2/codec2/version.h create mode 100644 subprojects/packagefiles/codec2/meson.build diff --git a/meson.build b/meson.build index b9cbae68..89de4f94 100644 --- a/meson.build +++ b/meson.build @@ -3,13 +3,13 @@ ## project('OpenRTX', ['c', 'cpp'], version : '0.3.1', - default_options : ['warning_level=3']) + default_options : ['warning_level=3', 'b_staticpic=false']) ## ## Optional defines, common to all souces (e.g. to enable debugging) ## -def = { } +def = {'VCOM_ENABLED' : ''} ## ## ----------------- Platform-independent source files ------------------------- @@ -65,6 +65,10 @@ minmea_inc = ['lib/minmea/include'] # QDEC, a very simple, header only, quadrature decoding library qdec_inc = ['lib/qdec/include'] +# CODEC2, open source speech codec +codec2_proj = subproject('codec2') +codec2_dep = codec2_proj.get_variable('codec2_dep') + ## ## RTOS ## @@ -363,6 +367,7 @@ md3x0_opts = {'sources' : md3x0_src, 'cpp_args': md3x0_args, 'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script.ld', '-Wl,--print-memory-usage'], + 'dependencies': [codec2_dep], 'include_directories': md3x0_inc} mduv3x0_opts = {'sources': mduv3x0_src, @@ -370,6 +375,7 @@ mduv3x0_opts = {'sources': mduv3x0_src, 'cpp_args': mduv3x0_args, 'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script.ld', '-Wl,--print-memory-usage'], + 'dependencies': [codec2_dep], 'include_directories': mduv3x0_inc} gd77_opts = {'sources': gd77_src, diff --git a/subprojects/codec2.wrap b/subprojects/codec2.wrap new file mode 100644 index 00000000..ef9dae66 --- /dev/null +++ b/subprojects/codec2.wrap @@ -0,0 +1,4 @@ +[wrap-git] +url = https://github.com/drowe67/codec2 +revision = a298f3789d7ef9e829049ebe14da8845d97ba8c1 +patch_directory = codec2 diff --git a/subprojects/packagefiles/codec2/codec2/version.h b/subprojects/packagefiles/codec2/codec2/version.h new file mode 100644 index 00000000..e422a4b1 --- /dev/null +++ b/subprojects/packagefiles/codec2/codec2/version.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: version.h + AUTHOR......: Tomas Härdin + DATE CREATED: 03 November 2017 + + Codec 2 VERSION #defines + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2017 Tomas Härdin + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. This program is + distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see . +*/ + +//this functions both as an include guard and your typical HAVE macro +#ifndef CODEC2_HAVE_VERSION +#define CODEC2_HAVE_VERSION + +#define CODEC2_VERSION_MAJOR 1 +#define CODEC2_VERSION_MINOR 0 +/* #undef CODEC2_VERSION_PATCH */ +#define CODEC2_VERSION "1.0" + +#endif //CODEC2_HAVE_VERSION diff --git a/subprojects/packagefiles/codec2/meson.build b/subprojects/packagefiles/codec2/meson.build new file mode 100644 index 00000000..6ff1754c --- /dev/null +++ b/subprojects/packagefiles/codec2/meson.build @@ -0,0 +1,37 @@ +project('codec2', 'cpp') + +cmake = import('cmake') + +codec2_inc = include_directories('.', 'src') +codec2_src = ['src/dump.c', + 'src/lpc.c', + 'src/nlp.c', + 'src/phase.c', + 'src/quantise.c', + 'src/postfilter.c', + 'src/codec2.c', + 'src/codec2_fft.c', + 'src/lsp.c', + 'src/sine.c', + 'src/interp.c', + 'src/kiss_fft.c', + 'src/kiss_fftr.c', + 'src/newamp1.c', + 'src/codebook.c', + 'src/codebookd.c', + 'src/pack.c', + 'src/codebooknewamp1.c', + 'src/codebooknewamp1_energy.c'] + +add_project_arguments('-DCODEC2_MODE_EN_DEFAULT=0', language : 'c') +add_project_arguments('-DCODEC2_MODE_3200_EN=1' , language : 'c') +add_project_arguments('-DCODEC2_MODE_1600_EN=1' , language : 'c') +add_project_arguments('-DFREEDV_MODE_EN_DEFAULT=0', language : 'c') + +codec2 = static_library('codec2', + codec2_src, + include_directories : codec2_inc, + install : false) + +codec2_dep = declare_dependency(include_directories : codec2_inc, + link_with : codec2)