[RFC,1/6] build: enable debug info by default in meson builds

Message ID 20191023010754.65172-2-kevin.laatz@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Add ABI compatibility checks to the meson build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Kevin Laatz Oct. 23, 2019, 1:07 a.m. UTC
  From: Bruce Richardson <bruce.richardson@intel.com>

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 <bruce.richardson@intel.com>
---
 meson.build | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/meson.build b/meson.build
index c5a3dda26..b77ccd6ef 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()