Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 2 | |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 3 | import platform |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 4 | from waflib import Configure, Logs, Utils |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 5 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 6 | |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 7 | def options(opt): |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 8 | opt.add_option('--debug', '--with-debug', action='store_true', default=False, |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 9 | help='Compile in debugging mode with minimal optimizations (-Og)') |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 10 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 11 | |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 12 | def configure(conf): |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 13 | conf.start_msg('Checking C++ compiler version') |
| 14 | |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 15 | cxx = conf.env.CXX_NAME # generic name of the compiler |
| 16 | ccver = tuple(int(i) for i in conf.env.CC_VERSION) |
| 17 | ccverstr = '.'.join(conf.env.CC_VERSION) |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 18 | errmsg = '' |
| 19 | warnmsg = '' |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 20 | if cxx == 'gcc': |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 21 | if ccver < (7, 4, 0): |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 22 | errmsg = ('The version of gcc you are using is too old.\n' |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 23 | 'The minimum supported gcc version is 9.3.') |
| 24 | elif ccver < (9, 3, 0): |
| 25 | warnmsg = ('Using a version of gcc older than 9.3 is not ' |
| 26 | 'officially supported and may result in build failures.') |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 27 | conf.flags = GccFlags() |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 28 | elif cxx == 'clang': |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 29 | if Utils.unversioned_sys_platform() == 'darwin': |
| 30 | if ccver < (10, 0, 0): |
| 31 | errmsg = ('The version of Xcode you are using is too old.\n' |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 32 | 'The minimum supported Xcode version is 12.4.') |
| 33 | elif ccver < (12, 0, 0): |
| 34 | warnmsg = ('Using a version of Xcode older than 12.4 is not ' |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 35 | 'officially supported and may result in build failures.') |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 36 | elif ccver < (7, 0, 0): |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 37 | errmsg = ('The version of clang you are using is too old.\n' |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 38 | 'The minimum supported clang version is 7.0.') |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 39 | conf.flags = ClangFlags() |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 40 | else: |
Davide Pesavento | ede5963 | 2022-08-26 20:35:44 -0400 | [diff] [blame] | 41 | warnmsg = f'{cxx} compiler is unsupported' |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 42 | conf.flags = CompilerFlags() |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 43 | |
| 44 | if errmsg: |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 45 | conf.end_msg(ccverstr, color='RED') |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 46 | conf.fatal(errmsg) |
| 47 | elif warnmsg: |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 48 | conf.end_msg(ccverstr, color='YELLOW') |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 49 | Logs.warn('WARNING: ' + warnmsg) |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 50 | else: |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 51 | conf.end_msg(ccverstr) |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 52 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 53 | conf.areCustomCxxflagsPresent = len(conf.env.CXXFLAGS) > 0 |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 54 | |
Davide Pesavento | a08dc3f | 2018-05-24 00:40:28 -0400 | [diff] [blame] | 55 | # General flags are always applied (e.g., selecting C++ language standard) |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 56 | generalFlags = conf.flags.getGeneralFlags(conf) |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 57 | conf.add_supported_cxxflags(generalFlags['CXXFLAGS']) |
| 58 | conf.add_supported_linkflags(generalFlags['LINKFLAGS']) |
| 59 | conf.env.DEFINES += generalFlags['DEFINES'] |
| 60 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 61 | |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 62 | @Configure.conf |
| 63 | def check_compiler_flags(conf): |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 64 | # Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the |
| 65 | # corresponding environment variables are not set. |
| 66 | # DEFINES are always applied. |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 67 | if conf.options.debug: |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 68 | extraFlags = conf.flags.getDebugFlags(conf) |
| 69 | if conf.areCustomCxxflagsPresent: |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 70 | missingFlags = [x for x in extraFlags['CXXFLAGS'] if x not in conf.env.CXXFLAGS] |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 71 | if missingFlags: |
| 72 | Logs.warn('Selected debug mode, but CXXFLAGS is set to a custom value "%s"' |
| 73 | % ' '.join(conf.env.CXXFLAGS)) |
| 74 | Logs.warn('Default flags "%s" will not be used' % ' '.join(missingFlags)) |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 75 | else: |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 76 | extraFlags = conf.flags.getOptimizedFlags(conf) |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 77 | |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 78 | if not conf.areCustomCxxflagsPresent: |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 79 | conf.add_supported_cxxflags(extraFlags['CXXFLAGS']) |
| 80 | conf.add_supported_linkflags(extraFlags['LINKFLAGS']) |
| 81 | |
| 82 | conf.env.DEFINES += extraFlags['DEFINES'] |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 83 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 84 | |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 85 | @Configure.conf |
| 86 | def add_supported_cxxflags(self, cxxflags): |
| 87 | """ |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 88 | Check which cxxflags are supported by the active compiler and add them to env.CXXFLAGS variable. |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 89 | """ |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 90 | if len(cxxflags) == 0: |
| 91 | return |
| 92 | |
| 93 | self.start_msg('Checking supported CXXFLAGS') |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 94 | |
| 95 | supportedFlags = [] |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 96 | for flags in cxxflags: |
| 97 | flags = Utils.to_list(flags) |
| 98 | if self.check_cxx(cxxflags=['-Werror'] + flags, mandatory=False): |
| 99 | supportedFlags += flags |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 100 | |
| 101 | self.end_msg(' '.join(supportedFlags)) |
Davide Pesavento | c58cc7f | 2017-08-08 16:51:28 -0500 | [diff] [blame] | 102 | self.env.prepend_value('CXXFLAGS', supportedFlags) |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 103 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 104 | |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 105 | @Configure.conf |
| 106 | def add_supported_linkflags(self, linkflags): |
| 107 | """ |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 108 | Check which linkflags are supported by the active compiler and add them to env.LINKFLAGS variable. |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 109 | """ |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 110 | if len(linkflags) == 0: |
| 111 | return |
| 112 | |
| 113 | self.start_msg('Checking supported LINKFLAGS') |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 114 | |
| 115 | supportedFlags = [] |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 116 | for flags in linkflags: |
| 117 | flags = Utils.to_list(flags) |
| 118 | if self.check_cxx(linkflags=['-Werror'] + flags, mandatory=False): |
| 119 | supportedFlags += flags |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 120 | |
| 121 | self.end_msg(' '.join(supportedFlags)) |
Davide Pesavento | c58cc7f | 2017-08-08 16:51:28 -0500 | [diff] [blame] | 122 | self.env.prepend_value('LINKFLAGS', supportedFlags) |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 123 | |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 124 | |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 125 | class CompilerFlags(object): |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 126 | def getCompilerVersion(self, conf): |
| 127 | return tuple(int(i) for i in conf.env.CC_VERSION) |
| 128 | |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 129 | def getGeneralFlags(self, conf): |
| 130 | """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed""" |
| 131 | return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []} |
| 132 | |
| 133 | def getDebugFlags(self, conf): |
| 134 | """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode""" |
| 135 | return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['_DEBUG']} |
| 136 | |
| 137 | def getOptimizedFlags(self, conf): |
| 138 | """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode""" |
| 139 | return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']} |
| 140 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 141 | |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 142 | class GccBasicFlags(CompilerFlags): |
| 143 | """ |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 144 | This class defines basic flags that work for both gcc and clang compilers. |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 145 | """ |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 146 | def getGeneralFlags(self, conf): |
| 147 | flags = super(GccBasicFlags, self).getGeneralFlags(conf) |
Davide Pesavento | c1d0e8e | 2022-06-15 14:26:02 -0400 | [diff] [blame] | 148 | flags['CXXFLAGS'] += ['-std=c++17'] |
Davide Pesavento | 65ee992 | 2022-11-16 00:21:43 -0500 | [diff] [blame] | 149 | if Utils.unversioned_sys_platform() != 'darwin': |
Davide Pesavento | e556991 | 2019-01-29 19:39:06 -0500 | [diff] [blame] | 150 | flags['LINKFLAGS'] += ['-fuse-ld=lld'] |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 151 | return flags |
| 152 | |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 153 | def getDebugFlags(self, conf): |
| 154 | flags = super(GccBasicFlags, self).getDebugFlags(conf) |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 155 | flags['CXXFLAGS'] += ['-Og', |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 156 | '-g3', |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 157 | '-Wall', |
| 158 | '-Wextra', |
Davide Pesavento | 1b640fd | 2023-01-04 21:00:05 -0500 | [diff] [blame] | 159 | '-Wpedantic', |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 160 | '-Werror', |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 161 | '-Wcatch-value=2', |
| 162 | '-Wextra-semi', |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 163 | '-Wnon-virtual-dtor', |
Alexander Afanasyev | 96bf2f0 | 2016-10-11 16:37:45 -0700 | [diff] [blame] | 164 | '-Wno-error=deprecated-declarations', # Bug #3795 |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 165 | '-Wno-error=maybe-uninitialized', # Bug #1615 |
| 166 | '-Wno-unused-parameter', |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 167 | ] |
Davide Pesavento | e556991 | 2019-01-29 19:39:06 -0500 | [diff] [blame] | 168 | flags['LINKFLAGS'] += ['-Wl,-O1'] |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 169 | return flags |
| 170 | |
| 171 | def getOptimizedFlags(self, conf): |
| 172 | flags = super(GccBasicFlags, self).getOptimizedFlags(conf) |
| 173 | flags['CXXFLAGS'] += ['-O2', |
| 174 | '-g', |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 175 | '-Wall', |
| 176 | '-Wextra', |
Davide Pesavento | 1b640fd | 2023-01-04 21:00:05 -0500 | [diff] [blame] | 177 | '-Wpedantic', |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 178 | '-Wcatch-value=2', |
| 179 | '-Wextra-semi', |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 180 | '-Wnon-virtual-dtor', |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 181 | '-Wno-unused-parameter', |
| 182 | ] |
Davide Pesavento | e556991 | 2019-01-29 19:39:06 -0500 | [diff] [blame] | 183 | flags['LINKFLAGS'] += ['-Wl,-O1'] |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 184 | return flags |
| 185 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 186 | |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 187 | class GccFlags(GccBasicFlags): |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 188 | def getDebugFlags(self, conf): |
| 189 | flags = super(GccFlags, self).getDebugFlags(conf) |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 190 | flags['CXXFLAGS'] += ['-fdiagnostics-color', |
| 191 | '-Wredundant-tags', |
| 192 | ] |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 193 | if platform.machine() == 'armv7l': |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 194 | flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106 |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 195 | return flags |
| 196 | |
| 197 | def getOptimizedFlags(self, conf): |
| 198 | flags = super(GccFlags, self).getOptimizedFlags(conf) |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 199 | flags['CXXFLAGS'] += ['-fdiagnostics-color', |
| 200 | '-Wredundant-tags', |
| 201 | ] |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 202 | if platform.machine() == 'armv7l': |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 203 | flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106 |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 204 | return flags |
| 205 | |
Davide Pesavento | 5110a8a | 2023-08-20 21:42:11 -0400 | [diff] [blame^] | 206 | |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 207 | class ClangFlags(GccBasicFlags): |
| 208 | def getGeneralFlags(self, conf): |
| 209 | flags = super(ClangFlags, self).getGeneralFlags(conf) |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 210 | if Utils.unversioned_sys_platform() == 'darwin': |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 211 | # Bug #4296 |
Davide Pesavento | ede5963 | 2022-08-26 20:35:44 -0400 | [diff] [blame] | 212 | brewdir = '/opt/homebrew' if platform.machine() == 'arm64' else '/usr/local' |
| 213 | flags['CXXFLAGS'] += [['-isystem', f'{brewdir}/include'], # for Homebrew |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 214 | ['-isystem', '/opt/local/include']] # for MacPorts |
Davide Pesavento | 7ae8b08 | 2021-10-12 21:45:47 -0400 | [diff] [blame] | 215 | elif Utils.unversioned_sys_platform() == 'freebsd': |
| 216 | # Bug #4790 |
| 217 | flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']] |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 218 | return flags |
| 219 | |
| 220 | def getDebugFlags(self, conf): |
| 221 | flags = super(ClangFlags, self).getDebugFlags(conf) |
| 222 | flags['CXXFLAGS'] += ['-fcolor-diagnostics', |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 223 | '-Wundefined-func-template', |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 224 | '-Wno-unused-local-typedef', # Bugs #2657 and #3209 |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 225 | ] |
| 226 | return flags |
| 227 | |
| 228 | def getOptimizedFlags(self, conf): |
| 229 | flags = super(ClangFlags, self).getOptimizedFlags(conf) |
| 230 | flags['CXXFLAGS'] += ['-fcolor-diagnostics', |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 231 | '-Wundefined-func-template', |
Davide Pesavento | 6ebfd7c | 2017-08-26 17:52:54 -0400 | [diff] [blame] | 232 | '-Wno-unused-local-typedef', # Bugs #2657 and #3209 |
Alexander Afanasyev | f9f3910 | 2015-12-01 17:43:40 -0800 | [diff] [blame] | 233 | ] |
| 234 | return flags |