Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 2 | |
Davide Pesavento | 71c622b | 2020-04-24 01:39:01 -0400 | [diff] [blame] | 3 | import platform |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -0500 | [diff] [blame] | 4 | from waflib import Configure, Logs, Utils |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 5 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 6 | |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 7 | def options(opt): |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -0500 | [diff] [blame] | 8 | opt.add_option('--debug', '--with-debug', action='store_true', default=False, |
Davide Pesavento | 71c622b | 2020-04-24 01:39:01 -0400 | [diff] [blame] | 9 | help='Compile in debugging mode with minimal optimizations (-Og)') |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 10 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 11 | |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 12 | def configure(conf): |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 13 | conf.start_msg('Checking C++ compiler version') |
| 14 | |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -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 | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 18 | errmsg = '' |
| 19 | warnmsg = '' |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 20 | if cxx == 'gcc': |
Davide Pesavento | 541a822 | 2022-03-01 15:08:42 -0500 | [diff] [blame] | 21 | if ccver < (7, 4, 0): |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 22 | errmsg = ('The version of gcc you are using is too old.\n' |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [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 | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 27 | conf.flags = GccFlags() |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 28 | elif cxx == 'clang': |
Davide Pesavento | 541a822 | 2022-03-01 15:08:42 -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 | 762548b | 2023-03-05 11:02:02 -0500 | [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 | 541a822 | 2022-03-01 15:08:42 -0500 | [diff] [blame] | 35 | 'officially supported and may result in build failures.') |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 36 | elif ccver < (7, 0, 0): |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 37 | errmsg = ('The version of clang you are using is too old.\n' |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 38 | 'The minimum supported clang version is 7.0.') |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 39 | conf.flags = ClangFlags() |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 40 | else: |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 41 | warnmsg = f'{cxx} compiler is unsupported' |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 42 | conf.flags = CompilerFlags() |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 43 | |
| 44 | if errmsg: |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -0500 | [diff] [blame] | 45 | conf.end_msg(ccverstr, color='RED') |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 46 | conf.fatal(errmsg) |
| 47 | elif warnmsg: |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -0500 | [diff] [blame] | 48 | conf.end_msg(ccverstr, color='YELLOW') |
Davide Pesavento | 71c622b | 2020-04-24 01:39:01 -0400 | [diff] [blame] | 49 | Logs.warn('WARNING: ' + warnmsg) |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 50 | else: |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -0500 | [diff] [blame] | 51 | conf.end_msg(ccverstr) |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 52 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 53 | conf.areCustomCxxflagsPresent = len(conf.env.CXXFLAGS) > 0 |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 54 | |
Davide Pesavento | 1fd0024 | 2018-05-20 00:11:01 -0400 | [diff] [blame] | 55 | # General flags are always applied (e.g., selecting C++ language standard) |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 56 | generalFlags = conf.flags.getGeneralFlags(conf) |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -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 | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 61 | |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 62 | @Configure.conf |
| 63 | def check_compiler_flags(conf): |
Davide Pesavento | d06ea05 | 2015-10-02 01:48:24 +0200 | [diff] [blame] | 64 | # Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 65 | # corresponding environment variables are not set. |
Davide Pesavento | d06ea05 | 2015-10-02 01:48:24 +0200 | [diff] [blame] | 66 | # DEFINES are always applied. |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 67 | if conf.options.debug: |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 68 | extraFlags = conf.flags.getDebugFlags(conf) |
| 69 | if conf.areCustomCxxflagsPresent: |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 70 | missingFlags = [x for x in extraFlags['CXXFLAGS'] if x not in conf.env.CXXFLAGS] |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -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)) |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 75 | else: |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 76 | extraFlags = conf.flags.getOptimizedFlags(conf) |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 77 | |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [diff] [blame] | 78 | if not conf.areCustomCxxflagsPresent: |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 79 | conf.add_supported_cxxflags(extraFlags['CXXFLAGS']) |
Davide Pesavento | 7c02b47 | 2015-10-28 20:50:17 +0100 | [diff] [blame] | 80 | conf.add_supported_linkflags(extraFlags['LINKFLAGS']) |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 81 | |
| 82 | conf.env.DEFINES += extraFlags['DEFINES'] |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 83 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 84 | |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 85 | @Configure.conf |
| 86 | def add_supported_cxxflags(self, cxxflags): |
| 87 | """ |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 88 | Check which cxxflags are supported by the active compiler and add them to env.CXXFLAGS variable. |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 89 | """ |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 90 | if len(cxxflags) == 0: |
| 91 | return |
| 92 | |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 93 | self.start_msg('Checking supported CXXFLAGS') |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 94 | |
| 95 | supportedFlags = [] |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [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 |
Alexander Afanasyev | 5e1288e | 2014-03-28 11:11:48 -0700 | [diff] [blame] | 100 | |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 101 | self.end_msg(' '.join(supportedFlags)) |
Davide Pesavento | 1349d2d | 2016-08-09 06:43:57 +0200 | [diff] [blame] | 102 | self.env.prepend_value('CXXFLAGS', supportedFlags) |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 103 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 104 | |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 105 | @Configure.conf |
| 106 | def add_supported_linkflags(self, linkflags): |
| 107 | """ |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 108 | Check which linkflags are supported by the active compiler and add them to env.LINKFLAGS variable. |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 109 | """ |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 110 | if len(linkflags) == 0: |
| 111 | return |
| 112 | |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 113 | self.start_msg('Checking supported LINKFLAGS') |
| 114 | |
| 115 | supportedFlags = [] |
Alexander Afanasyev | b82d8c3 | 2017-09-21 11:35:07 -0400 | [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 |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 120 | |
| 121 | self.end_msg(' '.join(supportedFlags)) |
Davide Pesavento | 1349d2d | 2016-08-09 06:43:57 +0200 | [diff] [blame] | 122 | self.env.prepend_value('LINKFLAGS', supportedFlags) |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 123 | |
| 124 | |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 125 | class CompilerFlags: |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -0500 | [diff] [blame] | 126 | def getCompilerVersion(self, conf): |
| 127 | return tuple(int(i) for i in conf.env.CC_VERSION) |
| 128 | |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 129 | def getGeneralFlags(self, conf): |
Davide Pesavento | 7c02b47 | 2015-10-28 20:50:17 +0100 | [diff] [blame] | 130 | """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed""" |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 131 | return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []} |
| 132 | |
| 133 | def getDebugFlags(self, conf): |
Davide Pesavento | 7c02b47 | 2015-10-28 20:50:17 +0100 | [diff] [blame] | 134 | """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode""" |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 135 | return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['_DEBUG']} |
| 136 | |
| 137 | def getOptimizedFlags(self, conf): |
Davide Pesavento | 7c02b47 | 2015-10-28 20:50:17 +0100 | [diff] [blame] | 138 | """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode""" |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 139 | return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']} |
| 140 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 141 | |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 142 | class GccClangCommonFlags(CompilerFlags): |
Davide Pesavento | d06ea05 | 2015-10-02 01:48:24 +0200 | [diff] [blame] | 143 | """ |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 144 | This class defines common flags that work for both gcc and clang compilers. |
Davide Pesavento | d06ea05 | 2015-10-02 01:48:24 +0200 | [diff] [blame] | 145 | """ |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 146 | |
Davide Pesavento | 724d65a | 2017-06-23 17:14:08 -0400 | [diff] [blame] | 147 | def getGeneralFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 148 | flags = super().getGeneralFlags(conf) |
Davide Pesavento | fcd3e44 | 2023-03-10 18:44:11 -0500 | [diff] [blame] | 149 | flags['CXXFLAGS'] += ['-std=c++17'] |
Davide Pesavento | ea5ce49 | 2022-09-30 20:25:25 -0400 | [diff] [blame] | 150 | if Utils.unversioned_sys_platform() != 'darwin': |
Davide Pesavento | 64ae55d | 2018-12-19 00:25:47 -0500 | [diff] [blame] | 151 | flags['LINKFLAGS'] += ['-fuse-ld=lld'] |
Davide Pesavento | 724d65a | 2017-06-23 17:14:08 -0400 | [diff] [blame] | 152 | return flags |
| 153 | |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 154 | __cxxFlags = [ |
| 155 | '-fdiagnostics-color', |
| 156 | '-Wall', |
| 157 | '-Wextra', |
| 158 | '-Wpedantic', |
| 159 | '-Wenum-conversion', |
| 160 | '-Wextra-semi', |
| 161 | '-Wnon-virtual-dtor', |
| 162 | '-Wno-unused-parameter', |
| 163 | ] |
| 164 | __linkFlags = ['-Wl,-O1'] |
| 165 | |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 166 | def getDebugFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 167 | flags = super().getDebugFlags(conf) |
| 168 | flags['CXXFLAGS'] += ['-Og', '-g'] + self.__cxxFlags + [ |
| 169 | '-Werror', |
| 170 | '-Wno-error=deprecated-declarations', # Bug #3795 |
| 171 | '-Wno-error=maybe-uninitialized', # Bug #1615 |
| 172 | ] |
| 173 | flags['LINKFLAGS'] += self.__linkFlags |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 174 | return flags |
| 175 | |
| 176 | def getOptimizedFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 177 | flags = super().getOptimizedFlags(conf) |
| 178 | flags['CXXFLAGS'] += ['-O2', '-g1'] + self.__cxxFlags |
| 179 | flags['LINKFLAGS'] += self.__linkFlags |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 180 | return flags |
| 181 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 182 | |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 183 | class GccFlags(GccClangCommonFlags): |
| 184 | __cxxFlags = [ |
| 185 | '-Wcatch-value=2', |
| 186 | '-Wcomma-subscript', # enabled by default in C++20 |
| 187 | '-Wduplicated-branches', |
| 188 | '-Wduplicated-cond', |
| 189 | '-Wlogical-op', |
| 190 | '-Wredundant-tags', |
| 191 | '-Wvolatile', # enabled by default in C++20 |
| 192 | ] |
| 193 | |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 194 | def getDebugFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 195 | flags = super().getDebugFlags(conf) |
| 196 | flags['CXXFLAGS'] += self.__cxxFlags |
Davide Pesavento | 541a822 | 2022-03-01 15:08:42 -0500 | [diff] [blame] | 197 | if platform.machine() == 'armv7l': |
Davide Pesavento | 71c622b | 2020-04-24 01:39:01 -0400 | [diff] [blame] | 198 | flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106 |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 199 | return flags |
| 200 | |
Davide Pesavento | d06ea05 | 2015-10-02 01:48:24 +0200 | [diff] [blame] | 201 | def getOptimizedFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 202 | flags = super().getOptimizedFlags(conf) |
| 203 | flags['CXXFLAGS'] += self.__cxxFlags |
Davide Pesavento | 541a822 | 2022-03-01 15:08:42 -0500 | [diff] [blame] | 204 | if platform.machine() == 'armv7l': |
Davide Pesavento | 71c622b | 2020-04-24 01:39:01 -0400 | [diff] [blame] | 205 | flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106 |
Davide Pesavento | d06ea05 | 2015-10-02 01:48:24 +0200 | [diff] [blame] | 206 | return flags |
| 207 | |
Davide Pesavento | 12b8aaa | 2023-08-06 19:18:51 -0400 | [diff] [blame] | 208 | |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 209 | class ClangFlags(GccClangCommonFlags): |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 210 | def getGeneralFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 211 | flags = super().getGeneralFlags(conf) |
Davide Pesavento | 71c622b | 2020-04-24 01:39:01 -0400 | [diff] [blame] | 212 | if Utils.unversioned_sys_platform() == 'darwin': |
Alexander Afanasyev | 5560fd4 | 2018-03-07 17:03:03 -0500 | [diff] [blame] | 213 | # Bug #4296 |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 214 | brewdir = '/opt/homebrew' if platform.machine() == 'arm64' else '/usr/local' |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 215 | flags['CXXFLAGS'] += [ |
| 216 | ['-isystem', f'{brewdir}/include'], # for Homebrew |
| 217 | ['-isystem', '/opt/local/include'], # for MacPorts |
| 218 | ] |
Davide Pesavento | 71c622b | 2020-04-24 01:39:01 -0400 | [diff] [blame] | 219 | elif Utils.unversioned_sys_platform() == 'freebsd': |
| 220 | # Bug #4790 |
| 221 | flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']] |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 222 | return flags |
| 223 | |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 224 | __cxxFlags = [ |
| 225 | '-Wundefined-func-template', |
| 226 | '-Wno-unused-local-typedef', # Bugs #2657 and #3209 |
| 227 | ] |
| 228 | |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 229 | def getDebugFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 230 | flags = super().getDebugFlags(conf) |
| 231 | flags['CXXFLAGS'] += self.__cxxFlags |
Davide Pesavento | d06ea05 | 2015-10-02 01:48:24 +0200 | [diff] [blame] | 232 | return flags |
| 233 | |
| 234 | def getOptimizedFlags(self, conf): |
Davide Pesavento | 03fdfb1 | 2023-08-06 19:35:10 -0400 | [diff] [blame] | 235 | flags = super().getOptimizedFlags(conf) |
| 236 | flags['CXXFLAGS'] += self.__cxxFlags |
Alexander Afanasyev | 0151579 | 2014-12-16 14:20:01 -0800 | [diff] [blame] | 237 | return flags |