mingw on macos

pull/3314/head
Alexander Medvednikov 2020-01-03 11:38:26 +01:00
parent 343ded18fd
commit 7c47f345be
2 changed files with 19 additions and 3 deletions

View File

@ -400,6 +400,7 @@ start:
}
fn (c mut V) cc_windows_cross() {
println('Cross compiling for Windows...')
if !c.out_name.ends_with('.exe') {
c.out_name = c.out_name + '.exe'
}
@ -408,7 +409,7 @@ fn (c mut V) cc_windows_cross() {
// -I flags
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 {
if false && c.pref.build_mode == .default_mode {
libs = '"$v_modules_path/vlib/builtin.o"'
if !os.exists(libs) {
println('`$libs` not found')
@ -419,8 +420,10 @@ fn (c mut V) cc_windows_cross() {
}
}
args += ' $c.out_name_c '
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.is_dir(winroot) {
winroot_url := 'https://github.com/vlang/v/releases/download/v0.1.10/winroot.zip'
@ -434,7 +437,17 @@ fn (c mut V) cc_windows_cross() {
obj_name = obj_name.replace('.exe', '')
obj_name = obj_name.replace('.o.o', '.o')
include := '-I $winroot/include '
cmd := 'clang -o $obj_name -w $include -m32 -c -target x86_64-win32 $v_modules_path/$c.out_name_c'
*/
mut cmd := ''
$if macos {
cmd = 'x86_64-w64-mingw32-gcc $args -municode'
}
$else {
panic('your platform is not supported yet')
}
println(cmd)
//cmd := 'clang -o $obj_name -w $include -m32 -c -target x86_64-win32 $v_modules_path/$c.out_name_c'
if c.pref.show_c_cmd {
println(cmd)
}
@ -442,6 +455,7 @@ fn (c mut V) cc_windows_cross() {
println('Cross compilation for Windows failed. Make sure you have clang installed.')
exit(1)
}
/*
if c.pref.build_mode != .build_module {
link_cmd := 'lld-link $obj_name $winroot/lib/libcmt.lib ' + '$winroot/lib/libucrt.lib $winroot/lib/kernel32.lib $winroot/lib/libvcruntime.lib ' + '$winroot/lib/uuid.lib'
if c.pref.show_c_cmd {
@ -453,6 +467,7 @@ fn (c mut V) cc_windows_cross() {
}
// os.rm(obj_name)
}
*/
println('Done!')
}

View File

@ -201,6 +201,7 @@ pub fn (v mut V) parse(file string, pass Pass) int {
}
pub fn (v mut V) compile() {
//println('compile()')
// Emily: Stop people on linux from being able to build with msvc
if os.user_os() != 'windows' && v.pref.ccompiler == 'msvc' {
verror('Cannot build with msvc on ${os.user_os()}')