Skip to content

Commit

Permalink
v.builder: add -DNDEBUG for non debug -prod builds (affects sokol per…
Browse files Browse the repository at this point in the history
…formance)
  • Loading branch information
spytheman committed Aug 24, 2020
1 parent 3efa670 commit 995a5fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vlib/v/builder/cc.v
Expand Up @@ -274,6 +274,12 @@ fn (mut v Builder) cc() {
if v.pref.is_prod {
args << optimization_options
}
if v.pref.is_prod && !debug_mode {
// sokol and other C libraries that use asserts
// have much better performance when NDEBUG is defined
// See also http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
args << '-DNDEBUG'
}
if debug_mode && os.user_os() != 'windows' {
linker_flags << ' -rdynamic ' // needed for nicer symbolic backtraces
}
Expand Down

0 comments on commit 995a5fe

Please sign in to comment.