builder: cross compiling for linux, part 1

pull/4891/head
Alexander Medvednikov 2020-05-14 04:15:01 +02:00
parent c86e367b74
commit 1cb4aa7642
1 changed files with 17 additions and 22 deletions

View File

@ -248,19 +248,8 @@ fn (mut v Builder) cc() {
} }
else { else {
println('$path not found... building module $imp') println('$path not found... building module $imp')
if path.ends_with('vlib/ui.o') {
println('copying ui...')
os.cp('$vdir/thirdparty/ui/ui.o', path)or{
panic('error copying ui files')
}
os.cp('$vdir/thirdparty/ui/ui.vh', pref.default_module_path + '/vlib/ui.vh')or{
panic('error copying ui files')
}
}
else {
os.system('$vexe build module vlib${os.path_separator}$imp_path') os.system('$vexe build module vlib${os.path_separator}$imp_path')
} }
}
if path.ends_with('vlib/ui.o') { if path.ends_with('vlib/ui.o') {
a << '-framework Cocoa -framework Carbon' a << '-framework Cocoa -framework Carbon'
} }
@ -270,18 +259,12 @@ fn (mut v Builder) cc() {
if v.pref.sanitize { if v.pref.sanitize {
a << '-fsanitize=leak' a << '-fsanitize=leak'
} }
// Cross compiling linux TODO // Cross compiling linux
/* if v.pref.os == .linux {
sysroot := '/tmp/lld/linuxroot/' $if !linux {
if v.os == .linux && !linux_host { v.cc_linux_cross()
// Build file.o
a << '-c --sysroot=$sysroot -target x86_64-linux-gnu'
// Right now `out_name` can be `file`, not `file.o`
if !v.out_name.ends_with('.o') {
v.out_name = v.out_name + '.o'
} }
} }
*/
// Cross compiling windows // Cross compiling windows
// //
// Output executable name // Output executable name
@ -489,6 +472,18 @@ If you're confident that all of the above is true, please try running V with the
} }
} }
fn (mut c Builder) cc_linux_cross() {
/*
sysroot := '/tmp/lld/linuxroot/'
// Build file.o
a << '-c --sysroot=$sysroot -target x86_64-linux-gnu'
// Right now `out_name` can be `file`, not `file.o`
if !v.out_name.ends_with('.o') {
v.out_name = v.out_name + '.o'
}
*/
}
fn (mut c Builder) cc_windows_cross() { fn (mut c Builder) cc_windows_cross() {
println('Cross compiling for Windows...') println('Cross compiling for Windows...')
if !c.pref.out_name.ends_with('.exe') { if !c.pref.out_name.ends_with('.exe') {