builder: improve support for -g in cross compilation to windows

pull/7204/head
Delyan Angelov 2020-12-07 23:38:02 +02:00
parent 63557d0d02
commit 3386526610
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 10 additions and 3 deletions

View File

@ -701,17 +701,24 @@ fn (mut c Builder) cc_windows_cross() {
if !c.pref.out_name.ends_with('.exe') {
c.pref.out_name += '.exe'
}
mut args := '-o $c.pref.out_name -w -L. '
mut args := ''
args += ' $c.pref.cflags '
args += ' -o $c.pref.out_name -w -L. '
//
cflags := c.get_os_cflags()
// -I flags
args += if c.pref.ccompiler == 'msvc' { cflags.c_options_before_target_msvc() } else { cflags.c_options_before_target() }
mut optimization_options := ''
mut debug_options := ''
if c.pref.is_prod {
optimization_options = if c.pref.ccompiler == 'msvc' { '' } else { ' -O3 -fno-strict-aliasing -flto ' }
if c.pref.ccompiler != 'msvc' {
optimization_options = ' -O3 -fno-strict-aliasing -flto '
}
}
if c.pref.is_debug {
debug_options = if c.pref.ccompiler == 'msvc' { '' } else { ' -g3 -no-pie ' }
if c.pref.ccompiler != 'msvc' {
debug_options = ' -O0 -g -gdwarf-2 '
}
}
mut libs := ''
if false && c.pref.build_mode == .default_mode {