add canvas-based Meter object
[ardour.git] / libs / canvas / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
4 from waflib import TaskGen
5 import os
6
7 # Version of this package (even if built as a child)
8 MAJOR = '0'
9 MINOR = '0'
10 MICRO = '0'
11 CANVAS_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 CANVAS_LIB_VERSION = '0.0.0'
18
19 # Variables for 'waf dist'
20 APPNAME = 'canvas'
21 VERSION = CANVAS_VERSION
22 I18N_PACKAGE = 'libcanvas'
23
24 # Mandatory variables
25 top = '.'
26 out = 'build'
27
28 path_prefix = 'libs/canvas/'
29
30 canvas_sources = [
31         'arc.cc',
32         'arrow.cc',
33         'box.cc',
34         'canvas.cc',
35         'circle.cc',
36         'colors.cc',
37         'colorspace.cc',
38         'container.cc',
39         'curve.cc',
40         'debug.cc',
41         'item.cc',
42         'fill.cc',
43         'flag.cc',
44         'framed_curve.cc',
45         'image.cc',
46         'line.cc',
47         'line_set.cc',
48         'lookup_table.cc',
49         'meter.cc',
50         'outline.cc',
51         'pixbuf.cc',
52         'poly_item.cc',
53         'poly_line.cc',
54         'polygon.cc',
55         'rectangle.cc',
56         'root_group.cc',
57         'ruler.cc',
58         'scroll_group.cc',
59         'stateful_image.cc',
60         'text.cc',
61         'tracking_text.cc',
62         'types.cc',
63         'utils.cc',
64         'wave_view.cc',
65         'widget.cc',
66         'xfade_curve.cc',
67 ]
68
69 def options(opt):
70     autowaf.set_options(opt)
71
72 def configure(conf):
73     conf.load ('compiler_cxx')
74     autowaf.configure(conf)
75     autowaf.check_pkg(conf, 'cairomm-1.0', uselib_store='CAIROMM', atleast_version='1.8.4')
76
77 def build(bld):
78     # Library
79     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
80         obj = bld.shlib(features = 'cxx cxxshlib', source=canvas_sources)
81         obj.defines      = [ 'LIBCANVAS_DLL_EXPORTS=1' ]
82     else:
83         obj = bld.stlib(features = 'cxx cxxstlib', source=canvas_sources)
84         obj.cxxflags     = [ '-fPIC' ]
85         obj.cflags       = [ '-fPIC' ]
86         obj.defines      = [ ]
87
88     obj.export_includes = ['.']
89     obj.includes     = ['.']
90     obj.uselib       = 'SIGCPP CAIROMM GTKMM BOOST XML'
91     obj.use          = [ 'libpbd', 'libevoral', 'libardour', 'libgtkmm2ext', 'libevoral' ]
92     obj.name         = 'libcanvas'
93     obj.target       = 'canvas'
94     obj.vnum         = CANVAS_LIB_VERSION
95     obj.install_path = bld.env['LIBDIR']
96     obj.defines      += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
97
98     # canvas unit-tests are outdated
99     if False and bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
100             unit_testobj              = bld(features = 'cxx cxxprogram')
101             unit_testobj.source       = '''
102                     test/group.cc
103                     test/arrow.cc
104                     test/optimizing_lookup_table.cc
105                     test/polygon.cc
106                     test/types.cc
107                     test/render.cc
108                     test/xml.cc
109                     test/wave_view.cc
110                     test/item.cc
111                     test/testrunner.cpp
112                 '''.split()
113
114             unit_testobj.includes     = obj.includes + ['test', '../pbd']
115             unit_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
116             unit_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
117             unit_testobj.name         = 'libcanvas-unit-tests'
118             unit_testobj.target       = 'run-tests'
119             unit_testobj.install_path = ''
120             unit_testobj.cxxflags     = ['-DPACKAGE="libcanvastest"']
121             unit_testobj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
122             unit_testobj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFDIR']) + '"']
123             unit_testobj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
124
125             manual_tests              = '''
126                         test/hello_world.cc
127                         test/gtk_many.cc
128                         test/gtk_scene.cc
129                         test/gtk_movement.cc
130                         test/gtk_viewport.cc
131                         test/gtk_drag.cc
132                 '''.split()
133
134             for t in manual_tests:
135                     target = t[:-3]
136                     name = t[t.find('/')+1:-3]
137                     manual_testobj = bld(features = 'cxx cxxprogram')
138                     manual_testobj.source = t
139                     manual_testobj.includes = obj.includes + ['test', '../pbd']
140                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
141                     manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
142                     manual_testobj.name         = 'libcanvas-manual-test-%s' % name
143                     manual_testobj.target       = target
144                     manual_testobj.install_path = ''
145
146             benchmarks = '''
147                         benchmark/items_at_point.cc
148                         benchmark/render_parts.cc
149                         benchmark/render_from_log.cc
150                         benchmark/render_whole.cc
151                 '''.split()
152
153             for t in benchmarks:
154                     target = t[:-3]
155                     name = t[t.find('/')+1:-3]
156                     manual_testobj = bld(features = 'cxx cxxprogram')
157                     manual_testobj.source = [ t, 'benchmark/benchmark.cc' ]
158                     manual_testobj.includes = obj.includes + ['test', '../pbd']
159                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
160                     manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
161                     manual_testobj.name         = 'libcanvas-benchmark-%s' % name
162                     manual_testobj.target       = target
163                     manual_testobj.install_path = ''
164
165 def shutdown():
166     autowaf.shutdown()
167