diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2023-02-22 13:42:05 -0800 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2023-04-21 15:18:56 +0530 |
commit | 73981b2c3423a5968cf1704a9d0311ce9175f25c (patch) | |
tree | 630c5b662d96500232d028004234acc004fa1f23 /mesonbuild/modules | |
parent | c62989ce80c562c655795ffc6fc799b9a048dc59 (diff) | |
download | meson-73981b2c3423a5968cf1704a9d0311ce9175f25c.zip meson-73981b2c3423a5968cf1704a9d0311ce9175f25c.tar.gz meson-73981b2c3423a5968cf1704a9d0311ce9175f25c.tar.bz2 |
modules/rust: Add -DNDEBUG to bindgen if b_ndebug is false
Otherwise bindgen may generate different behavior than the compiled C
code actually has.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/rust.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py index 6c3200d..bf1fd1d 100644 --- a/mesonbuild/modules/rust.py +++ b/mesonbuild/modules/rust.py @@ -19,6 +19,7 @@ import typing as T from . import ExtensionModule, ModuleReturnValue, ModuleInfo from .. import mlog from ..build import BothLibraries, BuildTarget, CustomTargetIndex, Executable, ExtractedObjects, GeneratedList, IncludeDirs, CustomTarget, StructuredSources +from ..compilers.compilers import are_asserts_disabled from ..dependencies import Dependency, ExternalLibrary from ..interpreter.type_checking import DEPENDENCIES_KW, TEST_KWS, OUTPUT_KW, INCLUDE_DIRECTORIES from ..interpreterbase import ContainerTypeInfo, InterpreterException, KwargInfo, typed_kwargs, typed_pos_args, noPosargs @@ -198,6 +199,8 @@ class RustModule(ExtensionModule): # bindgen always uses clang, so it's safe to hardcode -I here clang_args.extend([f'-I{x}' for x in i.to_string_list( state.environment.get_source_dir(), state.environment.get_build_dir())]) + if are_asserts_disabled(state.environment.coredata.options): + clang_args.append('-DNDEBUG') for de in kwargs['dependencies']: for i in de.get_include_dirs(): |