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

compiler: move msvc compiler to -cc flag instead of -os (#2338)

* move msvc to -cc flag instead of -os

* undo unrelated change

* do first build without msvc

* remvove flags temp

* fix comment
This commit is contained in:
joe-conigliaro
2019-10-14 16:41:46 +11:00
committed by GitHub
parent 093d8a2b00
commit 9a2b8a0814
12 changed files with 37 additions and 36 deletions

View File

@ -48,7 +48,7 @@ fn (v mut V) cc() {
}
}
$if windows {
if v.os == .msvc {
if v.pref.ccompiler == 'msvc' {
v.cc_msvc()
return
}
@ -119,7 +119,7 @@ fn (v mut V) cc() {
a << ' -rdynamic ' // needed for nicer symbolic backtraces
}
if v.os != .msvc && v.os != .freebsd {
if v.pref.ccompiler != 'msvc' && v.os != .freebsd {
a << '-Werror=implicit-function-declaration'
}
@ -314,7 +314,11 @@ fn (c mut V) cc_windows_cross() {
mut args := '-o $c.out_name -w -L. '
cflags := c.get_os_cflags()
// -I flags
args += cflags.c_options_before_target()
args += if c.pref.ccompiler == 'msvc' {
cflags.c_options_before_target_msvc()
} else {
cflags.c_options_before_target()
}
mut libs := ''
if c.pref.build_mode == .default_mode {
libs = '"$v_modules_path/vlib/builtin.o"'
@ -327,7 +331,11 @@ fn (c mut V) cc_windows_cross() {
}
}
args += ' $c.out_name_c '
args += cflags.c_options_after_target()
args += if c.pref.ccompiler == 'msvc' {
cflags.c_options_after_target_msvc()
} else {
cflags.c_options_after_target()
}
println('Cross compiling for Windows...')
winroot := '$v_modules_path/winroot'
if !os.dir_exists(winroot) {
@ -372,7 +380,7 @@ fn (c &V) build_thirdparty_obj_files() {
for flag in c.get_os_cflags() {
if flag.value.ends_with('.o') {
rest_of_module_flags := c.get_rest_of_module_cflags( flag )
if c.os == .msvc {
if c.pref.ccompiler == 'msvc' {
build_thirdparty_obj_file_with_msvc(flag.value, rest_of_module_flags)
}
else {