add a guess at appropriate color management for note velocity display
[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         'container.cc',
37         'curve.cc',
38         'debug.cc',
39         'item.cc',
40         'fill.cc',
41         'flag.cc',
42         'framed_curve.cc',
43         'grid.cc',
44         'image.cc',
45         'line.cc',
46         'line_set.cc',
47         'lookup_table.cc',
48         'meter.cc',
49         'note.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         'widget.cc',
65         'xfade_curve.cc',
66 ]
67
68 def options(opt):
69     autowaf.set_options(opt)
70
71 def configure(conf):
72     conf.load ('compiler_cxx')
73     autowaf.configure(conf)
74     autowaf.check_pkg(conf, 'cairomm-1.0', uselib_store='CAIROMM', atleast_version='1.8.4')
75
76 def build(bld):
77     # Library
78     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
79         obj = bld.shlib(features = 'cxx cxxshlib', source=canvas_sources)
80         obj.defines      = [ 'LIBCANVAS_DLL_EXPORTS=1' ]
81     else:
82         obj = bld.stlib(features = 'cxx cxxstlib', source=canvas_sources)
83         obj.cxxflags     = [ '-fPIC' ]
84         obj.cflags       = [ '-fPIC' ]
85         obj.defines      = [ ]
86
87     obj.export_includes = ['.']
88     obj.includes     = ['.']
89     obj.uselib       = 'SIGCPP CAIROMM GTKMM BOOST XML'
90     obj.use          = [ 'libpbd', 'libgtkmm2ext' ]
91     obj.name         = 'libcanvas'
92     obj.target       = 'canvas'
93     obj.vnum         = CANVAS_LIB_VERSION
94     obj.install_path = bld.env['LIBDIR']
95     obj.defines      += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
96
97     # canvas unit-tests are outdated
98     if False and bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
99             unit_testobj              = bld(features = 'cxx cxxprogram')
100             unit_testobj.source       = '''
101                     test/group.cc
102                     test/arrow.cc
103                     test/optimizing_lookup_table.cc
104                     test/polygon.cc
105                     test/types.cc
106                     test/render.cc
107                     test/xml.cc
108                     test/wave_view.cc
109                     test/item.cc
110                     test/testrunner.cpp
111                 '''.split()
112
113             unit_testobj.includes     = obj.includes + ['test', '../pbd']
114             unit_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
115             unit_testobj.uselib_local = 'libcanvas libgtkmm2ext'
116             unit_testobj.name         = 'libcanvas-unit-tests'
117             unit_testobj.target       = 'run-tests'
118             unit_testobj.install_path = ''
119             unit_testobj.cxxflags     = ['-DPACKAGE="libcanvastest"']
120             unit_testobj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
121             unit_testobj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFDIR']) + '"']
122             unit_testobj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
123
124             manual_tests              = '''
125                         test/hello_world.cc
126                         test/gtk_many.cc
127                         test/gtk_scene.cc
128                         test/gtk_movement.cc
129                         test/gtk_viewport.cc
130                         test/gtk_drag.cc
131                 '''.split()
132
133             for t in manual_tests:
134                     target = t[:-3]
135                     name = t[t.find('/')+1:-3]
136                     manual_testobj = bld(features = 'cxx cxxprogram')
137                     manual_testobj.source = t
138                     manual_testobj.includes = obj.includes + ['test', '../pbd']
139                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
140                     manual_testobj.uselib_local = 'libcanvas libgtkmm2ext'
141                     manual_testobj.name         = 'libcanvas-manual-test-%s' % name
142                     manual_testobj.target       = target
143                     manual_testobj.install_path = ''
144
145             benchmarks = '''
146                         benchmark/items_at_point.cc
147                         benchmark/render_parts.cc
148                         benchmark/render_from_log.cc
149                         benchmark/render_whole.cc
150                 '''.split()
151
152             for t in benchmarks:
153                     target = t[:-3]
154                     name = t[t.find('/')+1:-3]
155                     manual_testobj = bld(features = 'cxx cxxprogram')
156                     manual_testobj.source = [ t, 'benchmark/benchmark.cc' ]
157                     manual_testobj.includes = obj.includes + ['test', '../pbd']
158                     manual_testobj.uselib       = 'CPPUNIT SIGCPP CAIROMM GTKMM'
159                     manual_testobj.uselib_local = 'libcanvas libgtkmm2ext'
160                     manual_testobj.name         = 'libcanvas-benchmark-%s' % name
161                     manual_testobj.target       = target
162                     manual_testobj.install_path = ''
163
164 def shutdown():
165     autowaf.shutdown()
166