Skip to content

Commit 7cb7f9c

Browse files
authored
Merge pull request #8 from emilazy/push-rrylzstqpytl
Port build system to Meson
2 parents cb18cc0 + 5268ff9 commit 7cb7f9c

5 files changed

Lines changed: 115 additions & 1 deletion

File tree

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ Changes in version 0.1.4:
5858

5959
* Uploaded to GitHub: http://github.com/minorninth/libresample
6060

61-
Usage notes:
61+
Changes in version 0.1.5:
62+
63+
* Added a new build system using Meson.
64+
65+
Usage notes:
6266

6367
- If the output buffer you pass is too small, resample_process
6468
may not use any input samples because its internal output
@@ -74,6 +78,21 @@ Usage notes:
7478
assume that it will be exactly 8000. If you need exactly
7579
8000 outputs, pad the input with extra zeros as necessary.
7680

81+
Build instructions:
82+
83+
libresample can be built with [Meson](https://mesonbuild.com/),
84+
with the standard Autotools `./configure && make`, or with the
85+
included Visual Studio 2005 project file.
86+
87+
The Meson build should generally be preferred. In particular,
88+
it is strongly recommended that downstream distribution
89+
packagers use the Meson build system for reasons of
90+
interoperability, as it generates a pkg-config file, supports
91+
building a shared library, can automatically run the tests, and
92+
runs on both Unix-like platforms and Windows. The older Autotools
93+
build system is retained for projects that already embed it into
94+
their builds and systems that do not have Meson.
95+
7796
License and warranty:
7897

7998
All of the files in this package are Copyright 2003 by Dominic

meson.build

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
project(
2+
'libresample',
3+
'c',
4+
meson_version : '>=1.3',
5+
default_options : 'default_library=both',
6+
version : '0.1.5',
7+
license : 'BSD-3-Clause OR LGPL-2.1-or-later',
8+
license_files : ['LICENSE-BSD.txt', 'LICENSE-LGPL.txt'],
9+
)
10+
11+
cc = meson.get_compiler('c')
12+
13+
configure_file(
14+
output : 'config.h',
15+
configuration : {
16+
'HAVE_INTTYPES_H': cc.has_header('inttypes.h').to_int(),
17+
},
18+
)
19+
config_inc = include_directories('.')
20+
21+
libm_dep = cc.find_library('m', required : false)
22+
23+
resample = library(
24+
'resample',
25+
'src/filterkit.c',
26+
'src/resample.c',
27+
'src/resamplesubs.c',
28+
dependencies : [libm_dep],
29+
include_directories : [config_inc],
30+
vs_module_defs : 'src/resample.def',
31+
version : meson.project_version(),
32+
soversion : 1,
33+
install : true,
34+
)
35+
36+
install_headers('include/libresample.h')
37+
38+
pkg = import('pkgconfig')
39+
pkg.generate(resample, name : 'libresample')
40+
41+
subdir('tests')

meson.options

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
option(
2+
'resample-sndfile',
3+
type : 'feature',
4+
value : 'auto',
5+
description : 'Build and install the resample-sndfile tool (depends on libsndfile)',
6+
)
7+
8+
option(
9+
'compareresample',
10+
type : 'feature',
11+
value : 'auto',
12+
description : 'Build and install the compareresample tool (depends on libsamplerate)',
13+
)

src/resample.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
EXPORTS
2+
resample_open
3+
resample_dup
4+
resample_get_filter_width
5+
resample_process
6+
resample_close

tests/meson.build

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
testresample = executable(
2+
'testresample',
3+
'testresample.c',
4+
dependencies : [libm_dep],
5+
link_with : [resample],
6+
)
7+
test('testresample', testresample)
8+
9+
sndfile_dep = dependency(
10+
'sndfile',
11+
required : get_option('resample-sndfile'),
12+
)
13+
if sndfile_dep.found()
14+
resample_sndfile = executable(
15+
'resample-sndfile',
16+
'resample-sndfile.c',
17+
dependencies : [sndfile_dep],
18+
link_with : [resample],
19+
install : true,
20+
)
21+
endif
22+
23+
samplerate_dep = dependency(
24+
'samplerate',
25+
required : get_option('compareresample'),
26+
)
27+
if samplerate_dep.found()
28+
compareresample = executable(
29+
'compareresample',
30+
'compareresample.c',
31+
dependencies : [libm_dep, samplerate_dep],
32+
link_with : [resample],
33+
install : true,
34+
)
35+
endif

0 commit comments

Comments
 (0)