v.pref: fix `./v -usecache -cg run examples/hello_world.v`

pull/11187/head
Delyan Angelov 2021-08-15 08:35:26 +03:00
parent 40efe4f620
commit 3ffa6c1664
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 11 additions and 4 deletions

View File

@ -129,6 +129,11 @@ fn get_all_commands() []Command {
line: '$vexe install nedpals.args' line: '$vexe install nedpals.args'
okmsg: '`v install` works.' okmsg: '`v install` works.'
} }
res << Command{
line: '$vexe -usecache -cg examples/hello_world.v'
okmsg: '`v -usecache -cg` works.'
rmfile: 'examples/hello_world'
}
// NB: test that a program that depends on thirdparty libraries with its // NB: test that a program that depends on thirdparty libraries with its
// own #flags (tetris depends on gg, which uses sokol) can be compiled // own #flags (tetris depends on gg, which uses sokol) can be compiled
// with -usecache: // with -usecache:

View File

@ -116,9 +116,9 @@ pub fn (mut p Preferences) fill_with_defaults() {
'$p.backend | $p.os | $p.ccompiler | $p.is_prod | $p.sanitize', '$p.backend | $p.os | $p.ccompiler | $p.is_prod | $p.sanitize',
p.cflags.trim_space(), p.cflags.trim_space(),
p.third_party_option.trim_space(), p.third_party_option.trim_space(),
'$p.compile_defines_all', p.compile_defines_all.str(),
'$p.compile_defines', p.compile_defines.str(),
'$p.lookup_path', p.lookup_path.str(),
]) ])
// eprintln('prefs.cache_manager: $p') // eprintln('prefs.cache_manager: $p')
// disable use_cache for specific cases: // disable use_cache for specific cases:

View File

@ -806,7 +806,9 @@ pub fn get_host_arch() Arch {
fn parse_define(mut prefs Preferences, define string) { fn parse_define(mut prefs Preferences, define string) {
define_parts := define.split('=') define_parts := define.split('=')
prefs.build_options << '-d $define' if !(prefs.is_debug && define == 'debug') {
prefs.build_options << '-d $define'
}
if define_parts.len == 1 { if define_parts.len == 1 {
prefs.compile_defines << define prefs.compile_defines << define
prefs.compile_defines_all << define prefs.compile_defines_all << define