Skip to content

Commit 282485d

Browse files
committed
Added waf buildscript.
Building on Linux will now be simple. Issue $ CXXFLAGS='<crazy optimization flags you want>' ./waf configure $ ./waf $ sudo ./waf install $ sudo ldconfig to build and install DSPFilters. Alternatively, use $ ./waf configure --build-demo to also build DSPFiltersDemo. Note that building DSPFilters should be possible on any system, but DSPFiltersDemo only gets configured to use POSIX libraries, X11 and ALSA. Consequenty, building on BSD/UNIX/Linux should work, but on other platforms, there may be some problems. Tested on ArchLinux (with Python 3).
1 parent 4b20219 commit 282485d

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
.waf*
3+
.lock*
4+
.*.sw*

Diff for: waf

85.6 KB
Binary file not shown.

Diff for: wscript

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
import os, sys
3+
from waflib import Logs
4+
5+
def options(opt):
6+
opt.load('compiler_cxx')
7+
config_options = opt.get_option_group('configure options')
8+
config_options.add_option('--build-demo',
9+
action='store_true',
10+
dest='build_demo',
11+
help='build the demo application [default: false]')
12+
13+
def configure(conf):
14+
conf.load('compiler_cxx')
15+
configure_lib(conf)
16+
if conf.options.build_demo:
17+
Logs.warn('DSPFiltersDemo: demo application will also be built.')
18+
configure_demo(conf)
19+
20+
def configure_lib(conf):
21+
pass
22+
23+
def configure_demo(conf):
24+
conf.env['BUILD_DEMO'] = True
25+
configure_juce(conf)
26+
27+
def configure_juce(conf):
28+
juce_required_libs=[]
29+
juce_required_packages=[]
30+
31+
if os.name.startswith('posix') and not sys.platform.startswith('darwin'):
32+
juce_required_libs+=['dl', 'pthread', 'rt']
33+
juce_required_packages+=['freetype2', 'gl', 'glu', 'x11', 'xinerama', 'alsa', 'xext']
34+
else:
35+
# TODO: add Darwin and non-POSIX dependency checks
36+
conf.fatal('DSPFiltersDemo: Building DSPFiltersDemo with waf is currently only possible on'
37+
' POSIX systems with X11.')
38+
39+
for l in juce_required_libs:
40+
conf.check(
41+
lib=l,
42+
uselib_store=l)
43+
for pkg in juce_required_packages:
44+
conf.check_cfg(
45+
package=pkg,
46+
uselib_store=pkg,
47+
args=['--cflags', '--libs'])
48+
conf.env.append_value('JUCE_USELIBS', juce_required_libs)
49+
conf.env.append_value('JUCE_USELIBS', juce_required_packages)
50+
51+
52+
def build(bld):
53+
build_lib(bld)
54+
if bld.env['BUILD_DEMO']:
55+
build_demo(bld)
56+
57+
def build_lib(bld):
58+
dspfilters_include_dir = bld.path.find_dir('shared/DSPFilters/include')
59+
bld.install_files('${PREFIX}/include',
60+
dspfilters_include_dir.ant_glob('**/*.h'),
61+
cwd=dspfilters_include_dir,
62+
relative_trick=True)
63+
bld.shlib(
64+
source=bld.path.ant_glob('shared/DSPFilters/source/*.cpp'),
65+
includes='shared/DSPFilters/include',
66+
target='DSPFilters')
67+
68+
def build_demo(bld):
69+
build_juce(bld)
70+
bld.program(
71+
source=bld.path.ant_glob('shared/DSPFiltersDemo/source/*.cpp'),
72+
includes=['shared/DSPFiltersDemo/source', 'shared/DSPFilters/include', 'shared/JuceAmalgam'],
73+
use=bld.env['JUCE_USELIBS'] + ['JuceAmalgam', 'DSPFilters'],
74+
target='DSPFiltersDemo')
75+
76+
def build_juce(bld):
77+
bld.stlib(
78+
source=bld.path.ant_glob('shared/JuceAmalgam/*.cpp'),
79+
includes='shared/JuceAmalgam',
80+
use=bld.env['JUCE_USELIBS'],
81+
target='JuceAmalgam')
82+
83+
# vim: syntax=python

0 commit comments

Comments
 (0)