aboutsummaryrefslogtreecommitdiff
path: root/meson.build
blob: 0f354bdca0b3b4ec7dc7ca98b88cbe0ef81e4078 (plain)
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
project('monitors.lv2', 'c', default_options : [
	'buildtype=release',
	'warning_level=3',
	'werror=false',
	'b_lto=false',
	'c_std=c11'])

build_root = meson.build_root()
add_project_arguments('-D_GNU_SOURCE', language : 'c')

conf_data = configuration_data()
cc = meson.get_compiler('c')

build_idisp= get_option('build-inline-display')

if build_idisp
	add_project_arguments('-DBUILD_IDISP', language: 'c')
	conf_data.set('BUILD_IDISP', '')
else
	conf_data.set('BUILD_IDISP', '#')
endif

cp = find_program('cp')
lv2_validate = find_program('lv2_validate', native : true, required : false)
sord_validate = find_program('sord_validate', native : true, required : false)
lv2lint = find_program('lv2lint', required : false)
clone = [cp, '@INPUT@', '@OUTPUT@']

m_dep = cc.find_library('m')
lv2_dep = dependency('lv2', version : '>=1.14.0')
cairo_dep = dependency('cairo', version : '>=1.0.0',
	static : meson.is_cross_build() and false, #FIXME
	required: build_idisp)

canvas_inc = include_directories('canvas.lv2')
timely_inc = include_directories('timely.lv2')

inst_dir = join_paths(get_option('libdir'), 'lv2', meson.project_name())

srcs = ['monitors.c',
	'monitors_audio_wave.c',
	'monitors_midi_pianoroll.c',
	'monitors_time_metronom.c']
	
c_args = ['-fvisibility=hidden',
	'-ffast-math']

if host_machine.system() == 'windows'
	conf_data.set('UI_TYPE', 'WindowsUI')
elif host_machine.system() == 'darwin'
	conf_data.set('UI_TYPE', 'CocoaUI')
else
	conf_data.set('UI_TYPE', 'X11UI')
endif

mod = shared_module('monitors', srcs,
	c_args : c_args,
	name_prefix : '',
	include_directories : [canvas_inc, timely_inc],
	dependencies : [m_dep, lv2_dep, cairo_dep],
	install : true,
	install_dir : inst_dir)

version = run_command('cat', 'VERSION').stdout().strip().split('.')
conf_data.set('MAJOR_VERSION', version[0])
conf_data.set('MINOR_VERSION', version[1])
conf_data.set('MICRO_VERSION', version[2])

suffix = mod.full_path().strip().split('.')[-1]
conf_data.set('MODULE_SUFFIX', '.' + suffix)

manifest_ttl = configure_file(input : 'manifest.ttl.in', output : 'manifest.ttl',
	configuration : conf_data,
	install : true,
	install_dir : inst_dir)

dsp_ttl = configure_file(input : 'monitors.ttl.in', output : 'monitors.ttl',
	configuration : conf_data,
	install : true,
	install_dir : inst_dir)

if lv2_validate.found() and sord_validate.found()
	test('LV2 validate', lv2_validate,
		args : [manifest_ttl, dsp_ttl])
endif

if lv2lint.found()
	test('LV2 lint', lv2lint,
		args : ['-Ewarn', '-I', join_paths(build_root, ''),
			'http://open-music-kontrollers.ch/lv2/monitors#audio_wave_mono',
			'http://open-music-kontrollers.ch/lv2/monitors#audio_wave_stereo',
			'http://open-music-kontrollers.ch/lv2/monitors#midi_pianoroll',
			'http://open-music-kontrollers.ch/lv2/monitors#time_metronom'])
endif