2008-09-30 11:34:54 -04:00
|
|
|
#!/usr/bin/env python
|
2008-10-12 22:43:14 -04:00
|
|
|
import autowaf
|
2009-10-19 21:07:15 -04:00
|
|
|
import Options
|
2009-02-26 23:40:44 -05:00
|
|
|
import os
|
2008-10-12 22:43:14 -04:00
|
|
|
|
|
|
|
# Version of this package (even if built as a child)
|
|
|
|
EVORAL_VERSION = '0.0.0'
|
|
|
|
|
|
|
|
# Library version (UNIX style major, minor, micro)
|
|
|
|
# major increment <=> incompatible changes
|
|
|
|
# minor increment <=> compatible changes (additions)
|
|
|
|
# micro increment <=> no interface changes
|
|
|
|
# Version history:
|
|
|
|
# 0.0.0 = 0,0,0
|
|
|
|
EVORAL_LIB_VERSION = '0.0.0'
|
2008-09-30 11:34:54 -04:00
|
|
|
|
|
|
|
# Variables for 'waf dist'
|
|
|
|
APPNAME = 'evoral'
|
2008-10-12 22:43:14 -04:00
|
|
|
VERSION = EVORAL_VERSION
|
2008-09-30 11:34:54 -04:00
|
|
|
|
|
|
|
# Mandatory variables
|
|
|
|
srcdir = '.'
|
|
|
|
blddir = 'build'
|
|
|
|
|
|
|
|
def set_options(opt):
|
2008-10-12 22:43:14 -04:00
|
|
|
autowaf.set_options(opt)
|
2009-10-19 21:07:15 -04:00
|
|
|
opt.add_option('--test', action='store_true', default=False, dest='build_tests',
|
|
|
|
help="Build unit tests")
|
2008-09-30 11:34:54 -04:00
|
|
|
|
|
|
|
def configure(conf):
|
2008-10-12 22:43:14 -04:00
|
|
|
autowaf.configure(conf)
|
2009-07-22 16:51:13 -04:00
|
|
|
conf.check_tool('compiler_cxx')
|
2009-02-25 19:05:51 -05:00
|
|
|
autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
|
2009-02-25 18:21:49 -05:00
|
|
|
autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
|
|
|
|
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
|
|
|
|
autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.14.0')
|
2008-09-30 11:34:54 -04:00
|
|
|
|
2009-02-13 20:00:15 -05:00
|
|
|
# Boost headers
|
2009-02-25 18:21:49 -05:00
|
|
|
autowaf.check_header(conf, 'boost/shared_ptr.hpp')
|
|
|
|
autowaf.check_header(conf, 'boost/weak_ptr.hpp')
|
2009-10-19 21:07:15 -04:00
|
|
|
|
|
|
|
conf.env['BUILD_TESTS'] = Options.options.build_tests
|
|
|
|
|
|
|
|
autowaf.print_summary(conf)
|
|
|
|
autowaf.display_header('Evoral Configuration')
|
|
|
|
autowaf.display_msg(conf, "Unit tests", str(conf.env['BUILD_TESTS']))
|
|
|
|
print
|
2009-02-13 20:00:15 -05:00
|
|
|
|
2008-09-30 11:34:54 -04:00
|
|
|
def build(bld):
|
2008-10-12 22:43:14 -04:00
|
|
|
# Headers
|
2009-02-06 15:31:12 -05:00
|
|
|
#bld.install_files('${INCLUDEDIR}/evoral', 'evoral/*.h')
|
|
|
|
#bld.install_files('${INCLUDEDIR}/evoral', 'evoral/*.hpp')
|
2009-05-04 18:10:15 -04:00
|
|
|
|
2008-10-12 22:43:14 -04:00
|
|
|
# Pkgconfig file
|
|
|
|
#autowaf.build_pc(bld, 'EVORAL', EVORAL_VERSION, 'GLIBMM GTHREAD')
|
2009-05-04 18:10:15 -04:00
|
|
|
|
2009-02-11 12:38:40 -05:00
|
|
|
libsmf = bld.new_task_gen('cc', 'shlib')
|
|
|
|
libsmf.source = '''
|
|
|
|
src/libsmf/smf.c
|
|
|
|
src/libsmf/smf_decode.c
|
|
|
|
src/libsmf/smf_load.c
|
|
|
|
src/libsmf/smf_save.c
|
|
|
|
src/libsmf/smf_tempo.c
|
|
|
|
'''
|
|
|
|
libsmf.export_incdirs = ['./src/libsmf']
|
2009-04-18 12:15:12 -04:00
|
|
|
libsmf.defines = 'SMF_VERSION="1.2"'
|
2009-02-11 12:38:40 -05:00
|
|
|
libsmf.includes = ['./src']
|
|
|
|
libsmf.name = 'libsmf'
|
|
|
|
libsmf.target = 'smf'
|
|
|
|
libsmf.uselib = 'GLIB'
|
2009-02-26 23:40:44 -05:00
|
|
|
libsmf.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
|
2009-02-11 12:38:40 -05:00
|
|
|
|
2009-10-23 13:30:11 -04:00
|
|
|
lib_source = '''
|
2008-09-30 11:34:54 -04:00
|
|
|
src/Control.cpp
|
|
|
|
src/ControlList.cpp
|
|
|
|
src/ControlSet.cpp
|
|
|
|
src/Curve.cpp
|
|
|
|
src/Event.cpp
|
2009-08-26 23:09:30 -04:00
|
|
|
src/midi_util.cpp
|
2008-09-30 11:34:54 -04:00
|
|
|
src/MIDIEvent.cpp
|
|
|
|
src/Note.cpp
|
2009-02-14 12:35:34 -05:00
|
|
|
src/SMF.cpp
|
2008-09-30 11:34:54 -04:00
|
|
|
src/Sequence.cpp
|
2010-05-31 15:47:15 -04:00
|
|
|
src/debug.cpp
|
2008-09-30 11:34:54 -04:00
|
|
|
'''
|
2009-10-23 13:30:11 -04:00
|
|
|
|
|
|
|
# Library
|
|
|
|
obj = bld.new_task_gen('cxx', 'shlib')
|
|
|
|
obj.source = lib_source
|
2009-02-06 15:31:12 -05:00
|
|
|
obj.export_incdirs = ['.']
|
2009-10-23 13:30:11 -04:00
|
|
|
obj.includes = ['.', './src']
|
|
|
|
obj.name = 'libevoral'
|
|
|
|
obj.target = 'evoral'
|
|
|
|
obj.uselib = 'GLIBMM GTHREAD SMF'
|
2010-05-16 16:54:50 -04:00
|
|
|
obj.uselib_local = 'libsmf libpbd'
|
2009-10-23 13:30:11 -04:00
|
|
|
obj.vnum = EVORAL_LIB_VERSION
|
|
|
|
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
|
|
|
|
|
2009-10-19 21:07:15 -04:00
|
|
|
if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
|
2009-10-23 13:30:11 -04:00
|
|
|
# Static library (for unit test code coverage)
|
|
|
|
obj = bld.new_task_gen('cxx', 'staticlib')
|
|
|
|
obj.source = lib_source
|
|
|
|
obj.source = lib_source
|
|
|
|
obj.export_incdirs = ['.']
|
|
|
|
obj.includes = ['.', './src']
|
|
|
|
obj.name = 'libevoral_static'
|
|
|
|
obj.target = 'evoral_static'
|
|
|
|
obj.uselib = 'GLIBMM GTHREAD SMF'
|
2010-07-24 20:39:04 -04:00
|
|
|
obj.uselib_local = 'libsmf libpbd'
|
2009-10-23 13:30:11 -04:00
|
|
|
obj.vnum = EVORAL_LIB_VERSION
|
|
|
|
obj.install_path = ''
|
|
|
|
obj.ccflags = [ '-fprofile-arcs', '-ftest-coverage' ]
|
|
|
|
obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ]
|
|
|
|
|
|
|
|
# Unit tests
|
2009-02-25 14:08:26 -05:00
|
|
|
obj = bld.new_task_gen('cxx', 'program')
|
|
|
|
obj.source = '''
|
|
|
|
test/SequenceTest.cpp
|
|
|
|
test/SMFTest.cpp
|
|
|
|
test/testrunner.cpp
|
|
|
|
'''
|
|
|
|
obj.includes = ['.', './src']
|
2009-10-23 13:30:11 -04:00
|
|
|
obj.uselib_local = 'libevoral_static'
|
2010-07-24 20:39:04 -04:00
|
|
|
obj.uselib = 'CPPUNIT SNDFILE'
|
2009-10-23 13:30:11 -04:00
|
|
|
obj.libs = 'gcov'
|
2009-02-25 14:08:26 -05:00
|
|
|
obj.target = 'run-tests'
|
|
|
|
obj.install_path = ''
|
2009-10-23 13:30:11 -04:00
|
|
|
obj.ccflags = [ '-fprofile-arcs', '-ftest-coverage' ]
|
|
|
|
obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ]
|
2008-09-30 11:34:54 -04:00
|
|
|
|
2008-10-12 22:43:14 -04:00
|
|
|
def shutdown():
|
|
|
|
autowaf.shutdown()
|
|
|
|
|