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