Skip to content

Commit

Permalink
Merge pull request #8 from emilazy/push-rrylzstqpytl
Browse files Browse the repository at this point in the history
Port build system to Meson
  • Loading branch information
minorninth authored Aug 23, 2024
2 parents cb18cc0 + 5268ff9 commit 7cb7f9c
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ Changes in version 0.1.4:

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

Usage notes:
Changes in version 0.1.5:

* Added a new build system using Meson.

Usage notes:

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

Build instructions:

libresample can be built with [Meson](https://mesonbuild.com/),
with the standard Autotools `./configure && make`, or with the
included Visual Studio 2005 project file.

The Meson build should generally be preferred. In particular,
it is strongly recommended that downstream distribution
packagers use the Meson build system for reasons of
interoperability, as it generates a pkg-config file, supports
building a shared library, can automatically run the tests, and
runs on both Unix-like platforms and Windows. The older Autotools
build system is retained for projects that already embed it into
their builds and systems that do not have Meson.

License and warranty:

All of the files in this package are Copyright 2003 by Dominic
Expand Down
41 changes: 41 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
project(
'libresample',
'c',
meson_version : '>=1.3',
default_options : 'default_library=both',
version : '0.1.5',
license : 'BSD-3-Clause OR LGPL-2.1-or-later',
license_files : ['LICENSE-BSD.txt', 'LICENSE-LGPL.txt'],
)

cc = meson.get_compiler('c')

configure_file(
output : 'config.h',
configuration : {
'HAVE_INTTYPES_H': cc.has_header('inttypes.h').to_int(),
},
)
config_inc = include_directories('.')

libm_dep = cc.find_library('m', required : false)

resample = library(
'resample',
'src/filterkit.c',
'src/resample.c',
'src/resamplesubs.c',
dependencies : [libm_dep],
include_directories : [config_inc],
vs_module_defs : 'src/resample.def',
version : meson.project_version(),
soversion : 1,
install : true,
)

install_headers('include/libresample.h')

pkg = import('pkgconfig')
pkg.generate(resample, name : 'libresample')

subdir('tests')
13 changes: 13 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
option(
'resample-sndfile',
type : 'feature',
value : 'auto',
description : 'Build and install the resample-sndfile tool (depends on libsndfile)',
)

option(
'compareresample',
type : 'feature',
value : 'auto',
description : 'Build and install the compareresample tool (depends on libsamplerate)',
)
6 changes: 6 additions & 0 deletions src/resample.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EXPORTS
resample_open
resample_dup
resample_get_filter_width
resample_process
resample_close
35 changes: 35 additions & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
testresample = executable(
'testresample',
'testresample.c',
dependencies : [libm_dep],
link_with : [resample],
)
test('testresample', testresample)

sndfile_dep = dependency(
'sndfile',
required : get_option('resample-sndfile'),
)
if sndfile_dep.found()
resample_sndfile = executable(
'resample-sndfile',
'resample-sndfile.c',
dependencies : [sndfile_dep],
link_with : [resample],
install : true,
)
endif

samplerate_dep = dependency(
'samplerate',
required : get_option('compareresample'),
)
if samplerate_dep.found()
compareresample = executable(
'compareresample',
'compareresample.c',
dependencies : [libm_dep, samplerate_dep],
link_with : [resample],
install : true,
)
endif

0 comments on commit 7cb7f9c

Please sign in to comment.