blob: 878688b89c0c0090f493e8b93aed8dbb6e385450 [file] [log] [blame]
Alexander Afanasyevb4b92292013-07-09 13:54:59 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Yingdi Yua43601f2014-05-09 14:29:16 -07002VERSION='0.1'
3APPNAME='QT-Test'
Alexander Afanasyevb4b92292013-07-09 13:54:59 -07004
Yingdi Yu847aa862013-10-09 16:35:53 -07005from waflib import Configure
6
Alexander Afanasyevb4b92292013-07-09 13:54:59 -07007def options(opt):
Alexander Afanasyevb4b92292013-07-09 13:54:59 -07008 opt.load('compiler_c compiler_cxx boost protoc qt4')
Yingdi Yua43601f2014-05-09 14:29:16 -07009
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070010def configure(conf):
11 conf.load("compiler_c compiler_cxx")
12
Yingdi Yu847aa862013-10-09 16:35:53 -070013 conf.add_supported_cxxflags (cxxflags = ['-O3', '-g'])
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070014
15 conf.load('protoc')
16
17 conf.load('qt4')
18
19 conf.load('boost')
20
Alexander Afanasyevdf7e5692013-07-15 12:43:12 -070021 conf.check_boost(lib='system random thread')
Yingdi Yu847aa862013-10-09 16:35:53 -070022
23 conf.write_config_header('config.h')
24
25
26def build (bld):
27 qt = bld (
Yingdi Yu40eca752013-10-10 15:00:58 -070028 target = "Contacts",
Yingdi Yu847aa862013-10-09 16:35:53 -070029 features = "qt4 cxx cxxprogram",
30 defines = "WAF",
31 source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui']),
32 includes = ".",
33 use = "QTCORE QTGUI",
34 )
35
36
37@Configure.conf
38def 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
51
52from waflib.TaskGen import feature, before_method, after_method
53@feature('cxx')
54@after_method('process_source')
55@before_method('apply_incpaths')
56def add_includes_paths(self):
57 incs = set(self.to_list(getattr(self, 'includes', '')))
58 for x in self.compiled_tasks:
59 incs.add(x.inputs[0].parent.path_from(self.path))
60 self.includes = list(incs)