blob: 34a2c499942ee58ca17a0bf8879e95f4db6681b6 [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 Yud04ed1a2013-10-14 14:07:03 -07009
10 opt.load('tinyxml', tooldir=['waf-tools'])
Yingdi Yua43601f2014-05-09 14:29:16 -070011
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070012def configure(conf):
Yingdi Yud04ed1a2013-10-14 14:07:03 -070013 conf.load("compiler_c compiler_cxx boost protoc qt4 tinyxml")
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070014
Yingdi Yu847aa862013-10-09 16:35:53 -070015 conf.add_supported_cxxflags (cxxflags = ['-O3', '-g'])
Alexander Afanasyevb4b92292013-07-09 13:54:59 -070016
Yingdi Yud04ed1a2013-10-14 14:07:03 -070017 conf.check_tinyxml(path=conf.options.tinyxml_dir)
Yingdi Yu4390ce52013-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 Yu3b318c12013-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 Yu4390ce52013-10-10 17:27:54 -070022
Yingdi Yud04ed1a2013-10-14 14:07:03 -070023 conf.check_boost(lib='system random thread filesystem')
Yingdi Yu847aa862013-10-09 16:35:53 -070024
25 conf.write_config_header('config.h')
26
27
28def build (bld):
29 qt = bld (
Yingdi Yu40eca752013-10-10 15:00:58 -070030 target = "Contacts",
Yingdi Yu847aa862013-10-09 16:35:53 -070031 features = "qt4 cxx cxxprogram",
32 defines = "WAF",
Yingdi Yu3b318c12013-10-15 17:54:00 -070033 source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui', 'logging.cc']),
Yingdi Yu847aa862013-10-09 16:35:53 -070034 includes = ".",
Yingdi Yu3b318c12013-10-15 17:54:00 -070035 use = "QTCORE QTGUI QTSQL SQLITE3 NDNCXX TINYXML BOOST BOOST_FILESYSTEM LOG4CXX",
Yingdi Yu847aa862013-10-09 16:35:53 -070036 )
37
38
39@Configure.conf
40def add_supported_cxxflags(self, cxxflags):
41 """
42 Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
43 """
44 self.start_msg('Checking allowed flags for c++ compiler')
45
46 supportedFlags = []
47 for flag in cxxflags:
48 if self.check_cxx (cxxflags=[flag], mandatory=False):
49 supportedFlags += [flag]
50
51 self.end_msg (' '.join (supportedFlags))
52 self.env.CXXFLAGS += supportedFlags
53
54from waflib.TaskGen import feature, before_method, after_method
55@feature('cxx')
56@after_method('process_source')
57@before_method('apply_incpaths')
58def add_includes_paths(self):
59 incs = set(self.to_list(getattr(self, 'includes', '')))
60 for x in self.compiled_tasks:
61 incs.add(x.inputs[0].parent.path_from(self.path))
62 self.includes = list(incs)