compiler: support passing -cc to specify the desired C compiler

This commit is contained in:
Delyan Angelov 2019-08-23 11:42:48 +03:00 committed by Alexander Medvednikov
parent df593870ae
commit d362f73af8
4 changed files with 35 additions and 20 deletions

View file

@ -39,7 +39,7 @@ mut:
}
fn new_cgen(out_name_c string) *CGen {
path:='.$out_name_c'
path := out_name_c
out := os.create(path) or {
println('failed to create $path')
return &CGen{}
@ -257,8 +257,9 @@ fn build_thirdparty_obj_file(flag string) {
cfiles += parent + '/' + file + ' '
}
}
cc := if os.user_os() == 'windows' { 'gcc' } else { 'cc' } // TODO clang support on Windows
res := os.exec('$cc -fPIC -c -o $obj_path $cfiles') or {
cc := find_c_compiler()
cc_thirdparty_options := find_c_compiler_thirdparty_options()
res := os.exec('$cc $cc_thirdparty_options -c -o $obj_path $cfiles') or {
panic(err)
}
println(res.output)