diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-10-30 22:49:17 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-11-02 19:49:14 +0200 |
commit | b3fe4a0a18edbd85c3a9e119912c968960f99574 (patch) | |
tree | b561e24dbc568df561ec0ca90a75f16483428bcc /mesonbuild/compilers/cpp.py | |
parent | 760b8633bc350b15ae7f67fe1d78ed91179bbb79 (diff) | |
download | meson-b3fe4a0a18edbd85c3a9e119912c968960f99574.zip meson-b3fe4a0a18edbd85c3a9e119912c968960f99574.tar.gz meson-b3fe4a0a18edbd85c3a9e119912c968960f99574.tar.bz2 |
Add option for controlling RTTI.
Diffstat (limited to 'mesonbuild/compilers/cpp.py')
-rw-r--r-- | mesonbuild/compilers/cpp.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 6161b7a..973ffbb 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -167,6 +167,7 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): opts.update({'cpp_eh': coredata.UserComboOption('C++ exception handling type.', ['none', 'default', 'a', 's', 'sc'], 'default'), + 'cpp_rtti': coredata.UserBooleanOption('Enable RTTI', True), 'cpp_std': coredata.UserComboOption('C++ language standard to use', ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'], @@ -181,6 +182,9 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): non_msvc_eh_options(options['cpp_eh'].value, args) + if not options['cpp_rtti'].value: + args.append('-fno-rtti') + return args def get_option_link_args(self, options): @@ -265,6 +269,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): opts.update({'cpp_eh': coredata.UserComboOption('C++ exception handling type.', ['none', 'default', 'a', 's', 'sc'], 'default'), + 'cpp_rtti': coredata.UserBooleanOption('Enable RTTI', True), 'cpp_std': coredata.UserComboOption('C++ language standard to use', ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'], @@ -285,6 +290,9 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): non_msvc_eh_options(options['cpp_eh'].value, args) + if not options['cpp_rtti'].value: + args.append('-fno-rtti') + if options['cpp_debugstl'].value: args.append('-D_GLIBCXX_DEBUG=1') return args @@ -373,6 +381,7 @@ class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler): opts.update({'cpp_eh': coredata.UserComboOption('C++ exception handling type.', ['none', 'default', 'a', 's', 'sc'], 'default'), + 'cpp_rtti': coredata.UserBooleanOption('Enable RTTI', True), 'cpp_std': coredata.UserComboOption('C++ language standard to use', ['none'] + c_stds + g_stds, 'none'), @@ -391,6 +400,8 @@ class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler): args.append('-std=' + remap_cpp03.get(std.value, std.value)) if options['cpp_eh'].value == 'none': args.append('-fno-exceptions') + if not options['cpp_rtti'].value: + args.append('-fno-rtti') if options['cpp_debugstl'].value: args.append('-D_GLIBCXX_DEBUG=1') return args @@ -422,6 +433,7 @@ class VisualStudioLikeCPPCompilerMixin: opts.update({'cpp_eh': coredata.UserComboOption('C++ exception handling type.', ['none', 'default', 'a', 's', 'sc'], 'default'), + 'cpp_rtti': coredata.UserBooleanOption('Enable RTTI', True), 'cpp_std': coredata.UserComboOption('C++ language standard to use', cpp_stds, 'none'), @@ -440,6 +452,9 @@ class VisualStudioLikeCPPCompilerMixin: else: args.append('/EH' + eh.value) + if not options['cpp_rtti'].value: + args.append('/GR-') + permissive, ver = self.VC_VERSION_MAP[options['cpp_std'].value] if ver is not None: |