2008-09-30 11:34:54 -04:00
|
|
|
#!/usr/bin/env python
|
2011-09-29 15:17:54 -04:00
|
|
|
from waflib.extras import autowaf as autowaf
|
2011-09-29 15:58:05 -04:00
|
|
|
from waflib 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
|
2011-09-29 15:17:54 -04:00
|
|
|
top = '.'
|
|
|
|
out = 'build'
|
2008-09-30 11:34:54 -04:00
|
|
|
|
2011-09-29 15:17:54 -04:00
|
|
|
def options(opt):
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.set_options(opt)
|
|
|
|
opt.add_option('--test', action='store_true', default=False, dest='build_tests',
|
|
|
|
help="Build unit tests")
|
2011-11-12 22:54:29 -05:00
|
|
|
opt.add_option('--test-coverage', action='store_true', default=False, dest='test_coverage',
|
|
|
|
help="Use gcov to test for code coverage")
|
2008-09-30 11:34:54 -04:00
|
|
|
|
|
|
|
def configure(conf):
|
2011-09-29 15:58:05 -04:00
|
|
|
conf.load('compiler_cxx')
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.configure(conf)
|
|
|
|
#autowaf.display_header('Evoral Configuration')
|
2009-02-13 20:00:15 -05:00
|
|
|
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
|
|
|
|
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')
|
|
|
|
|
|
|
|
# Boost headers
|
2011-09-29 15:17:54 -04:00
|
|
|
autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
|
|
|
|
autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
|
2011-04-22 18:15:21 -04:00
|
|
|
|
|
|
|
conf.env['BUILD_TESTS'] = Options.options.build_tests
|
2011-11-12 22:54:29 -05:00
|
|
|
conf.env['TEST_COVERAGE'] = Options.options.test_coverage
|
2011-03-16 12:32:56 -04:00
|
|
|
|
2011-04-22 18:15:21 -04:00
|
|
|
#autowaf.display_msg(conf, "Unit tests", str(conf.env['BUILD_TESTS']))
|
|
|
|
#print
|
|
|
|
|
|
|
|
def build(bld):
|
|
|
|
# Headers
|
|
|
|
#bld.install_files('${INCLUDEDIR}/evoral', 'evoral/*.h')
|
|
|
|
#bld.install_files('${INCLUDEDIR}/evoral', 'evoral/*.hpp')
|
|
|
|
|
|
|
|
# Pkgconfig file
|
|
|
|
#autowaf.build_pc(bld, 'EVORAL', EVORAL_VERSION, 'GLIBMM GTHREAD')
|
|
|
|
|
2014-01-12 11:33:16 -05:00
|
|
|
libsmf = bld(features = 'c cstlib')
|
2011-04-22 18:15:21 -04:00
|
|
|
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
|
|
|
|
'''
|
2011-09-29 15:17:54 -04:00
|
|
|
libsmf.export_includes = ['./src/libsmf']
|
2014-01-12 11:33:16 -05:00
|
|
|
libsmf.defines = ['SMF_VERSION="1.2"', 'LIBSMF_DLL_EXPORTS']
|
2011-04-22 18:15:21 -04:00
|
|
|
libsmf.includes = ['./src']
|
|
|
|
libsmf.name = 'libsmf'
|
|
|
|
libsmf.target = 'smf'
|
|
|
|
libsmf.uselib = 'GLIB'
|
2014-01-12 11:33:16 -05:00
|
|
|
libsmf.cxxflags = [ '-fPIC' ]
|
|
|
|
libsmf.cflags = [ '-fPIC' ]
|
2014-04-28 21:18:02 -04:00
|
|
|
libsmf.install_path = bld.env['LIBDIR']
|
2011-04-22 18:15:21 -04:00
|
|
|
|
|
|
|
lib_source = '''
|
|
|
|
src/Control.cpp
|
|
|
|
src/ControlList.cpp
|
|
|
|
src/ControlSet.cpp
|
|
|
|
src/Curve.cpp
|
|
|
|
src/Event.cpp
|
2014-01-12 20:00:55 -05:00
|
|
|
src/IdentityConverter.cpp
|
2011-04-22 18:15:21 -04:00
|
|
|
src/midi_util.cpp
|
|
|
|
src/MIDIEvent.cpp
|
|
|
|
src/Note.cpp
|
|
|
|
src/SMF.cpp
|
|
|
|
src/Sequence.cpp
|
|
|
|
src/debug.cpp
|
2014-11-22 15:26:41 -05:00
|
|
|
src/types.cpp
|
2011-04-22 18:15:21 -04:00
|
|
|
'''
|
|
|
|
|
|
|
|
# Library
|
2013-10-17 10:52:02 -04:00
|
|
|
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
|
|
|
|
obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=lib_source)
|
2013-10-17 15:02:20 -04:00
|
|
|
# DLL exports for this library
|
2014-01-12 11:33:16 -05:00
|
|
|
obj.defines = [ 'LIBEVORAL_DLL_EXPORTS' ]
|
2013-10-17 10:52:02 -04:00
|
|
|
else:
|
|
|
|
obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=lib_source)
|
|
|
|
obj.cxxflags = [ '-fPIC' ]
|
|
|
|
obj.cflags = [ '-fPIC' ]
|
2013-10-17 11:26:01 -04:00
|
|
|
obj.defines = [ ]
|
2013-10-17 10:52:02 -04:00
|
|
|
|
2011-09-29 15:17:54 -04:00
|
|
|
obj.export_includes = ['.']
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.includes = ['.', './src']
|
|
|
|
obj.name = 'libevoral'
|
|
|
|
obj.target = 'evoral'
|
|
|
|
obj.uselib = 'GLIBMM GTHREAD SMF'
|
2011-09-29 15:17:54 -04:00
|
|
|
obj.use = 'libsmf libpbd'
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.vnum = EVORAL_LIB_VERSION
|
2014-04-28 21:11:08 -04:00
|
|
|
obj.install_path = bld.env['LIBDIR']
|
2013-10-17 11:26:01 -04:00
|
|
|
obj.defines += [ 'PACKAGE="libevoral"', 'EVORAL_MIDI_XML=1' ]
|
2011-04-22 18:15:21 -04:00
|
|
|
|
2011-11-12 22:54:29 -05:00
|
|
|
if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
|
2011-04-22 18:15:21 -04:00
|
|
|
# Static library (for unit test code coverage)
|
2011-09-29 15:17:54 -04:00
|
|
|
obj = bld(features = 'cxx cstlib')
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.source = lib_source
|
2011-03-16 12:32:56 -04:00
|
|
|
obj.source = lib_source
|
2011-09-29 15:17:54 -04:00
|
|
|
obj.export_includes = ['.']
|
2011-03-16 12:32:56 -04:00
|
|
|
obj.includes = ['.', './src']
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.name = 'libevoral_static'
|
|
|
|
obj.target = 'evoral_static'
|
2011-03-16 12:32:56 -04:00
|
|
|
obj.uselib = 'GLIBMM GTHREAD SMF'
|
2011-09-29 15:17:54 -04:00
|
|
|
obj.use = 'libsmf libpbd'
|
2011-03-16 12:32:56 -04:00
|
|
|
obj.vnum = EVORAL_LIB_VERSION
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.install_path = ''
|
2011-11-12 22:54:29 -05:00
|
|
|
if bld.env['TEST_COVERAGE']:
|
|
|
|
obj.linkflags = '-lgcov'
|
|
|
|
obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ]
|
|
|
|
obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ]
|
2012-10-10 00:31:59 -04:00
|
|
|
obj.defines = ['PACKAGE="libevoral"', 'EVORAL_MIDI_XML=1' ]
|
2011-04-22 18:15:21 -04:00
|
|
|
|
|
|
|
# Unit tests
|
2011-09-29 15:17:54 -04:00
|
|
|
obj = bld(features = 'cxx cxxprogram')
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.source = '''
|
|
|
|
test/SequenceTest.cpp
|
|
|
|
test/SMFTest.cpp
|
2012-04-16 12:32:22 -04:00
|
|
|
test/RangeTest.cpp
|
2011-04-22 18:15:21 -04:00
|
|
|
test/testrunner.cpp
|
|
|
|
'''
|
|
|
|
obj.includes = ['.', './src']
|
2011-09-29 15:17:54 -04:00
|
|
|
obj.use = 'libevoral_static'
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.uselib = 'CPPUNIT SNDFILE'
|
|
|
|
obj.target = 'run-tests'
|
|
|
|
obj.name = 'libevoral-tests'
|
|
|
|
obj.install_path = ''
|
2011-11-12 22:54:29 -05:00
|
|
|
if bld.env['TEST_COVERAGE']:
|
|
|
|
obj.linkflags = '-lgcov'
|
|
|
|
obj.cflags = [ '-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():
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.shutdown()
|