|
| 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