Obaid | 2ea377f | 2014-02-27 19:45:15 -0600 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | from waflib import Configure |
| 4 | |
| 5 | def configure(conf): |
| 6 | if conf.options.debug: |
| 7 | conf.define ('_DEBUG', 1) |
| 8 | flags = ['-O0', |
| 9 | '-Wall', |
| 10 | '-Wno-unused-variable', |
| 11 | '-g3', |
| 12 | '-Wno-unused-private-field', # only clang supports |
| 13 | '-fcolor-diagnostics', # only clang supports |
| 14 | '-Qunused-arguments', # only clang supports |
| 15 | '-Wno-tautological-compare', # suppress warnings from CryptoPP |
| 16 | '-Wno-unused-function', # another annoying warning from CryptoPP |
| 17 | |
| 18 | '-Wno-deprecated-declarations', |
| 19 | ] |
| 20 | |
| 21 | conf.add_supported_cxxflags (cxxflags = flags) |
| 22 | else: |
| 23 | flags = ['-O3', '-g', '-Wno-tautological-compare','-Wno-unused-variable', |
| 24 | '-Wno-unused-function', '-Wno-deprecated-declarations'] |
| 25 | conf.add_supported_cxxflags (cxxflags = flags) |
| 26 | |
| 27 | @Configure.conf |
| 28 | def add_supported_cxxflags(self, cxxflags): |
| 29 | """ |
| 30 | Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable |
| 31 | """ |
| 32 | self.start_msg('Checking allowed flags for c++ compiler') |
| 33 | |
| 34 | supportedFlags = [] |
| 35 | for flag in cxxflags: |
| 36 | if self.check_cxx (cxxflags=[flag], mandatory=False): |
| 37 | supportedFlags += [flag] |
| 38 | |
| 39 | self.end_msg (' '.join (supportedFlags)) |
| 40 | self.env.CXXFLAGS += supportedFlags |
| 41 | |