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