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