Yingdi Yu | 767d2ac | 2013-10-09 15:16:11 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | VERSION='0.1' |
| 3 | APPNAME='QT-Test' |
| 4 | |
Yingdi Yu | 614db14 | 2013-10-09 16:35:53 -0700 | [diff] [blame^] | 5 | from waflib import Configure |
| 6 | |
Yingdi Yu | 767d2ac | 2013-10-09 15:16:11 -0700 | [diff] [blame] | 7 | def options(opt): |
| 8 | opt.load('compiler_c compiler_cxx boost protoc qt4') |
| 9 | |
| 10 | def configure(conf): |
| 11 | conf.load("compiler_c compiler_cxx") |
| 12 | |
Yingdi Yu | 614db14 | 2013-10-09 16:35:53 -0700 | [diff] [blame^] | 13 | conf.add_supported_cxxflags (cxxflags = ['-O3', '-g']) |
Yingdi Yu | 767d2ac | 2013-10-09 15:16:11 -0700 | [diff] [blame] | 14 | |
| 15 | conf.load('protoc') |
| 16 | |
| 17 | conf.load('qt4') |
| 18 | |
| 19 | conf.load('boost') |
| 20 | |
Yingdi Yu | 614db14 | 2013-10-09 16:35:53 -0700 | [diff] [blame^] | 21 | conf.check_boost(lib='system random thread') |
| 22 | |
| 23 | conf.write_config_header('config.h') |
| 24 | |
| 25 | |
| 26 | def build (bld): |
| 27 | qt = bld ( |
| 28 | target = "ChronoChat", |
| 29 | features = "qt4 cxx cxxprogram", |
| 30 | defines = "WAF", |
| 31 | source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui']), |
| 32 | includes = ".", |
| 33 | use = "BOOST BOOST_THREAD QTCORE QTGUI", |
| 34 | ) |
| 35 | |
| 36 | |
| 37 | @Configure.conf |
| 38 | def add_supported_cxxflags(self, cxxflags): |
| 39 | """ |
| 40 | Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable |
| 41 | """ |
| 42 | self.start_msg('Checking allowed flags for c++ compiler') |
| 43 | |
| 44 | supportedFlags = [] |
| 45 | for flag in cxxflags: |
| 46 | if self.check_cxx (cxxflags=[flag], mandatory=False): |
| 47 | supportedFlags += [flag] |
| 48 | |
| 49 | self.end_msg (' '.join (supportedFlags)) |
| 50 | self.env.CXXFLAGS += supportedFlags |