+from __future__ import print_function
+
import subprocess
+import shlex
import os
import sys
import distutils.spawn
from waflib import Logs
APPNAME = 'libasdcp-cth'
-VERSION = '0.0.1devel'
+
+if os.path.exists('.git'):
+ this_version = subprocess.Popen(shlex.split('git tag -l --points-at HEAD'), stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
+ last_version = subprocess.Popen(shlex.split('git describe --tags --abbrev=0'), stdout=subprocess.PIPE).communicate()[0]
+ if this_version == '':
+ VERSION = '%sdevel' % last_version[1:].strip()
+ else:
+ VERSION = this_version[1:].strip()
+else:
+ VERSION = open('VERSION').read().strip()
def options(opt):
opt.load('compiler_cxx')
conf.env.TARGET_WINDOWS = conf.options.target_windows
conf.env.TARGET_OSX = sys.platform == 'darwin'
+ conf.env.TARGET_LINUX = not conf.env.TARGET_WINDOWS and not conf.env.TARGET_OSX
conf.env.STATIC = conf.options.static
conf.env.VERSION = VERSION
if conf.env.TARGET_OSX:
conf.env.append_value('CXXFLAGS', ['-Wno-unused-result', '-Wno-unused-parameter', '-Wno-unused-local-typedef'])
+ if conf.env.TARGET_LINUX:
+ gcc = conf.env['CC_VERSION']
+ if int(gcc[0]) >= 4 and int(gcc[1]) > 1:
+ conf.env.append_value('CXXFLAGS', ['-Wno-unused-result'])
+
conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL', mandatory=True)
if conf.options.target_windows:
lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
uselib_store='BOOST_FILESYSTEM')
+ conf.check(header_name='valgrind/memcheck.h', mandatory=False)
+
conf.recurse('src')
def build(bld):
def tags(bld):
os.system('etags src/*.cc src/*.h')
+
+def dist(bld):
+ f = open('VERSION', 'w')
+ print(VERSION, file=f)
+ f.close()