summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2021-09-27 07:24:16 -0700
committerMarge Bot <emma+marge@anholt.net>2021-11-19 15:36:59 +0000
commitf9a46ad22a544bdc9c1c0d87ea69d43e215c630c (patch)
tree0288bb70100d26d46c40dc906bc136e06b626100 /meson.build
parentad8626741236c312b08fcdf445fd806cf46b628f (diff)
meson: Allow mismatching RTTI for MSVC
This might be safe to relax to all Windows compilers, but I didn't test Clang or MinGW, so scoping to MSVC for now. For MSVC, this is safe to mismatch, because the vftables are emitted into all objects with "pick largest," and the definition with RTTI is larger than the one without. This is different than the Itanium ABI, which only emits one copy of the typeinfo in the object which defines the key method. Acked-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13064>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build41
1 files changed, 21 insertions, 20 deletions
diff --git a/meson.build b/meson.build
index d1606a7824a..fa37127612c 100644
--- a/meson.build
+++ b/meson.build
@@ -1734,28 +1734,29 @@ if with_llvm
error('SWR requires LLVM draw support.')
endif
- # LLVM can be built without rtti, turning off rtti changes the ABI of C++
- # programs, so we need to build all C++ code in mesa without rtti as well to
- # ensure that linking works.
- #
- # In meson 0.51.0 we can use cmake to find LLVM in addittion to meson's
- # builtin llvm-config based finder. A new generic variable getter method
- # has also been added, so we'll use that if we can, to cover the cmake case.
- if dep_llvm.type_name() == 'internal'
- _llvm_rtti = subproject('llvm').get_variable('has_rtti', true)
- else
- # The CMake finder will return 'ON', the llvm-config will return 'YES'
- _llvm_rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti'))
- endif
- if _rtti != _llvm_rtti
- if _llvm_rtti
- error('LLVM was built with RTTI, cannot build Mesa with RTTI disabled. Remove cpp_rtti disable switch or use LLVM built without LLVM_ENABLE_RTTI.')
+ if cc.get_id() != 'msvc'
+ # LLVM can be built without rtti, turning off rtti changes the ABI of C++
+ # programs, so we need to build all C++ code in mesa without rtti as well to
+ # ensure that linking works. Note that MSVC does handle mismatching RTTI
+ # without issues, so only apply this for other compilers.
+ #
+ # In meson 0.51.0 we can use cmake to find LLVM in addittion to meson's
+ # builtin llvm-config based finder. A new generic variable getter method
+ # has also been added, so we'll use that if we can, to cover the cmake case.
+ if dep_llvm.type_name() == 'internal'
+ _llvm_rtti = subproject('llvm').get_variable('has_rtti', true)
else
- error('LLVM was built without RTTI, so Mesa must also disable RTTI. Use an LLVM built with LLVM_ENABLE_RTTI or add cpp_rtti=false.')
+ # The CMake finder will return 'ON', the llvm-config will return 'YES'
+ _llvm_rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti'))
endif
- endif
-
- if cc.get_id() == 'msvc'
+ if _rtti != _llvm_rtti
+ if _llvm_rtti
+ error('LLVM was built with RTTI, cannot build Mesa with RTTI disabled. Remove cpp_rtti disable switch or use LLVM built without LLVM_ENABLE_RTTI.')
+ else
+ error('LLVM was built without RTTI, so Mesa must also disable RTTI. Use an LLVM built with LLVM_ENABLE_RTTI or add cpp_rtti=false.')
+ endif
+ endif
+ else
# Suppress "/DELAYLOAD:ole32.dll/shell32.dll ignored" warnings that LLVM adds
add_project_link_arguments(
'/ignore:4199',