Bump waf to 2.0.27.
[libdcp.git] / wscript
diff --git a/wscript b/wscript
index e26ad84e3a349a41e5f17aa205f744297c82cfe7..dab35558e890629382b8550681e900204344a5de 100644 (file)
--- a/wscript
+++ b/wscript
 import subprocess
 import os
 import sys
+import shlex
 import distutils.spawn
 from waflib import Logs, Context
 
 APPNAME = 'libdcp'
-VERSION = '1.5.0'
+
+this_version = subprocess.Popen(shlex.split('git tag -l --points-at HEAD'), stdout=subprocess.PIPE).communicate()[0]
+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()
+
 API_VERSION = '-1.0'
 
 def options(opt):
@@ -55,6 +64,7 @@ def options(opt):
 
 def configure(conf):
     conf.load('compiler_cxx')
+    conf.load('clang_compilation_database', tooldir=['waf-tools'])
     conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS'])
     if conf.options.force_cpp11:
         conf.env.append_value('CXXFLAGS', ['-std=c++11', '-DBOOST_NO_CXX11_SCOPED_ENUMS'])
@@ -70,6 +80,7 @@ def configure(conf):
     conf.env.DISABLE_EXAMPLES = conf.options.disable_examples
     conf.env.STATIC = conf.options.static
     conf.env.API_VERSION = API_VERSION
+    conf.env.JPEG = conf.options.jpeg
 
     if conf.options.target_windows:
         conf.env.append_value('CXXFLAGS', '-DLIBDCP_WINDOWS')
@@ -132,7 +143,7 @@ def configure(conf):
         elif conf.options.jpeg == 'oj1':
             conf.check_cfg(package='libopenjpeg1', args='--cflags --libs', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
         conf.check_cfg(package='libasdcp-cth', atleast_version='0.1.3', args='--cflags --libs', uselib_store='ASDCPLIB_CTH', mandatory=True)
-        conf.check_cfg(package='libcxml', atleast_version='0.15.2', args='--cflags --libs', uselib_store='CXML', mandatory=True)
+        conf.check_cfg(package='libcxml', atleast_version='0.16.0', args='--cflags --libs', uselib_store='CXML', mandatory=True)
 
     if conf.options.target_windows:
         boost_lib_suffix = '-mt'
@@ -187,6 +198,7 @@ def configure(conf):
         conf.recurse('test')
         if not conf.options.disable_gcov:
             conf.check(lib='gcov', define_name='HAVE_GCOV', mandatory=False)
+            conf.env.append_value('LINKFLAGS', '-fprofile-arcs')
 
 def build(bld):
     create_version_cc(bld, VERSION)
@@ -200,7 +212,8 @@ def build(bld):
         version=VERSION,
         includedir='%s/include/libdcp%s' % (bld.env.PREFIX, bld.env.API_VERSION),
         libs="-L${libdir} -ldcp%s -lcxml -lboost_system%s" % (bld.env.API_VERSION, boost_lib_suffix),
-        install_path='${LIBDIR}/pkgconfig')
+        install_path='${LIBDIR}/pkgconfig',
+        openjpeg='libopenjpeg1' if bld.env.JPEG == 'oj1' else 'libopenjp2')
 
     bld.recurse('src')
     bld.recurse('tools')