From ad1ec9d61745de0dc09668a8b6eac74ad9b6f39a Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 23 Oct 2019 01:07:49 +0000 Subject: [PATCH] build: enable debug info by default in meson builds We can turn on debug info by default in meson builds, since it has no performance penalty. This is done by changing the default build type from "release" to "debugoptimized". Since the latter using O2, we can using extra cflags to override that back to O3, which will make little real difference for actual debugging. For real debug builds, the user can still do "meson --buildtype=debug ..." and to remove the debug info "meson --buildtype=release ..." can be used. These are all standard meson options. The advantage of having debug builds by default using meson settings is that we can then add checks for ABI compatibility into each build, and disable them if we detect that the user has turned off the debug info. Signed-off-by: Bruce Richardson --- meson.build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b7ae9c8d9a..3b7a2e7de8 100644 --- a/meson.build +++ b/meson.build @@ -7,10 +7,16 @@ project('DPDK', 'C', version: run_command(find_program('cat', 'more'), files('VERSION')).stdout().strip(), license: 'BSD', - default_options: ['buildtype=release', 'default_library=static'], + default_options: ['buildtype=debugoptimized', + 'default_library=static'], meson_version: '>= 0.47.1' ) +# for default "debugoptimized" builds override optimization level 2 with 3 +if get_option('buildtype') == 'debugoptimized' + add_project_arguments('-O3', language: 'c') +endif + # set up some global vars for compiler, platform, configuration, etc. cc = meson.get_compiler('c') dpdk_conf = configuration_data() -- 2.20.1