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 | a43601f | 2014-05-09 14:29:16 -0700 | [diff] [blame] | 9 | |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 10 | def configure(conf): |
| 11 | conf.load("compiler_c compiler_cxx") |
| 12 | |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 13 | conf.add_supported_cxxflags (cxxflags = ['-O3', '-g']) |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 14 | |
| 15 | conf.load('protoc') |
| 16 | |
| 17 | conf.load('qt4') |
| 18 | |
| 19 | conf.load('boost') |
| 20 | |
Yingdi Yu | 4390ce5 | 2013-10-10 17:27:54 -0700 | [diff] [blame] | 21 | conf.check_cfg(package='libndn.cxx', args=['--cflags', '--libs'], uselib_store='NDNCXX', mandatory=True) |
| 22 | conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True) |
| 23 | |
Alexander Afanasyev | df7e569 | 2013-07-15 12:43:12 -0700 | [diff] [blame] | 24 | conf.check_boost(lib='system random thread') |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 25 | |
| 26 | conf.write_config_header('config.h') |
| 27 | |
| 28 | |
| 29 | def build (bld): |
| 30 | qt = bld ( |
Yingdi Yu | 40eca75 | 2013-10-10 15:00:58 -0700 | [diff] [blame] | 31 | target = "Contacts", |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 32 | features = "qt4 cxx cxxprogram", |
| 33 | defines = "WAF", |
| 34 | source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui']), |
| 35 | includes = ".", |
Yingdi Yu | 4390ce5 | 2013-10-10 17:27:54 -0700 | [diff] [blame] | 36 | use = "QTCORE QTGUI SQLITE3 NDNCXX", |
Yingdi Yu | 847aa86 | 2013-10-09 16:35:53 -0700 | [diff] [blame] | 37 | ) |
| 38 | |
| 39 | |
| 40 | @Configure.conf |
| 41 | def add_supported_cxxflags(self, cxxflags): |
| 42 | """ |
| 43 | Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable |
| 44 | """ |
| 45 | self.start_msg('Checking allowed flags for c++ compiler') |
| 46 | |
| 47 | supportedFlags = [] |
| 48 | for flag in cxxflags: |
| 49 | if self.check_cxx (cxxflags=[flag], mandatory=False): |
| 50 | supportedFlags += [flag] |
| 51 | |
| 52 | self.end_msg (' '.join (supportedFlags)) |
| 53 | self.env.CXXFLAGS += supportedFlags |
| 54 | |
| 55 | from waflib.TaskGen import feature, before_method, after_method |
| 56 | @feature('cxx') |
| 57 | @after_method('process_source') |
| 58 | @before_method('apply_incpaths') |
| 59 | def add_includes_paths(self): |
| 60 | incs = set(self.to_list(getattr(self, 'includes', ''))) |
| 61 | for x in self.compiled_tasks: |
| 62 | incs.add(x.inputs[0].parent.path_from(self.path)) |
| 63 | self.includes = list(incs) |