infra: add memory sanitize option in meson

for optimial library, we removed some peripheral information in default,
this breaks asan environment.

This patch changes it to make it both.

if you want to use asan, please change the meson option.

default is disabled.

example)
$meson . build -Db_sanitize=address
$meson . build -Db_sanitize=address,undefined
This commit is contained in:
Hermet Park 2021-06-23 11:47:59 +09:00 committed by JunsuChoi
parent 5679d666a6
commit 5bbe713ca5
2 changed files with 6 additions and 4 deletions

View file

@ -1,6 +1,6 @@
project('thorvg',
'cpp',
default_options : ['buildtype=debugoptimized', 'werror=false', 'optimization=s'],
default_options : ['buildtype=debugoptimized', 'b_sanitize=none', 'werror=false', 'optimization=s'],
version : '0.2.99',
license : 'MIT')

View file

@ -6,9 +6,11 @@ if (cc.get_id() != 'msvc')
compiler_flags += ['-mavx']
message('Enable Advanced Vector Extension')
endif
compiler_flags += ['-fno-exceptions', '-fno-rtti',
'-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
'-Woverloaded-virtual', '-Wno-unused-parameter']
if get_option('b_sanitize') == 'none'
compiler_flags += ['-fno-exceptions', '-fno-rtti',
'-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
'-Woverloaded-virtual', '-Wno-unused-parameter']
endif
endif