summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-01-14 22:31:50 +0000
committerCarl Hetherington <cth@carlh.net>2019-12-03 16:45:01 +0100
commitbd785a75e61e22aec48cb4ff97696a87afb7bce1 (patch)
tree7c2bf4f93b713789f720aa8c1d12f7fc212c9a65 /wscript
parentf2ad6d58402e7cf5ae28011a2135a02b19215c58 (diff)
waf build system.
Diffstat (limited to 'wscript')
-rw-r--r--wscript80
1 files changed, 80 insertions, 0 deletions
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..30cb06c
--- /dev/null
+++ b/wscript
@@ -0,0 +1,80 @@
+import subprocess
+import os
+import sys
+import distutils.spawn
+from waflib import Logs
+
+APPNAME = 'asdcplib-cth'
+VERSION = '2.5.11-cth1'
+
+def options(opt):
+ opt.load('compiler_cxx')
+ opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to Windows')
+ opt.add_option('--static', action='store_true', default=False, help='build statically')
+
+def configure(conf):
+ conf.load('compiler_cxx')
+ conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS'])
+
+ conf.env.TARGET_WINDOWS = conf.options.target_windows
+ conf.env.TARGET_OSX = sys.platform == 'darwin'
+ 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'])
+
+ conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL', mandatory=True)
+
+ if conf.options.target_windows:
+ boost_lib_suffix = '-mt'
+ else:
+ boost_lib_suffix = ''
+
+ conf.env.append_value('CXXFLAGS', '-O2')
+
+ conf.check_cxx(fragment="""
+ #include <boost/version.hpp>\n
+ #if BOOST_VERSION < 104500\n
+ #error boost too old\n
+ #endif\n
+ int main(void) { return 0; }\n
+ """,
+ mandatory=True,
+ msg='Checking for boost library >= 1.45',
+ okmsg='yes',
+ errmsg='too old\nPlease install boost version 1.45 or higher.')
+
+ conf.check_cxx(fragment="""
+ #include <boost/filesystem.hpp>\n
+ int main() { boost::filesystem::copy_file ("a", "b"); }\n
+ """,
+ msg='Checking for boost filesystem library',
+ libpath='/usr/local/lib',
+ lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
+ uselib_store='BOOST_FILESYSTEM')
+
+ conf.recurse('src')
+
+def build(bld):
+ if bld.env.TARGET_WINDOWS:
+ boost_lib_suffix = '-mt'
+ else:
+ boost_lib_suffix = ''
+
+ bld(source='asdcplib-cth.pc.in',
+ version=VERSION,
+ includedir='%s/include/asdcplib-cth' % bld.env.PREFIX,
+ libs="-L${libdir} -lasdcplib-cth -lkumu-cth -lboost_system%s" % boost_lib_suffix,
+ install_path='${LIBDIR}/pkgconfig')
+
+ bld.recurse('src')
+
+ bld.add_post_fun(post)
+
+def post(ctx):
+ if ctx.cmd == 'install':
+ ctx.exec_command('/sbin/ldconfig')
+
+def tags(bld):
+ os.system('etags src/*.cc src/*.h')