blob: 8834f502953fa332fa3c1fe2fc9c36c1c24eed7b [file] [log] [blame]
Yingdi Yu767d2ac2013-10-09 15:16:11 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2VERSION='0.1'
3APPNAME='QT-Test'
4
Yingdi Yu614db142013-10-09 16:35:53 -07005from waflib import Configure
6
Yingdi Yu767d2ac2013-10-09 15:16:11 -07007def options(opt):
8 opt.load('compiler_c compiler_cxx boost protoc qt4')
Yingdi Yuede8eaf2013-10-14 14:07:03 -07009
10 opt.load('tinyxml', tooldir=['waf-tools'])
Yingdi Yu767d2ac2013-10-09 15:16:11 -070011
12def configure(conf):
Yingdi Yuede8eaf2013-10-14 14:07:03 -070013 conf.load("compiler_c compiler_cxx boost protoc qt4 tinyxml")
Yingdi Yu767d2ac2013-10-09 15:16:11 -070014
Yingdi Yu614db142013-10-09 16:35:53 -070015 conf.add_supported_cxxflags (cxxflags = ['-O3', '-g'])
Yingdi Yu767d2ac2013-10-09 15:16:11 -070016
Yingdi Yuede8eaf2013-10-14 14:07:03 -070017 conf.check_tinyxml(path=conf.options.tinyxml_dir)
Yingdi Yuad56f1c2013-10-10 17:27:54 -070018 conf.check_cfg(package='libndn.cxx', args=['--cflags', '--libs'], uselib_store='NDNCXX', mandatory=True)
19 conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True)
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070020 conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True)
21 conf.define ("HAVE_LOG4CXX", 1)
Yingdi Yuad56f1c2013-10-10 17:27:54 -070022
Yingdi Yuede8eaf2013-10-14 14:07:03 -070023 conf.check_boost(lib='system random thread filesystem')
Yingdi Yu614db142013-10-09 16:35:53 -070024
25 conf.write_config_header('config.h')
26
27
28def build (bld):
29 qt = bld (
Yingdi Yu01a942b2013-10-10 15:00:58 -070030 target = "Contacts",
Yingdi Yu614db142013-10-09 16:35:53 -070031 features = "qt4 cxx cxxprogram",
32 defines = "WAF",
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070033 source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui', 'logging.cc']),
Yingdi Yu614db142013-10-09 16:35:53 -070034 includes = ".",
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070035 use = "QTCORE QTGUI QTSQL SQLITE3 NDNCXX TINYXML BOOST BOOST_FILESYSTEM LOG4CXX",
Yingdi Yu68aced92013-10-17 21:13:03 -070036 )
37
38 cert_publish = bld (
39 target = "CertPublish",
40 features = "cxx cxxprogram",
41 defines = "WAF",
42 source = bld.path.ant_glob(['tmp/cert-publish.cpp']),
43 includes = ".",
44 use = "SQLITE3 NDNCXX BOOST BOOST_FILESYSTEM LOG4CXX",
45 )
Yingdi Yu614db142013-10-09 16:35:53 -070046
47
48@Configure.conf
49def add_supported_cxxflags(self, cxxflags):
50 """
51 Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
52 """
53 self.start_msg('Checking allowed flags for c++ compiler')
54
55 supportedFlags = []
56 for flag in cxxflags:
57 if self.check_cxx (cxxflags=[flag], mandatory=False):
58 supportedFlags += [flag]
59
60 self.end_msg (' '.join (supportedFlags))
61 self.env.CXXFLAGS += supportedFlags
Yingdi Yuffb32632013-10-09 18:11:41 -070062
63from waflib.TaskGen import feature, before_method, after_method
64@feature('cxx')
65@after_method('process_source')
66@before_method('apply_incpaths')
67def add_includes_paths(self):
68 incs = set(self.to_list(getattr(self, 'includes', '')))
69 for x in self.compiled_tasks:
70 incs.add(x.inputs[0].parent.path_from(self.path))
71 self.includes = list(incs)