summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-01-13 12:41:59 +0000
committerCarl Hetherington <cth@carlh.net>2013-01-13 12:41:59 +0000
commit67dc9215dc549b2402f1c8bbd744c172da248c7a (patch)
tree51a831e4fee70bff0bfe2b808ae167c547c46831
parentf97ca538bca0af77b44b1072592708eeeff3ba2a (diff)
Make variable to say whether we were built with debug or not.
-rw-r--r--src/version.h1
-rw-r--r--wscript10
2 files changed, 9 insertions, 2 deletions
diff --git a/src/version.h b/src/version.h
index 7fd9dc25..52abd13a 100644
--- a/src/version.h
+++ b/src/version.h
@@ -3,5 +3,6 @@ namespace libdcp {
extern char const * version;
extern char const * git_commit;
+extern bool built_with_debug;
}
diff --git a/wscript b/wscript
index 06facf26..7412271e 100644
--- a/wscript
+++ b/wscript
@@ -20,6 +20,7 @@ def configure(conf):
conf.env.TARGET_WINDOWS = conf.options.target_windows
conf.env.STATIC_OPENJPEG = conf.options.static_openjpeg
conf.env.STATIC_LIBDCP = conf.options.static_libdcp
+ conf.env.ENABLE_DEBUG = conf.options.enable_debug
if conf.options.target_windows:
conf.env.append_value('CXXFLAGS', '-DLIBDCP_WINDOWS')
@@ -76,7 +77,7 @@ def configure(conf):
conf.recurse('asdcplib')
def build(bld):
- create_version_cc(VERSION)
+ create_version_cc(bld, VERSION)
if bld.env.TARGET_WINDOWS:
boost_lib_suffix = '-mt'
@@ -100,7 +101,7 @@ def build(bld):
def dist(ctx):
ctx.excl = 'TODO core *~ .git build .waf* .lock* doc/*~ src/*~ test/ref/*~ __pycache__'
-def create_version_cc(version):
+def create_version_cc(bld, version):
if os.path.exists('.git'):
cmd = "LANG= git log --abbrev HEAD^..HEAD ."
output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
@@ -113,6 +114,11 @@ def create_version_cc(version):
text = '#include "version.h"\n'
text += 'char const * libdcp::git_commit = \"%s\";\n' % commit
text += 'char const * libdcp::version = \"%s\";\n' % version
+ if bld.env.ENABLE_DEBUG:
+ debug_string = 'true'
+ else:
+ debug_string = 'false'
+ text += 'bool const built_with_debug = %s;\n' % debug_string
print('Writing version information to src/version.cc')
o = open('src/version.cc', 'w')
o.write(text)