From 81e9256b7a49193eec4c95c722f5abb32076acb3 Mon Sep 17 00:00:00 2001 From: Nikita Edel Date: Mon, 9 Mar 2026 17:22:15 +0100 Subject: [PATCH] added asan for debug builds --- meson.build | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 3cc9b0c41..357396709 100644 --- a/meson.build +++ b/meson.build @@ -12,6 +12,9 @@ pymod = import('python') python = pymod.find_installation('python3', required: true) cc = meson.get_compiler('cpp') +buildtype = get_option('buildtype') +#langs cant sadly be set before calling project +langs = ['cpp', 'c'] # system deps gl_dep = dependency('gl') @@ -21,6 +24,19 @@ png_dep = dependency('libpng') thread_dep = dependency('threads') dl_dep = cc.find_library('dl') +if buildtype.startswith('debug') + strAsan = '-fsanitize=address' + strLsan = '-fsanitize=leak' + if cc.has_argument(strAsan) + add_project_arguments(strAsan, language: langs) + add_project_link_arguments(strAsan, language: langs) + endif + if cc.has_argument(strLsan) + add_project_arguments(strLsan, language: langs) + add_project_link_arguments(strLsan, language: langs) + endif +endif + # compile flags (chagne ts juicey) global_cpp_args = [ '-fpermissive', @@ -52,4 +68,4 @@ subdir('4J.Profile') subdir('4J.Storage') subdir('Minecraft.Assets') subdir('Minecraft.World') -subdir('Minecraft.Client') \ No newline at end of file +subdir('Minecraft.Client')