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

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

This commit is contained in:
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'
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
// own #flags (tetris depends on gg, which uses sokol) can be compiled
// 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.cflags.trim_space(),
p.third_party_option.trim_space(),
'$p.compile_defines_all',
'$p.compile_defines',
'$p.lookup_path',
p.compile_defines_all.str(),
p.compile_defines.str(),
p.lookup_path.str(),
])
// eprintln('prefs.cache_manager: $p')
// 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) {
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 {
prefs.compile_defines << define
prefs.compile_defines_all << define