Skip to content

Commit e938e94

Browse files
committed
add the configuration file to the meson build
1 parent 1865331 commit e938e94

2 files changed

Lines changed: 37 additions & 11 deletions

File tree

meson.build

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
project(
22
'avcpp',
33
'cpp',
4-
meson_version: '>= 0.50.0',
4+
meson_version: '>= 0.54.1',
55
default_options : [
66
'c_std=c11',
7-
'cpp_std=c++17'
7+
'cpp_std=c++20'
88
],
99
version: '2.4.0',
1010
)
@@ -21,6 +21,4 @@ if not meson.is_subproject()
2121
# endif
2222
endif
2323

24-
if meson.version().version_compare('>=0.54.0')
25-
meson.override_dependency('avcpp', avcpp_dep)
26-
endif
24+
meson.override_dependency('avcpp', avcpp_dep)

src/avcpp/meson.build

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ if meson.project_name() == ''
22
project(
33
'avcpp',
44
'cpp',
5-
meson_version: '>= 0.50.0',
5+
meson_version: '>= 0.54.1',
66
default_options : [
77
'c_std=c11',
8-
'cpp_std=c++17'
8+
'cpp_std=c++20'
99
],
1010
version: '2.4.0',
1111
)
@@ -35,18 +35,46 @@ av_libs = [
3535
['postproc', '52.0.0'],
3636
]
3737

38+
conf_data = configuration_data()
39+
if get_option('cpp_std') == 'c++17'
40+
conf_data.set('AVCPP_CXX_STANDARD', '17')
41+
elif get_option('cpp_std') == 'c++20'
42+
conf_data.set('AVCPP_CXX_STANDARD', '20')
43+
elif get_option('cpp_std') == 'c++23'
44+
conf_data.set('AVCPP_CXX_STANDARD', '23')
45+
elif get_option('cpp_std') == 'c++26'
46+
conf_data.set('AVCPP_CXX_STANDARD', '26')
47+
endif
48+
3849
foreach lib : av_libs
39-
avcpp_deps += [
40-
dependency(
50+
lib_dep = dependency(
4151
'lib@0@'.format(lib[0]),
4252
required: true,
4353
fallback : ['ffmpeg', 'lib@0@_dep'.format(lib[0])],
4454
version : '>=@0@'.format(lib[1]))
45-
]
55+
avcpp_deps += [ lib_dep ]
56+
lib_version = lib_dep.version().split('.')
57+
conf_data.set(
58+
'AVCPP_' + lib[0].to_upper() + '_VERSION_MAJOR',
59+
lib_version[0])
60+
conf_data.set(
61+
'AVCPP_' + lib[0].to_upper() + '_VERSION_MINOR',
62+
lib_version[1])
63+
conf_data.set(
64+
'AVCPP_' + lib[0].to_upper() + '_VERSION_PATCH',
65+
lib_version[2])
66+
conf_data.set(
67+
'AVCPP_' + lib[0].to_upper() + '_VERSION_TWEAK',
68+
'0')
4669
endforeach
4770

71+
configure_file(input : 'avconfig.h.in',
72+
output : 'avconfig.h',
73+
configuration : conf_data,
74+
format: 'cmake')
75+
4876
#setting the include dir to the current folder (src)
49-
avcpp_incdir = include_directories('.','filters')
77+
avcpp_incdir = include_directories('.','filters','..')
5078

5179
#listing all the source files
5280
avcpp_sources = [

0 commit comments

Comments
 (0)