1project(
2	'wf-recorder',
3    'c',
4	'cpp',
5	version: '0.2.1',
6	license: 'MIT',
7	meson_version: '>=0.47.0',
8	default_options: [
9		'cpp_std=c++11',
10        'c_std=c11',
11		'warning_level=2',
12		'werror=false',
13	],
14)
15
16conf_data = configuration_data()
17
18conf_data.set('default_codec', get_option('default_codec'))
19
20include_directories(['.'])
21
22add_project_arguments(['-Wno-deprecated-declarations'], language: 'cpp')
23
24project_sources = ['src/frame-writer.cpp', 'src/main.cpp', 'src/averr.c']
25
26wayland_client = dependency('wayland-client')
27wayland_protos = dependency('wayland-protocols')
28
29pulse = dependency('libpulse-simple', required : get_option('pulse'))
30
31if pulse.found()
32    conf_data.set('HAVE_PULSE', true)
33    project_sources += 'src/pulse.cpp'
34endif
35
36opencl = dependency('OpenCL', required : get_option('opencl'))
37
38if opencl.found()
39    conf_data.set('HAVE_OPENCL', true)
40    project_sources += 'src/opencl.cpp'
41endif
42
43libavutil = dependency('libavutil')
44libavcodec = dependency('libavcodec')
45libavformat = dependency('libavformat')
46libavdevice = dependency('libavdevice', required: false)
47sws = dependency('libswscale')
48swr = dependency('libswresample')
49threads = dependency('threads')
50
51conf_data.set('HAVE_LIBAVDEVICE', libavdevice.found())
52
53configure_file(input: 'config.h.in',
54               output: 'config.h',
55               configuration: conf_data)
56
57scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
58
59if scdoc.found()
60    scdoc_bin=find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
61
62    sh = find_program('sh', native: true)
63
64    mandir=get_option('mandir')
65
66    filename ='manpage/wf-recorder.1.scd'
67
68    project_name='wf-recorder'
69    section='1'
70    output= '@0@.@1@'.format(project_name, section)
71
72    custom_target(
73  	project_name,
74	input: filename,
75	output:output,
76	command: [
77	      sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_bin.path(), output)
78	  ],
79	install: true,
80	install_dir: '@0@/man@1@'.format(mandir, section)
81	)
82endif
83
84subdir('proto')
85
86dependencies = [
87    wayland_client, wayland_protos,
88    libavutil, libavcodec, libavformat, libavdevice,
89    wf_protos, sws, threads, pulse, swr, opencl
90]
91
92executable('wf-recorder', project_sources,
93        dependencies: dependencies,
94        install: true)
95