Version file building stuff.
[ardour.git] / libs / pbd / wscript
1 #!/usr/bin/env python
2 import autowaf
3
4 # Version of this package (even if built as a child)
5 MAJOR = '4'
6 MINOR = '1'
7 MICRO = '0'
8 LIBPBD_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
9
10 # Library version (UNIX style major, minor, micro)
11 # major increment <=> incompatible changes
12 # minor increment <=> compatible changes (additions)
13 # micro increment <=> no interface changes
14 LIBPBD_LIB_VERSION = '4.1.0'
15
16 # Variables for 'waf dist'
17 APPNAME = 'libpbd'
18 VERSION = LIBPBD_VERSION
19
20 # Mandatory variables
21 srcdir = '.'
22 blddir = 'build'
23
24 path_prefix = 'libs/pbd/'
25
26 def set_options(opt):
27         autowaf.set_options(opt)
28
29 def configure(conf):
30         autowaf.build_version_files(path_prefix+'pbd/version.h', path_prefix+'version.cc',
31                         'libpbd', MAJOR, MINOR, MICRO)
32         autowaf.configure(conf)
33         autowaf.check_tool(conf, 'compiler_cxx')
34         autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
35         autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
36         autowaf.check_pkg(conf, 'uuid', uselib_store='UUID')
37
38         conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT')
39
40         # This must be defined for libpbd only, it breaks ardour
41         conf.check(header_name='execinfo.h', define_name='PBD_HAVE_EXECINFO')
42
43         conf.env.append_value('CXXFLAGS', '-DHAVE_WAFCONFIG_H')
44         conf.write_config_header('wafconfig.h')
45
46         # Boost headers
47         autowaf.check_header(conf, 'boost/shared_ptr.hpp')
48         autowaf.check_header(conf, 'boost/weak_ptr.hpp')
49
50 def build(bld):
51         # Library
52         obj = bld.new_task_gen('cxx', 'shlib')
53         obj.source = '''
54                 basename.cc
55                 base_ui.cc
56                 command.cc
57                 convert.cc
58                 controllable.cc
59                 enumwriter.cc
60                 dmalloc.cc
61                 error.cc
62                 filesystem.cc
63                 filesystem_paths.cc
64                 file_utils.cc
65                 fpu.cc
66                 id.cc
67                 mountpoint.cc
68                 pathscanner.cc
69                 pool.cc
70                 pthread_utils.cc
71                 receiver.cc
72                 search_path.cc
73                 shortpath.cc
74                 stacktrace.cc
75                 stateful.cc
76                 strreplace.cc
77                 strsplit.cc
78                 textreceiver.cc
79                 transmitter.cc
80                 undo.cc
81                 uuid.cc
82                 version.cc
83                 whitespace.cc
84                 xml++.cc
85         '''
86         obj.export_incdirs = ['.']
87         obj.includes     = ['.']
88         obj.name         = 'libpbd'
89         obj.target       = 'pbd'
90         obj.uselib       = 'GLIBMM SIGCPP XML UUID'
91         obj.vnum         = LIBPBD_LIB_VERSION
92         obj.install_path = ''
93         obj.cxxflags     = '-DPACKAGE=\\\"libpbd\\\"'
94         if bld.env['PBD_HAVE_EXECINFO']:
95                 obj.cxxflags += ' -DHAVE_EXECINFO '
96         
97 def shutdown():
98         autowaf.shutdown()
99