9f5c4749e7e85700a67921d189dca44ddd30b656
[ardour.git] / libs / surfaces / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 import Options
4
5 # Version of this package (even if built as a child)
6 LIBSURFACES_VERSION = '4.1.0'
7
8 # Library version (UNIX style major, minor, micro)
9 # major increment <=> incompatible changes
10 # minor increment <=> compatible changes (additions)
11 # micro increment <=> no interface changes
12 LIBSURFACES_LIB_VERSION = '4.1.0'
13
14 # Variables for 'waf dist'
15 APPNAME = 'libsurfaces'
16 VERSION = LIBSURFACES_VERSION
17
18 # Mandatory variables
19 top = '.'
20 out = 'build'
21
22 children = [
23         'control_protocol',
24         'frontier',
25         'generic_midi',
26         'mackie',
27         'osc',
28         'powermate',
29         'tranzport',
30         'wiimote'
31 ]
32
33 def options(opt):
34     autowaf.set_options(opt)
35
36 def sub_config_and_use(conf, name, has_objects = True):
37     conf.sub_config(name)
38     autowaf.set_local_lib(conf, name, has_objects)
39
40 def configure(conf):
41     autowaf.set_recursive()
42     autowaf.configure(conf)
43
44     for i in children:
45         sub_config_and_use(conf, i)
46
47     autowaf.check_pkg(conf, 'libusb-1.0', uselib_store='USB', mandatory=False)
48     if conf.env['HAVE_USB']:
49         conf.define('BUILD_TRANZPORT', 1)
50
51     #conf.check_cc (lib='libusb', header_name='libusb.h', function_name='usb_interrupt_write', define_name='BUILD_TRANZPORT')
52     conf.check_cc (header_name='linux/input.h', define_name='BUILD_POWERMATE')
53     conf.check_cc (lib='lo', header_name='lo/lo.h', function_name='lo_server_new', define_name='BUILD_OSC')
54
55     if Options.options.wiimote:
56         conf.check_cc (header_name='cwiid.h',define_name='HAVE_CWIID_H')
57         if not conf.env['HAVE_CWIID_H']:
58             print('WIIMOTE configured but you are missing libcwiid!')
59             sys.exit(1)
60         conf.check_cc (header_name='bluetooth/bluetooth.h',define_name='HAVE_BLUETOOTH_H')
61         if not conf.env['HAVE_BLUETOOTH_H']:
62             print('WIIMOTE configured but you are missing the libbluetooth headers needed to compile wiimote support!')
63             sys.exit(1)
64         conf.define ('BUILD_WIIMOTE', 1)
65
66 def build(bld):
67     bld.add_subdirs('control_protocol')
68     bld.add_subdirs('generic_midi')
69     bld.add_subdirs('mackie')
70     if bld.env['BUILD_OSC']:
71         bld.add_subdirs('osc')
72     if bld.env['BUILD_POWERMATE']:
73         bld.add_subdirs('powermate')
74     if bld.env['BUILD_WIIMOTE']:
75         bld.add_subdirs('wiimote')
76     if bld.env['BUILD_TRANZPORT']:
77         bld.add_subdirs('tranzport')
78
79 def shutdown():
80     autowaf.shutdown()