diff --git a/README.md b/README.md index 5538d86..9adb55e 100644 --- a/README.md +++ b/README.md @@ -100,3 +100,15 @@ validated. For more detail on conformance, refer to [_Bluetooth Conformance Documents and scripts_](https://www.bluetooth.com/specifications/specs/low-complexity-communication-codec-1-0/) +## Meson build system + +Meson build system is also available to build and install lc3 codec in Linux +environment. + +```sh +$ meson build +$ cd build +$ ninja +$ sudo ninja install +``` + diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..d66723f --- /dev/null +++ b/meson.build @@ -0,0 +1,31 @@ +# Copyright © 2022 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('lc3', 'c', + version: '0.1', + license: 'Apache-2.0', + meson_version: '>= 0.47.0', + default_options: ['b_lto=true']) + +add_project_arguments('-ffast-math', language: 'c') + +cc = meson.get_compiler('c') + +m_dep = cc.find_library('m', required: false) + +subdir('src') + +if get_option('tools') + subdir('tools') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..5249131 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,18 @@ +# Copyright © 2022 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +option('tools', + type: 'boolean', + value: false, + description: 'Build tools') diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..229cd09 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,46 @@ +# Copyright © 2022 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +inc = include_directories('../include') + +lc3_sources = [ + 'attdet.c', + 'bits.c', + 'bwdet.c', + 'energy.c', + 'lc3.c', + 'ltpf.c', + 'mdct.c', + 'plc.c', + 'sns.c', + 'spec.c', + 'tables.c', + 'tns.c' +] + +lc3lib = library('lc3', + lc3_sources, + dependencies: m_dep, + include_directories: inc, + install: true) + +install_headers('../include/lc3.h', '../include/lc3_private.h') + +pkg_mod = import('pkgconfig') + +pkg_mod.generate(libraries : lc3lib, + version : '0.1', + name : 'liblc3', + filebase : 'lc3', + description : 'LC3 codec library') diff --git a/tools/meson.build b/tools/meson.build new file mode 100644 index 0000000..d6cdb84 --- /dev/null +++ b/tools/meson.build @@ -0,0 +1,25 @@ +# Copyright © 2022 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +inc = include_directories('../include') + +executable('elc3', ['elc3.c', 'lc3bin.c', 'wave.c'], + link_with : lc3lib, + include_directories: inc, + dependencies: m_dep) + +executable('dlc3', ['dlc3.c', 'lc3bin.c', 'wave.c'], + link_with : lc3lib, + include_directories: inc, + dependencies: m_dep)