212 lines
8.0 KiB
Python
212 lines
8.0 KiB
Python
#!/usr/bin/env python
|
|
from waflib.extras import autowaf as autowaf
|
|
from waflib import Options
|
|
from waflib import TaskGen
|
|
import os
|
|
|
|
# Version of this package (even if built as a child)
|
|
MAJOR = '0'
|
|
MINOR = '0'
|
|
MICRO = '0'
|
|
CANVAS_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
|
|
|
|
# Library version (UNIX style major, minor, micro)
|
|
# major increment <=> incompatible changes
|
|
# minor increment <=> compatible changes (additions)
|
|
# micro increment <=> no interface changes
|
|
CANVAS_LIB_VERSION = '0.0.0'
|
|
|
|
# Variables for 'waf dist'
|
|
APPNAME = 'canvas'
|
|
VERSION = CANVAS_VERSION
|
|
I18N_PACKAGE = 'libcanvas'
|
|
|
|
# Mandatory variables
|
|
top = '.'
|
|
out = 'build'
|
|
|
|
path_prefix = 'libs/canvas/'
|
|
|
|
canvas_sources = [
|
|
'arc.cc',
|
|
'arrow.cc',
|
|
'box.cc',
|
|
'canvas.cc',
|
|
'circle.cc',
|
|
'container.cc',
|
|
'constrained_item.cc',
|
|
'constraint_packer.cc',
|
|
'curve.cc',
|
|
'debug.cc',
|
|
'item.cc',
|
|
'fill.cc',
|
|
'flag.cc',
|
|
'framed_curve.cc',
|
|
'grid.cc',
|
|
'image.cc',
|
|
'line.cc',
|
|
'line_set.cc',
|
|
'lookup_table.cc',
|
|
'meter.cc',
|
|
'note.cc',
|
|
'outline.cc',
|
|
'pixbuf.cc',
|
|
'poly_item.cc',
|
|
'poly_line.cc',
|
|
'polygon.cc',
|
|
'rectangle.cc',
|
|
'root_group.cc',
|
|
'ruler.cc',
|
|
'scroll_group.cc',
|
|
'stateful_image.cc',
|
|
'step_button.cc',
|
|
'table.cc',
|
|
'text.cc',
|
|
'tracking_text.cc',
|
|
'types.cc',
|
|
'utils.cc',
|
|
'widget.cc',
|
|
'xfade_curve.cc',
|
|
]
|
|
|
|
def options(opt):
|
|
autowaf.set_options(opt)
|
|
|
|
def configure(conf):
|
|
conf.load ('compiler_cxx')
|
|
autowaf.configure(conf)
|
|
autowaf.check_pkg(conf, 'cairomm-1.0', uselib_store='CAIROMM', atleast_version='1.8.4')
|
|
|
|
def build(bld):
|
|
# Library
|
|
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
|
|
obj = bld.shlib(features = 'cxx cxxshlib', source=canvas_sources)
|
|
obj.defines = [ 'LIBCANVAS_DLL_EXPORTS=1' ]
|
|
else:
|
|
obj = bld.stlib(features = 'cxx cxxstlib', source=canvas_sources)
|
|
obj.cxxflags = [ bld.env['compiler_flags_dict']['pic'] ]
|
|
obj.cflags = [ bld.env['compiler_flags_dict']['pic'] ]
|
|
obj.defines = [ ]
|
|
|
|
obj.export_includes = ['.']
|
|
obj.includes = ['.']
|
|
obj.uselib = 'SIGCPP CAIROMM GTKMM BOOST XML OSX'
|
|
obj.use = [ 'libpbd', 'libgtkmm2ext' ]
|
|
obj.name = 'libcanvas'
|
|
obj.target = 'canvas'
|
|
obj.vnum = CANVAS_LIB_VERSION
|
|
obj.install_path = bld.env['LIBDIR']
|
|
obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
|
|
|
|
# interactive (non-automated, non-cppunit) canvas tests
|
|
# fails to link when cross-compiling (lacks libpbd dependencies
|
|
# uselib = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM ARCHIVE CURL'
|
|
if False : # bld.env['BUILD_TESTS']:
|
|
constraint_test_src = [ 'test/interactive/constraint_test.cc' ]
|
|
constraint_test = bld (features = 'cxx cxxprogram')
|
|
constraint_test.source = constraint_test_src
|
|
constraint_test.includes = obj.includes + ['../pbd', '../gtkmm2ext']
|
|
constraint_test.use = [ 'GTKMM', 'libcanvas', 'libgtkmm2ext' ]
|
|
constraint_test.name = 'constraint_test'
|
|
constraint_test.target = 'constraint_test'
|
|
constraint_test.install_path = ''
|
|
|
|
constraint_test2_src = [ 'test/interactive/constraint_test2.cc' ]
|
|
constraint_test2 = bld (features = 'cxx cxxprogram')
|
|
constraint_test2.source = constraint_test2_src
|
|
constraint_test2.includes = obj.includes + ['../pbd', '../gtkmm2ext']
|
|
constraint_test2.use = [ 'GTKMM', 'libcanvas', 'libgtkmm2ext' ]
|
|
constraint_test2.name = 'constraint_test2'
|
|
constraint_test2.target = 'constraint_test2'
|
|
constraint_test2.install_path = ''
|
|
|
|
constraint_test3_src = [ 'test/interactive/constraint_test3.cc' ]
|
|
constraint_test3 = bld (features = 'cxx cxxprogram')
|
|
constraint_test3.source = constraint_test3_src
|
|
constraint_test3.includes = obj.includes + ['../pbd', '../gtkmm2ext']
|
|
constraint_test3.use = [ 'GTKMM', 'libcanvas', 'libgtkmm2ext' ]
|
|
constraint_test3.name = 'constraint_test3'
|
|
constraint_test3.target = 'constraint_test3'
|
|
constraint_test3.install_path = ''
|
|
|
|
constraint_test4_src = [ 'test/interactive/constraint_test4.cc' ]
|
|
constraint_test4 = bld (features = 'cxx cxxprogram')
|
|
constraint_test4.source = constraint_test4_src
|
|
constraint_test4.includes = obj.includes + ['../pbd', '../gtkmm2ext']
|
|
constraint_test4.use = [ 'GTKMM', 'libcanvas', 'libgtkmm2ext' ]
|
|
constraint_test4.name = 'constraint_test4'
|
|
constraint_test4.target = 'constraint_test4'
|
|
constraint_test4.install_path = ''
|
|
|
|
# canvas unit-tests are outdated
|
|
if False and bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
|
|
unit_testobj = bld(features = 'cxx cxxprogram')
|
|
unit_testobj.source = '''
|
|
test/group.cc
|
|
test/arrow.cc
|
|
test/optimizing_lookup_table.cc
|
|
test/polygon.cc
|
|
test/types.cc
|
|
test/render.cc
|
|
test/xml.cc
|
|
test/wave_view.cc
|
|
test/item.cc
|
|
test/testrunner.cpp
|
|
'''.split()
|
|
|
|
unit_testobj.includes = obj.includes + ['test', '../pbd']
|
|
unit_testobj.uselib = 'CPPUNIT SIGCPP CAIROMM GTKMM'
|
|
unit_testobj.uselib_local = 'libcanvas libgtkmm2ext'
|
|
unit_testobj.name = 'libcanvas-unit-tests'
|
|
unit_testobj.target = 'run-tests'
|
|
unit_testobj.install_path = ''
|
|
unit_testobj.cxxflags = ['-DPACKAGE="libcanvastest"']
|
|
unit_testobj.cxxflags += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
|
|
unit_testobj.cxxflags += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFDIR']) + '"']
|
|
unit_testobj.cxxflags += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
|
|
|
|
manual_tests = '''
|
|
test/hello_world.cc
|
|
test/gtk_many.cc
|
|
test/gtk_scene.cc
|
|
test/gtk_movement.cc
|
|
test/gtk_viewport.cc
|
|
test/gtk_drag.cc
|
|
'''.split()
|
|
|
|
for t in manual_tests:
|
|
target = t[:-3]
|
|
name = t[t.find('/')+1:-3]
|
|
manual_testobj = bld(features = 'cxx cxxprogram')
|
|
manual_testobj.source = t
|
|
manual_testobj.includes = obj.includes + ['test', '../pbd']
|
|
manual_testobj.uselib = 'CPPUNIT SIGCPP CAIROMM GTKMM'
|
|
manual_testobj.uselib_local = 'libcanvas libgtkmm2ext'
|
|
manual_testobj.name = 'libcanvas-manual-test-%s' % name
|
|
manual_testobj.target = target
|
|
manual_testobj.install_path = ''
|
|
|
|
benchmarks = '''
|
|
benchmark/items_at_point.cc
|
|
benchmark/render_parts.cc
|
|
benchmark/render_from_log.cc
|
|
benchmark/render_whole.cc
|
|
'''.split()
|
|
|
|
for t in benchmarks:
|
|
target = t[:-3]
|
|
name = t[t.find('/')+1:-3]
|
|
manual_testobj = bld(features = 'cxx cxxprogram')
|
|
manual_testobj.source = [ t, 'benchmark/benchmark.cc' ]
|
|
manual_testobj.includes = obj.includes + ['test', '../pbd']
|
|
manual_testobj.uselib = 'CPPUNIT SIGCPP CAIROMM GTKMM'
|
|
manual_testobj.uselib_local = 'libcanvas libgtkmm2ext'
|
|
manual_testobj.name = 'libcanvas-benchmark-%s' % name
|
|
manual_testobj.target = target
|
|
manual_testobj.install_path = ''
|
|
|
|
|
|
def shutdown():
|
|
autowaf.shutdown()
|
|
|