-
Notifications
You must be signed in to change notification settings - Fork 6
/
meson.build
113 lines (103 loc) · 3.55 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# libfoxenflac -- Tiny, inflexible bitstream reader
# Copyright (C) 2018-2022 Andreas Stöckel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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 General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
project('libfoxenflac', 'c', default_options : ['c_std=c99'])
compiler = meson.get_compiler('c')
if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang'
add_global_arguments('-Wc++-compat', language : 'c')
endif
# Include directory
inc_foxen = include_directories('.')
# Define the contents of the actual library
lib_foxenflac = library(
'foxenflac',
'foxen/flac.c',
include_directories: inc_foxen,
install: true)
# Compile the example programs
exe_flac_decoder = executable(
'flac_decoder',
'examples/flac_decoder.c',
include_directories: inc_foxen,
link_with: lib_foxenflac,
install: false)
# Compile and register the unit tests
dep_foxenunit = dependency(
'libfoxenunit',
fallback:['libfoxenunit', 'dep_foxenunit'])
exe_test_flac = executable(
'test_flac',
'test/test_flac.c',
include_directories: inc_foxen,
link_with: lib_foxenflac,
dependencies: dep_foxenunit,
install: false)
test('test_flac', exe_test_flac)
exe_test_flac_integration = executable(
'test_flac_integration',
'test/test_flac_integration.c',
include_directories: inc_foxen,
link_with: lib_foxenflac,
dependencies: [dep_foxenunit],
install: false)
test(
'test_flac_integration_noise',
exe_test_flac_integration,
args: [join_paths(meson.project_source_root(), 'test/data/noise.flac')])
test(
'test_flac_integration_wasted_bits',
exe_test_flac_integration,
args: [join_paths(meson.project_source_root(), 'test/data/wasted_bits.flac')])
test(
'test_flac_integration_short',
exe_test_flac_integration,
args: [join_paths(meson.project_source_root(), 'test/data/short.flac')])
test(
'test_flac_integration_subframe_header_reset',
exe_test_flac_integration,
args: [join_paths(meson.project_source_root(), 'test/data/subframe_header_reset.flac')])
test(
'test_flac_integration_afl_rice_parameter_zero',
exe_test_flac_integration,
args: [join_paths(meson.project_source_root(), 'test/data/afl_rice_parameter_zero.flac')])
exe_python = find_program('python3')
test(
'test_flac_integration_runner',
exe_python,
args: [
join_paths(meson.project_source_root(), 'test/test_flac_integration_runner.py'),
'--data-dir',
join_paths(meson.project_source_root(), 'test/data/extra/'),
'--exe',
exe_test_flac_integration,
'--no-download'],
timeout: 600)
# Install the header file
install_headers(
['foxen/flac.h'],
subdir: 'foxen')
# Generate a Pkg config file
pkg = import('pkgconfig')
pkg.generate(
libraries: [lib_foxenflac],
subdirs: [],
name: 'libfoxenflac',
version: '1.0',
filebase: 'libfoxenflac',
description: 'FLAC decoder')
# Export the dependency
dep_foxenflac = declare_dependency(
link_with: lib_foxenflac,
include_directories: inc_foxen)