1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: passing -g3 adds mode debug info

This commit is contained in:
Delyan Angelov 2019-09-26 21:58:08 +03:00 committed by Alexander Medvednikov
parent 47da52b85b
commit 22d91148ca

View File

@ -70,11 +70,27 @@ fn (v mut V) cc() {
v.out_name = ModPath + v.dir + '.o' //v.out_name v.out_name = ModPath + v.dir + '.o' //v.out_name
println('Building ${v.out_name}...') println('Building ${v.out_name}...')
} }
mut debug_options := '-g'
mut optimization_options := '-O2'
if v.pref.ccompiler.contains('clang') {
if v.pref.is_debug {
debug_options = '-g -O0'
}
optimization_options = '-O3 -flto'
}
if v.pref.ccompiler.contains('gcc') {
if v.pref.is_debug {
debug_options = '-g3'
}
optimization_options = '-O3 -fno-strict-aliasing -flto'
}
if v.pref.is_prod { if v.pref.is_prod {
a << '-O2' a << optimization_options
} }
else { else {
a << '-g' a << debug_options
} }
if v.pref.is_debug && os.user_os() != 'windows'{ if v.pref.is_debug && os.user_os() != 'windows'{