13
0
livetrax/libs/evoral/wscript
Robin Gareus ba78359129 prepare for update to waf 1.8
uselib is no longer implicit (inherited by .use). This is still incomplete,
some uselibs for non-linux variants may be missing.

bld.is_defined("HAVE_XXX") also no longer works and will have to be
changed (I think to bld.env["HAVE_XXX"]) in countless places.
2016-02-28 21:16:44 +01:00

158 lines
5.5 KiB
Python

#!/usr/bin/env python
from waflib.extras import autowaf as autowaf
from waflib import Options
import os
# 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'
# Variables for 'waf dist'
APPNAME = 'evoral'
VERSION = EVORAL_VERSION
# Mandatory variables
top = '.'
out = 'build'
def options(opt):
autowaf.set_options(opt)
opt.add_option('--test', action='store_true', default=False, dest='build_tests',
help="Build unit tests")
opt.add_option('--test-coverage', action='store_true', default=False, dest='test_coverage',
help="Use gcov to test for code coverage")
def configure(conf):
conf.load('compiler_cxx')
autowaf.configure(conf)
#autowaf.display_header('Evoral Configuration')
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
autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
conf.env['BUILD_TESTS'] = Options.options.build_tests
conf.env['TEST_COVERAGE'] = Options.options.test_coverage
#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')
libsmf = bld(features = 'c cstlib')
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_includes = ['./src/libsmf']
libsmf.defines = ['SMF_VERSION="1.2"', 'LIBSMF_DLL_EXPORTS']
libsmf.includes = ['./src']
libsmf.name = 'libsmf'
libsmf.target = 'smf'
libsmf.uselib = 'GLIB'
libsmf.install_path = None
if bld.env['build_target'] != 'mingw':
libsmf.cxxflags = [ '-fPIC' ]
libsmf.cflags = [ '-fPIC' ]
lib_source = '''
src/Control.cpp
src/ControlList.cpp
src/ControlSet.cpp
src/Curve.cpp
src/Event.cpp
src/midi_util.cpp
src/MIDIEvent.cpp
src/Note.cpp
src/SMF.cpp
src/Sequence.cpp
src/TimeConverter.cpp
src/debug.cpp
src/types.cpp
'''
# Library
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=lib_source)
# DLL exports for this library
obj.defines = [ 'LIBEVORAL_DLL_EXPORTS' ]
else:
obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=lib_source)
obj.cxxflags = [ '-fPIC' ]
obj.cflags = [ '-fPIC' ]
obj.defines = [ ]
obj.export_includes = ['.']
obj.includes = ['.', './src']
obj.name = 'libevoral'
obj.target = 'evoral'
obj.uselib = 'GLIBMM GTHREAD SMF XML'
obj.use = 'libsmf libpbd'
obj.vnum = EVORAL_LIB_VERSION
obj.install_path = bld.env['LIBDIR']
obj.defines += [ 'PACKAGE="libevoral"', 'EVORAL_MIDI_XML=1' ]
if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
# Static library (for unit test code coverage)
obj = bld(features = 'cxx cstlib')
obj.source = lib_source
obj.source = lib_source
obj.export_includes = ['.']
obj.includes = ['.', './src']
obj.name = 'libevoral_static'
obj.target = 'evoral_static'
obj.uselib = 'GLIBMM GTHREAD SMF XML'
obj.use = 'libsmf libpbd'
obj.vnum = EVORAL_LIB_VERSION
obj.install_path = ''
if bld.env['TEST_COVERAGE']:
obj.linkflags = '-lgcov'
obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ]
obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ]
obj.defines = ['PACKAGE="libevoral"', 'EVORAL_MIDI_XML=1' ]
# Unit tests
obj = bld(features = 'cxx cxxprogram')
obj.source = '''
test/SequenceTest.cpp
test/SMFTest.cpp
test/RangeTest.cpp
test/CurveTest.cpp
test/testrunner.cpp
'''
obj.includes = ['.', './src']
obj.use = 'libevoral_static'
obj.uselib = 'CPPUNIT SNDFILE'
obj.target = 'run-tests'
obj.name = 'libevoral-tests'
obj.install_path = ''
obj.defines = ['PACKAGE="libevoraltest"']
if bld.env['TEST_COVERAGE']:
obj.linkflags = '-lgcov'
obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ]
obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ]
def shutdown():
autowaf.shutdown()