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