Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port build system to Meson #8

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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