Skip to content

Commit fa32a77

Browse files
author
noasakurajin
committed
finished full meson support
1 parent 90e65ab commit fa32a77

File tree

10 files changed

+110
-27
lines changed

10 files changed

+110
-27
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ qtcreator-build-*/
77
scripts/valgrind.txt
88
transcoder-manager-*-win32.zip
99
build
10+
11+
.cache
12+
subprojects/Catch2-*
13+
subprojects/packagecache

example/api2-samples/meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
project(
2-
'AvCppSamples',
2+
'libavcpp_samples',
33
'cpp',
44
version: '2.0.99'
55
)
66

7-
libavcpp = subproject('libavcpp')
7+
libavcpp = subproject('avcpp')
88

9-
avcpp_dep = libavcpp.get_variable('libavcpp_dep')
9+
avcpp_dep = libavcpp.get_variable('avcpp_dep')
1010

1111
samples = [
1212
'api2-decode',

meson.build

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
project(
2-
'AvCpp',
3-
'c',
2+
'avcpp_setup',
43
'cpp',
54
meson_version: '>= 0.50.0',
65
default_options : [
@@ -10,10 +9,12 @@ project(
109
version: '2.0.99',
1110
)
1211

13-
#add_project_arguments('-std=gnu++17', language : 'cpp')
14-
cc = meson.get_compiler('cpp')
15-
16-
subproject('libavcpp')
17-
subproject('AvCppSamples')
12+
subproject('avcpp')
1813

14+
if get_option('build_samples')
15+
subproject('avcpp_samples')
16+
endif
1917

18+
if get_option('build_tests')
19+
subproject('avcpp_tests')
20+
endif

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
option('build_samples', type : 'boolean', value : true, description: 'set to false if you do not want to compile the sample programs.')
2+
option('build_tests', type : 'boolean', value : true, description: 'set to false if you do not want to compile the tests.')

src/meson.build

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
project(
2-
'libavcpp',
3-
'c',
2+
'avcpp',
43
'cpp',
54
meson_version: '>= 0.50.0',
65
default_options : [
@@ -10,12 +9,11 @@ project(
109
version: '2.0.99',
1110
)
1211

13-
#add_project_arguments('-std=gnu++17', language : 'cpp')
12+
#getting all of the dependencies
1413
cc = meson.get_compiler('cpp')
1514

16-
libavcpp_deps = [
15+
avcpp_deps = [
1716
dependency('threads', required : true),
18-
#dependency('FFmpeg', required : true, method : 'cmake', components : ['AVCODEC AVFORMAT AVUTIL AVDEVICE AVFILTER SWSCALE SWRESAMPLE']),
1917
dependency('libavcodec', required: true),
2018
dependency('libavformat', required: true),
2119
dependency('libavutil', required: true),
@@ -26,9 +24,11 @@ libavcpp_deps = [
2624
cc.find_library('dl', required : false),
2725
]
2826

29-
libavcpp_incdir = include_directories('.')
27+
#setting the include dir to the current folder (src)
28+
avcpp_incdir = include_directories('.','filters')
3029

31-
libavcpp_sources = [
30+
#listing all the source files
31+
avcpp_sources = [
3232
'audioresampler.cpp',
3333
'averror.cpp',
3434
'avtime.cpp',
@@ -39,7 +39,6 @@ libavcpp_sources = [
3939
'formatcontext.cpp',
4040
'format.cpp',
4141
'frame.cpp',
42-
#'libavcpp.pc.in',
4342
'packet.cpp',
4443
'pixelformat.cpp',
4544
'rational.cpp',
@@ -48,21 +47,34 @@ libavcpp_sources = [
4847
'stream.cpp',
4948
'timestamp.cpp',
5049
'videorescaler.cpp',
50+
51+
'filters/buffersink.cpp',
52+
'filters/buffersrc.cpp',
53+
'filters/filtercontext.cpp',
54+
'filters/filter.cpp',
55+
'filters/filtergraph.cpp',
56+
'filters/filterpad.cpp',
57+
5158
]
5259

53-
libavcpp = library(
54-
'libavcpp',
55-
libavcpp_sources,
60+
#defining how to build the library
61+
avcpp = library(
62+
'avcpp',
63+
avcpp_sources,
5664
version : meson.project_version(),
5765
soversion : '0',
58-
include_directories : libavcpp_incdir,
59-
dependencies: libavcpp_deps
66+
include_directories : avcpp_incdir,
67+
dependencies: avcpp_deps
6068
)
6169

62-
libavcpp_dep = declare_dependency(
63-
include_directories : libavcpp_incdir,
64-
link_with : libavcpp,
65-
dependencies : libavcpp_deps,
70+
#export the dependency information
71+
avcpp_dep = declare_dependency(
72+
include_directories : avcpp_incdir,
73+
link_with : avcpp,
74+
dependencies : avcpp_deps,
6675
version: meson.project_version()
6776
)
6877

78+
#generate pkg-config
79+
pkg = import('pkgconfig')
80+
pkg.generate(avcpp)
File renamed without changes.
File renamed without changes.

subprojects/avcpp_tests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../tests/

subprojects/catch2.wrap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[wrap-file]
2+
directory = Catch2-2.11.3
3+
4+
source_url = https://github.com/catchorg/Catch2/archive/v2.11.3.zip
5+
source_filename = Catch2-2.11.3.zip
6+
source_hash = c5a0a7510379c6f37f70b329986a335a7b8489d67ac417ce8f4262d0cae4cc5d
7+
8+
patch_url = https://wrapdb.mesonbuild.com/v1/projects/catch2/2.11.3/1/get_zip
9+
patch_filename = catch2-2.11.3-1-wrap.zip
10+
patch_hash = 63c09cb68280435040ad304b3dd87ecfe69dbc216608991d0a82569a63119e57

tests/meson.build

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
project(
2+
'avcpp_tests',
3+
'cpp',
4+
version: '0.0.1',
5+
meson_version: '>= 0.50.0',
6+
default_options : [
7+
'c_std=c11',
8+
'cpp_std=c++17'
9+
]
10+
)
11+
12+
#get catch2
13+
catch2 = dependency('catch2', required: false)
14+
if not catch2.found()
15+
catch2_proj = subproject('catch2')
16+
catch2 = catch2_proj.get_variable('catch2_dep')
17+
endif
18+
19+
#create main_test as library and export the dependency
20+
main_test = static_library(
21+
'main_test',
22+
'test-main.cpp',
23+
dependencies: catch2
24+
)
25+
26+
main_test_dep = declare_dependency(
27+
link_with : main_test,
28+
dependencies : catch2,
29+
version: meson.project_version()
30+
)
31+
32+
#getting the dependencies for libavcpp
33+
libavcpp = subproject('avcpp')
34+
deps = [libavcpp.get_variable('avcpp_dep')]
35+
36+
#make both dependencies into one array
37+
deps += main_test_dep
38+
39+
tests = [
40+
'Frame',
41+
'AvDeleter',
42+
'Packet',
43+
]
44+
45+
#create all the tests
46+
foreach test_obj : tests
47+
exe = executable(
48+
test_obj,
49+
test_obj + '.cpp',
50+
dependencies: deps
51+
)
52+
test(test_obj + ' Test', exe)
53+
endforeach

0 commit comments

Comments
 (0)