@@ -56,6 +56,8 @@ def extra_options(extra_vars=None):
56
56
'build_type' : [None , "Build type for meson, e.g. release."
57
57
"Defaults to 'release', 'debugoptimized' or 'debug' depending on "
58
58
"toolchainopts[debug,noopt]" , CUSTOM ],
59
+ 'ndebug' : [True , "Sets -Db_ndebug which in turn defines NDEBUG for C/C++ builds."
60
+ "This disabled costly asserts in code, typical for production." , CUSTOM ],
59
61
'configure_cmd' : [DEFAULT_CONFIGURE_CMD , "Configure command to use" , CUSTOM ],
60
62
'install_cmd' : [DEFAULT_INSTALL_CMD , "Install command to use" , CUSTOM ],
61
63
'separate_build_dir' : [True , "Perform build in a separate directory" , CUSTOM ],
@@ -69,9 +71,9 @@ def build_type(self):
69
71
# While we do set optimization and debug flag separately, build scripts may be adding additional
70
72
# defines and flags based on the build_type as well so we pick the closest match.
71
73
if build_type is None :
72
- if self .toolchain .options .get ('noopt' , None ): # also implies debug but is the closest match
74
+ if self .toolchain .options .get ('noopt' , False ): # also implies debug but is the closest match
73
75
build_type = 'debug'
74
- elif self .toolchain .options .get ('debug' , None ):
76
+ elif self .toolchain .options .get ('debug' , False ):
75
77
build_type = 'debugoptimized'
76
78
else :
77
79
build_type = 'release'
@@ -121,15 +123,16 @@ def configure_step(self, cmd_prefix=''):
121
123
build_dir = self .cfg .get ('build_dir' ) or self .start_dir
122
124
123
125
cmd = ("%(preconfigopts)s %(configure_cmd)s --prefix %(installdir)s --buildtype %(buildtype)s %(configopts)s "
124
- "--optimization %(optimization)s %(debug)s %(source_dir)s" ) % {
126
+ "--optimization %(optimization)s %(debug)s -Db_ndebug=%(ndebug)s %(source_dir)s" ) % {
125
127
'configopts' : self .cfg ['configopts' ],
126
128
'configure_cmd' : configure_cmd ,
127
129
'installdir' : self .installdir ,
128
130
'preconfigopts' : self .cfg ['preconfigopts' ],
129
- 'source_dir' : build_dir ,
130
131
'buildtype' : self .build_type ,
131
132
'optimization' : self .optimization ,
132
133
'debug' : '--debug' if self .toolchain .options .get ('debug' , False ) else '' ,
134
+ 'ndebug' : self .cfg .get ('ndebug' ),
135
+ 'source_dir' : build_dir ,
133
136
}
134
137
res = run_shell_cmd (cmd )
135
138
return res .output
@@ -144,7 +147,7 @@ def build_step(self, verbose=False, path=None):
144
147
if self .cfg ['parallel' ]:
145
148
parallel = "-j %s" % self .cfg ['parallel' ]
146
149
147
- cmd = "%(prebuildopts)s %(build_cmd)s %(parallel)s %(buildopts)s" % {
150
+ cmd = "%(prebuildopts)s %(build_cmd)s -v %(parallel)s %(buildopts)s" % {
148
151
'buildopts' : self .cfg ['buildopts' ],
149
152
'build_cmd' : build_cmd ,
150
153
'parallel' : parallel ,
0 commit comments