mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: fix -usecache for programs using thirdparty C libs
This commit is contained in:
parent
9f31829e0c
commit
8398e2f448
@ -5,10 +5,10 @@ import term
|
||||
import time
|
||||
|
||||
const (
|
||||
vexe = os.getenv('VEXE')
|
||||
vroot = os.dir(vexe)
|
||||
vexe = os.getenv('VEXE')
|
||||
vroot = os.dir(vexe)
|
||||
args_string = os.args[1..].join(' ')
|
||||
vargs = args_string.all_before('test-all')
|
||||
vargs = args_string.all_before('test-all')
|
||||
)
|
||||
|
||||
fn main() {
|
||||
@ -49,6 +49,14 @@ mut:
|
||||
|
||||
fn get_all_commands() []Command {
|
||||
mut res := []Command{}
|
||||
res << Command{
|
||||
line: '$vexe examples/hello_world.v'
|
||||
okmsg: 'V can compile hello world.'
|
||||
}
|
||||
res << Command{
|
||||
line: '$vexe -o vtmp cmd/v'
|
||||
okmsg: 'V can compile itself.'
|
||||
}
|
||||
res << Command{
|
||||
line: '$vexe $vargs -progress test-cleancode'
|
||||
okmsg: 'All important .v files are invariant when processed with `v fmt`'
|
||||
@ -78,6 +86,13 @@ fn get_all_commands() []Command {
|
||||
line: '$vexe install nedpals.args'
|
||||
okmsg: '`v install` works.'
|
||||
}
|
||||
// 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:
|
||||
res << Command{
|
||||
line: '$vexe -usecache examples/tetris/tetris.v'
|
||||
okmsg: '`v -usecache` works.'
|
||||
}
|
||||
$if macos {
|
||||
res << Command{
|
||||
line: '$vexe -o v.c cmd/v && cc -Werror v.c && rm -rf v.c'
|
||||
|
@ -174,6 +174,7 @@ mut:
|
||||
//
|
||||
args []string // ordinary C options like `-O2`
|
||||
wargs []string // for `-Wxyz` *exclusively*
|
||||
pre_args []string // options that should go before .o_args
|
||||
o_args []string // for `-o target`
|
||||
source_args []string // for `x.tmp.c`
|
||||
post_args []string // options that should go after .o_args
|
||||
@ -321,8 +322,8 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
|
||||
cflags := v.get_os_cflags()
|
||||
ccoptions.o_args << cflags.c_options_only_object_files()
|
||||
defines, others, libs := cflags.defines_others_libs()
|
||||
ccoptions.args << defines
|
||||
ccoptions.args << others
|
||||
ccoptions.pre_args << defines
|
||||
ccoptions.pre_args << others
|
||||
ccoptions.linker_flags << libs
|
||||
// TODO: why is this duplicated from above?
|
||||
if v.pref.use_cache && v.pref.build_mode != .build_module {
|
||||
@ -382,6 +383,7 @@ fn (ccoptions CcompilerOptions) all_args() []string {
|
||||
all << ccoptions.env_cflags
|
||||
all << ccoptions.args
|
||||
all << ccoptions.o_args
|
||||
all << ccoptions.pre_args
|
||||
all << ccoptions.source_args
|
||||
all << ccoptions.post_args
|
||||
all << ccoptions.linker_flags
|
||||
@ -537,7 +539,7 @@ fn (mut v Builder) cc() {
|
||||
//
|
||||
mut libs := []string{} // builtin.o os.o http.o etc
|
||||
if v.pref.build_mode == .build_module {
|
||||
v.ccoptions.args << '-c'
|
||||
v.ccoptions.pre_args << '-c'
|
||||
} else if v.pref.use_cache {
|
||||
mut built_modules := []string{}
|
||||
builtin_obj_path := v.rebuild_cached_module(vexe, 'vlib/builtin')
|
||||
|
Loading…
Reference in New Issue
Block a user