This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wscript
154 lines (122 loc) · 5 KB
/
wscript
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
#!/usr/bin/env python
import os
import subprocess
import shutil
from waflib import Logs
from waflib.extras import autowaf as autowaf
# Variables for 'waf dist'
APPNAME = 'beatslash-lv2'
VERSION = '1.0.6'
# Mandatory variables
top = '.'
out = 'build'
def options(opt):
autowaf.set_options(opt)
opt.load('compiler_cxx')
opt.load('lv2')
def configure(conf):
autowaf.configure(conf)
autowaf.display_header('beatslash-lv2 Configuration')
conf.load('compiler_cxx')
conf.load('lv2')
autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',atleast_version='2.24.0')
autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK2', atleast_version='2.24.0')
autowaf.check_pkg(conf, 'cairo', uselib_store='CAIRO', atleast_version='1.0.0')
autowaf.check_pkg(conf, 'lv2', uselib_store='LV2', atleast_version='1.2.0')
autowaf.check_pkg(conf, 'lvtk-plugin-1', uselib_store='LVTK_PLUGIN', atleast_version='1.2.0')
autowaf.check_pkg(conf, 'lvtk-ui-1', uselib_store='LVTK_UI', atleast_version='1.2.0')
autowaf.check_pkg(conf, 'lvtk-gtkui-1', uselib_store='LVTK_GTKGUI', atleast_version='1.2.0')
check = 'Extended Initializer Lists'
conf.check_cxx(msg = check,
define_name = 'WAF_CXX_FEATURE_' + check.replace(' ', '_').upper(),
fragment = '#include <vector>\n'+
'struct foo {\n'+
' int i;\n'+
' int j;\n'+
' int k;\n'+
'};\n'+
'int main() {\n'+
' std::vector<foo> v(1);\n'+
' v[0] = {0, 0, 0};\n'+
' return 0;\n'+
'}',
mandatory = False)
# Set env['pluginlib_PATTERN']
pat = conf.env['cxxshlib_PATTERN']
if pat[0:3] == 'lib':
pat = pat[3:]
conf.env['pluginlib_PATTERN'] = pat
autowaf.display_msg(conf, "LV2 bundle directory", conf.env['LV2DIR'])
print('')
def build_plugin(bld, bundle, name, source, cxxflags=[], libs=[], add_source=[]):
penv = bld.env.derive()
penv['cxxshlib_PATTERN'] = bld.env['pluginlib_PATTERN']
obj = bld(features = 'cxx cxxshlib')
obj.env = penv
obj.source = source + add_source
obj.includes = ['.', './src']
obj.name = name
obj.target = os.path.join(bundle, name)
if cxxflags != []:
obj.cxxflags = cxxflags
if libs != []:
obj.uselib = libs
obj.install_path = '${LV2DIR}/' + bundle
# Install data file
data_file = '%s.ttl' % name
bld.install_files('${LV2DIR}/' + bundle, os.path.join(bundle, data_file))
def build_plugin_gui(bld, bundle, name, source, cxxflags=[], libs=[], add_source=[]):
penv = bld.env.derive()
penv['cxxshlib_PATTERN'] = bld.env['pluginlib_PATTERN']
obj = bld(features = 'cxx cxxshlib')
obj.env = penv
obj.source = source + add_source
obj.includes = ['.', './src']
obj.name = name
obj.target = os.path.join(bundle, name)
if cxxflags != []:
obj.cxxflags = cxxflags
if libs != []:
obj.uselib = libs
obj.install_path = '${LV2DIR}/' + bundle
def build(bld):
def do_copy(task):
src = task.inputs[0].abspath()
tgt = task.outputs[0].abspath()
return shutil.copy(src, tgt)
for i in bld.path.ant_glob('beatslash.lv2/*.ttl'):
bld(features = 'subst',
is_copy = True,
source = i,
target = 'beatslash.lv2/%s' % i.name,
install_path = '${LV2DIR}/beatslash.lv2')
plugins = '''
beatrepeater_mono
beatrepeater_stereo
beatslicer_mono
beatslicer_stereo
'''.split()
for i in plugins:
build_plugin(bld, 'beatslash.lv2', i, ['src/%s.cpp' % i],
['-DPLUGIN_CLASS=%s' % i,
'-std=c++11',
'-DURI_PREFIX=\"http://github.com/blablack/beatslash-lv2/\"',
'-DPLUGIN_URI_SUFFIX="%s"' % i,
'-DPLUGIN_HEADER="src/%s.hpp"' % i],
['LV2', 'LVTK_PLUGIN'],
['src/envgen.cpp'])
plugins_gui = '''
beatrepeater_mono_gui
beatrepeater_stereo_gui
beatslicer_mono_gui
beatslicer_stereo_gui
'''.split()
for i in plugins_gui:
build_plugin_gui(bld, 'beatslash.lv2', i, ['src/%s.cpp' % i],
['-DPLUGIN_CLASS=%s' % i,
'-std=c++11',
'-DURI_PREFIX=\"http://github.com/blablack/beatslash-lv2/\"',
'-DPLUGIN_URI_SUFFIX="%s"' % i,
'-DPLUGIN_HEADER="src/%s.hpp"' % i],
['LV2', 'LVTK_PLUGIN', 'LVTK_GTKGUI', 'GTKMM', 'GTK2', 'CAIRO'],
['src/dial.cpp', 'src/labeleddial.cpp', 'src/my_box.cpp'])