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