aboutsummaryrefslogtreecommitdiff
path: root/meson.build
blob: 9643ca11583f11ebd5b21dd35f5ec6eb03866b45 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
project('shells_bells.lv2', 'c', default_options : [
	'buildtype=release',
	'warning_level=3',
	'werror=false',
	'b_lto=false',
	'c_std=gnu11'])

d2tk = subproject('d2tk')

lv2libdir = get_option('lv2libdir')
build_tests = get_option('build-tests')
use_fontconfig = get_option('use-fontconfig')

inst_dir = join_paths(lv2libdir, meson.project_name())

if get_option('use-backend-nanovg').enabled()
	d2tk_dep = d2tk.get_variable('d2tk_nanovg')
elif get_option('use-backend-cairo').enabled()
	d2tk_dep = d2tk.get_variable('d2tk_cairo')
else
	error('no valid UI backend given')
endif

source_root = meson.source_root()
build_root = meson.build_root()

add_project_arguments('-D_GNU_SOURCE', language : 'c')

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

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)

lv2_dep = dependency('lv2', version : '>=1.14.0')

dsp_deps = [lv2_dep]
ui_deps = [lv2_dep, d2tk_dep]

props_inc = include_directories('props.lv2')
ser_inc = include_directories('ser_atom.lv2')
inc_dir = [props_inc, ser_inc]

dsp_srcs = ['shells_bells.c']

ui_srcs = ['shells_bells_ui.c']

c_args = ['-fvisibility=hidden']

version = run_command('cat', 'VERSION').stdout().strip().split('.')
add_project_arguments('-DSHELLS_BELLS_VERSION="'
	+ version[0] + '.' + version[1] + '.' + version[2] + '"', language : 'c')
conf_data.set('MAJOR_VERSION', version[0])
conf_data.set('MINOR_VERSION', version[1])
conf_data.set('MICRO_VERSION', version[2])

mod = shared_module('shells_bells', dsp_srcs,
	c_args : c_args,
	include_directories : inc_dir,
	name_prefix : '',
	dependencies : dsp_deps,
	install : true,
	install_dir : inst_dir)

ui = shared_module('shells_bells_ui', ui_srcs,
	c_args : c_args,
	include_directories : inc_dir,
	name_prefix : '',
	dependencies : ui_deps,
	install : true,
	install_dir : inst_dir)

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 : 'shells_bells.ttl.in',
	output : 'shells_bells.ttl',
	configuration : conf_data,
	install : true,
	install_dir : inst_dir)

ui_ttl = configure_file(
	input : 'shells_bells_ui.ttl',
	output : 'shells_bells_ui.ttl',
	copy: true,
	install : true,
	install_dir : inst_dir)

if not use_fontconfig.enabled()
	fira_sans_bold_ttf = d2tk.get_variable('fira_sans_bold_ttf')
	fira_code_bold_ttf = d2tk.get_variable('fira_code_bold_ttf')
	fira_code_light_ttf = d2tk.get_variable('fira_code_light_ttf')
	fira_code_medium_ttf = d2tk.get_variable('fira_code_medium_ttf')
	fira_code_regular_ttf = d2tk.get_variable('fira_code_regular_ttf')

	configure_file(
		input : fira_sans_bold_ttf,
		output : 'FiraSans:bold.ttf',
		copy : true,
		install : true,
		install_dir : inst_dir)
	configure_file(
		input : fira_code_bold_ttf,
		output : 'FiraCode:bold.ttf',
		copy : true,
		install : true,
		install_dir : inst_dir)
	configure_file(
		input : fira_code_light_ttf,
		output : 'FiraCode:light.ttf',
		copy : true,
		install : true,
		install_dir : inst_dir)
	configure_file(
		input : fira_code_medium_ttf,
		output : 'FiraCode:medium.ttf',
		copy : true,
		install : true,
		install_dir : inst_dir)
	configure_file(
		input : fira_code_regular_ttf,
		output : 'FiraCode:regular.ttf',
		copy : true,
		install : true,
		install_dir : inst_dir)
endif

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

	if lv2lint.found()
		test('LV2 lint', lv2lint,
			args : ['-M', 'pack',
				'-E', 'warn',
				'-I', join_paths(build_root, ''),
				'http://open-music-kontrollers.ch/lv2/shells_bells#bells'
			])
	endif
endif