add (bezier) curves to canvas, use for automation lines; fix issue with rectangles...
[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         'arrow.cc',
32         'canvas.cc',
33         'curve.cc',
34         'debug.cc',
35         'item.cc',
36         'fill.cc',
37         'flag.cc',
38         'group.cc',
39         'item_factory.cc',
40         'line.cc',
41         'line_set.cc',
42         'lookup_table.cc',
43         'outline.cc',
44         'pixbuf.cc',
45         'poly_item.cc',
46         'poly_line.cc',
47         'polygon.cc',
48         'rectangle.cc',
49         'root_group.cc',
50         'text.cc',
51         'types.cc',
52         'utils.cc',
53         'wave_view.cc'
54 ]
55
56 def options(opt):
57     autowaf.set_options(opt)
58
59 def configure(conf):
60         conf.load ('compiler_cxx')
61         autowaf.configure(conf)
62         autowaf.check_pkg(conf, 'cairomm-1.0', uselib_store='CAIROMM', atleast_version='1.8.4')
63
64 def build(bld):
65     # Library
66     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
67         obj = bld.shlib(features = 'cxx cxxshlib', source=canvas_sources)
68     else:
69         obj = bld.stlib(features = 'cxx cxxstlib', source=canvas_sources)
70         obj.cxxflags     = [ '-fPIC' ]
71         obj.cflags       = [ '-fPIC' ]
72
73     obj.export_includes = ['.']
74     obj.includes     = ['.']
75     obj.uselib       = 'SIGCPP CAIROMM GTKMM'
76     obj.use          = [ 'libpbd', 'libevoral', 'libardour', 'libgtkmm2ext' ]
77     obj.name         = 'libcanvas'
78     obj.target       = 'canvas'
79     obj.vnum         = CANVAS_LIB_VERSION
80     obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
81     obj.defines      = [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
82     
83     if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
84                 
85             manual_tests              = '''
86                         test/hello_world.cc
87                         test/gtk_many.cc
88                         test/gtk_scene.cc
89                         test/gtk_movement.cc
90                         test/gtk_viewport.cc
91                         test/gtk_drag.cc
92                 '''.split()
93
94             for t in manual_tests:
95                     target = t[:-3]
96                     name = t[t.find('/')+1:-3]
97                     manual_testobj = bld.new_task_gen('cxx', 'program')
98                     manual_testobj.source = t
99                     manual_testobj.includes = obj.includes + ['test', '../pbd']
100                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
101                     manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
102                     manual_testobj.name         = 'libcanvas-manual-test-%s' % name
103                     manual_testobj.target       = target
104                     manual_testobj.install_path = ''
105                     
106                     unit_testobj              = bld.new_task_gen('cxx', 'program')
107                     unit_testobj.source       = '''
108                         test/group.cc
109                         test/arrow.cc
110                         test/optimizing_lookup_table.cc
111                         test/polygon.cc
112                         test/types.cc
113                         test/render.cc
114                         test/xml.cc
115                         test/wave_view.cc
116                         test/item.cc
117                         test/testrunner.cpp
118                 '''.split()
119
120                     unit_testobj.includes     = obj.includes + ['test', '../pbd']
121                     unit_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
122                     unit_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
123                     unit_testobj.name         = 'libcanvas-unit-tests'
124                     unit_testobj.target       = 'run-tests'
125                     unit_testobj.install_path = ''
126                     unit_testobj.cxxflags     = ['-DPACKAGE="libcanvastest"']
127                     unit_testobj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
128                     unit_testobj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"']
129                     unit_testobj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
130                     
131             benchmarks = '''
132                         benchmark/items_at_point.cc
133                         benchmark/render_parts.cc
134                         benchmark/render_from_log.cc
135                         benchmark/render_whole.cc
136                 '''.split()
137
138             for t in benchmarks:
139                     target = t[:-3]
140                     name = t[t.find('/')+1:-3]
141                     manual_testobj = bld.new_task_gen('cxx', 'program')
142                     manual_testobj.source = [ t, 'benchmark/benchmark.cc' ]
143                     manual_testobj.includes = obj.includes + ['test', '../pbd']
144                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
145                     manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext'
146                     manual_testobj.name         = 'libcanvas-benchmark-%s' % name
147                     manual_testobj.target       = target
148                     manual_testobj.install_path = ''
149
150 def shutdown():
151         autowaf.shutdown()
152