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