tweak Grid repositioning code to be a little more O(N)
[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         'grid.cc',
46         'image.cc',
47         'line.cc',
48         'line_set.cc',
49         'lookup_table.cc',
50         'meter.cc',
51         'outline.cc',
52         'pixbuf.cc',
53         'poly_item.cc',
54         'poly_line.cc',
55         'polygon.cc',
56         'rectangle.cc',
57         'root_group.cc',
58         'ruler.cc',
59         'scroll_group.cc',
60         'stateful_image.cc',
61         'text.cc',
62         'tracking_text.cc',
63         'types.cc',
64         'utils.cc',
65         'wave_view.cc',
66         'widget.cc',
67         'xfade_curve.cc',
68 ]
69
70 def options(opt):
71     autowaf.set_options(opt)
72
73 def configure(conf):
74     conf.load ('compiler_cxx')
75     autowaf.configure(conf)
76     autowaf.check_pkg(conf, 'cairomm-1.0', uselib_store='CAIROMM', atleast_version='1.8.4')
77
78 def build(bld):
79     # Library
80     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
81         obj = bld.shlib(features = 'cxx cxxshlib', source=canvas_sources)
82         obj.defines      = [ 'LIBCANVAS_DLL_EXPORTS=1' ]
83     else:
84         obj = bld.stlib(features = 'cxx cxxstlib', source=canvas_sources)
85         obj.cxxflags     = [ '-fPIC' ]
86         obj.cflags       = [ '-fPIC' ]
87         obj.defines      = [ ]
88
89     obj.export_includes = ['.']
90     obj.includes     = ['.']
91     obj.uselib       = 'SIGCPP CAIROMM GTKMM BOOST XML'
92     obj.use          = [ 'libpbd', 'libevoral', 'libardour', 'libgtkmm2ext', 'libevoral' ]
93     obj.name         = 'libcanvas'
94     obj.target       = 'canvas'
95     obj.vnum         = CANVAS_LIB_VERSION
96     obj.install_path = bld.env['LIBDIR']
97     obj.defines      += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
98
99     # canvas unit-tests are outdated
100     if False and bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
101             unit_testobj              = bld(features = 'cxx cxxprogram')
102             unit_testobj.source       = '''
103                     test/group.cc
104                     test/arrow.cc
105                     test/optimizing_lookup_table.cc
106                     test/polygon.cc
107                     test/types.cc
108                     test/render.cc
109                     test/xml.cc
110                     test/wave_view.cc
111                     test/item.cc
112                     test/testrunner.cpp
113                 '''.split()
114
115             unit_testobj.includes     = obj.includes + ['test', '../pbd']
116             unit_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
117             unit_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
118             unit_testobj.name         = 'libcanvas-unit-tests'
119             unit_testobj.target       = 'run-tests'
120             unit_testobj.install_path = ''
121             unit_testobj.cxxflags     = ['-DPACKAGE="libcanvastest"']
122             unit_testobj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
123             unit_testobj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFDIR']) + '"']
124             unit_testobj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
125
126             manual_tests              = '''
127                         test/hello_world.cc
128                         test/gtk_many.cc
129                         test/gtk_scene.cc
130                         test/gtk_movement.cc
131                         test/gtk_viewport.cc
132                         test/gtk_drag.cc
133                 '''.split()
134
135             for t in manual_tests:
136                     target = t[:-3]
137                     name = t[t.find('/')+1:-3]
138                     manual_testobj = bld(features = 'cxx cxxprogram')
139                     manual_testobj.source = t
140                     manual_testobj.includes = obj.includes + ['test', '../pbd']
141                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
142                     manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
143                     manual_testobj.name         = 'libcanvas-manual-test-%s' % name
144                     manual_testobj.target       = target
145                     manual_testobj.install_path = ''
146
147             benchmarks = '''
148                         benchmark/items_at_point.cc
149                         benchmark/render_parts.cc
150                         benchmark/render_from_log.cc
151                         benchmark/render_whole.cc
152                 '''.split()
153
154             for t in benchmarks:
155                     target = t[:-3]
156                     name = t[t.find('/')+1:-3]
157                     manual_testobj = bld(features = 'cxx cxxprogram')
158                     manual_testobj.source = [ t, 'benchmark/benchmark.cc' ]
159                     manual_testobj.includes = obj.includes + ['test', '../pbd']
160                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
161                     manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
162                     manual_testobj.name         = 'libcanvas-benchmark-%s' % name
163                     manual_testobj.target       = target
164                     manual_testobj.install_path = ''
165
166 def shutdown():
167     autowaf.shutdown()
168