Merge remote-tracking branch 'remotes/origin/cairocanvas' into windows
[ardour.git] / libs / midi++2 / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
4 import os
5 import sys
6
7 # Version of this package (even if built as a child)
8 MAJOR = '2'
9 MINOR = '1'
10 MICRO = '1'
11 LIBMIDIPP_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
12
13 # Library version (UNIX style major, minor, micro)
14 # major increment <=> incompatible changes
15 # minor increment <=> compatible changes (additions)
16 # micro increment <=> no interface changes
17 LIBMIDIPP_LIB_VERSION = '4.1.0'
18
19 # Variables for 'waf dist'
20 APPNAME = 'libmidipp'
21 VERSION = LIBMIDIPP_VERSION
22
23 # Mandatory variables
24 top = '.'
25 out = 'build'
26
27 path_prefix = 'libs/midi++2/'
28
29
30 libmidi_sources = [
31         'midi.cc',
32         'channel.cc',
33         'ipmidi_port.cc',
34         'parser.cc',
35         'port.cc',
36         'midnam_patch.cc',
37         'mmc.cc',
38         'mtc.cc',
39         'version.cc',
40 ]
41
42 def options(opt):
43     autowaf.set_options(opt)
44     opt.add_option('--test', action='store_true', default=False, dest='build_tests',
45                     help="Build unit tests")
46
47 def configure(conf):
48     conf.load('compiler_cxx')
49     autowaf.build_version_files(path_prefix+'midi++/version.h', path_prefix+'version.cc',
50                     'midipp', MAJOR, MINOR, MICRO)
51     autowaf.configure(conf)
52     autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
53     autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.118.2')
54     autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
55     autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
56
57     # Boost headers
58     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
59     autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
60
61 def build(bld):
62     # Library
63     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
64         obj              = bld.shlib(features = 'cxx cxxshlib', source=libmidi_sources)
65     else:
66         obj              = bld.stlib(features = 'cxx cxxstlib', source=libmidi_sources)
67         obj.cxxflags = [ '-fPIC', '-DWITH_JACK_MIDI' ]
68     # everybody loves JACK
69     obj.export_includes = ['.']
70     obj.includes     = ['.', '../surfaces/control_protocol', '../ardour' ]
71     obj.name         = 'libmidipp'
72     obj.target       = 'midipp'
73     obj.uselib       = 'GLIBMM SIGCPP XML JACK OSX'
74     obj.use          = 'libpbd libevoral libtimecode'
75     obj.vnum         = LIBMIDIPP_LIB_VERSION
76     obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
77
78     if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'): 
79         # Unit tests
80         obj              = bld(features = 'cxx cxxprogram')
81         obj.source       = '''
82                 test/MidnamTest.cpp
83                 test/testrunner.cpp
84         '''
85         obj.includes     = ['.', './src']
86         obj.use          = 'libmidipp'
87         obj.uselib       = 'CPPUNIT XML'
88         obj.target       = 'run-tests'
89         obj.name         = 'libmidipp-tests'
90         obj.install_path = ''
91
92 def shutdown():
93     autowaf.shutdown()