Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Yingdi Yu | a43601f | 2014-05-09 14:29:16 -0700 | [diff] [blame] | 2 | VERSION='0.1' |
| 3 | APPNAME='QT-Test' |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 4 | |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 5 | from waflib import Configure |
| 6 | |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 7 | def options(opt): |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 8 | opt.load('compiler_c compiler_cxx boost protoc qt4') |
Yingdi Yu | d04ed1a | 2013-10-14 14:07:03 -0700 | [diff] [blame] | 9 | |
| 10 | opt.load('tinyxml', tooldir=['waf-tools']) |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame^] | 11 | opt.load('cryptopp', tooldir=['waf-tools']) |
Yingdi Yu | a43601f | 2014-05-09 14:29:16 -0700 | [diff] [blame] | 12 | |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 13 | def configure(conf): |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame^] | 14 | conf.load("compiler_c compiler_cxx boost protoc qt4 tinyxml cryptopp") |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 15 | |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame^] | 16 | conf.add_supported_cxxflags (cxxflags = ['-O0', '-g']) |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 17 | |
Yingdi Yu | d04ed1a | 2013-10-14 14:07:03 -0700 | [diff] [blame] | 18 | conf.check_tinyxml(path=conf.options.tinyxml_dir) |
Yingdi Yu | 4390ce5 | 2013-10-10 17:27:54 -0700 | [diff] [blame] | 19 | conf.check_cfg(package='libndn.cxx', args=['--cflags', '--libs'], uselib_store='NDNCXX', mandatory=True) |
| 20 | conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True) |
Yingdi Yu | 3b318c1 | 2013-10-15 17:54:00 -0700 | [diff] [blame] | 21 | conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True) |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame^] | 22 | conf.check_cfg (package='ChronoSync', args=['ChronoSync >= 0.1', '--cflags', '--libs'], uselib_store='SYNC', mandatory=True) |
Yingdi Yu | 3b318c1 | 2013-10-15 17:54:00 -0700 | [diff] [blame] | 23 | conf.define ("HAVE_LOG4CXX", 1) |
Yingdi Yu | 4390ce5 | 2013-10-10 17:27:54 -0700 | [diff] [blame] | 24 | |
Yingdi Yu | d04ed1a | 2013-10-14 14:07:03 -0700 | [diff] [blame] | 25 | conf.check_boost(lib='system random thread filesystem') |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 26 | |
| 27 | conf.write_config_header('config.h') |
| 28 | |
| 29 | |
| 30 | def build (bld): |
| 31 | qt = bld ( |
Yingdi Yu | 40eca75 | 2013-10-10 15:00:58 -0700 | [diff] [blame] | 32 | target = "Contacts", |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 33 | features = "qt4 cxx cxxprogram", |
| 34 | defines = "WAF", |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame^] | 35 | source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui', 'logging.cc', 'src/*.proto']), |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 36 | includes = ".", |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame^] | 37 | use = "QTCORE QTGUI QTSQL SQLITE3 NDNCXX TINYXML BOOST BOOST_FILESYSTEM LOG4CXX CRYPTOPP SYNC", |
Yingdi Yu | 92e8e48 | 2013-10-17 21:13:03 -0700 | [diff] [blame] | 38 | ) |
| 39 | |
| 40 | cert_publish = bld ( |
| 41 | target = "CertPublish", |
| 42 | features = "cxx cxxprogram", |
| 43 | defines = "WAF", |
| 44 | source = bld.path.ant_glob(['tmp/cert-publish.cpp']), |
| 45 | includes = ".", |
| 46 | use = "SQLITE3 NDNCXX BOOST BOOST_FILESYSTEM LOG4CXX", |
| 47 | ) |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 48 | |
| 49 | |
| 50 | @Configure.conf |
| 51 | def add_supported_cxxflags(self, cxxflags): |
| 52 | """ |
| 53 | Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable |
| 54 | """ |
| 55 | self.start_msg('Checking allowed flags for c++ compiler') |
| 56 | |
| 57 | supportedFlags = [] |
| 58 | for flag in cxxflags: |
| 59 | if self.check_cxx (cxxflags=[flag], mandatory=False): |
| 60 | supportedFlags += [flag] |
| 61 | |
| 62 | self.end_msg (' '.join (supportedFlags)) |
| 63 | self.env.CXXFLAGS += supportedFlags |
| 64 | |
| 65 | from waflib.TaskGen import feature, before_method, after_method |
| 66 | @feature('cxx') |
| 67 | @after_method('process_source') |
| 68 | @before_method('apply_incpaths') |
| 69 | def add_includes_paths(self): |
| 70 | incs = set(self.to_list(getattr(self, 'includes', ''))) |
| 71 | for x in self.compiled_tasks: |
| 72 | incs.add(x.inputs[0].parent.path_from(self.path)) |
| 73 | self.includes = list(incs) |