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

compiler: compile thirdparty object files using module specific flags

This commit is contained in:
Delyan Angelov
2019-09-23 00:51:59 +03:00
committed by Alexander Medvednikov
parent 7aaf4012e4
commit a585c8c22c
5 changed files with 211 additions and 135 deletions

View File

@ -239,7 +239,7 @@ fn (g mut CGen) add_to_main(s string) {
}
fn build_thirdparty_obj_file(path string) {
fn build_thirdparty_obj_file(path string, moduleflags []CFlag) {
obj_path := os.realpath(path)
if os.file_exists(obj_path) {
return
@ -255,7 +255,9 @@ fn build_thirdparty_obj_file(path string) {
}
cc := find_c_compiler()
cc_thirdparty_options := find_c_compiler_thirdparty_options()
cmd := '$cc $cc_thirdparty_options -c -o "$obj_path" $cfiles'
btarget := moduleflags.c_options_before_target()
atarget := moduleflags.c_options_after_target()
cmd := '$cc $cc_thirdparty_options $btarget -c -o "$obj_path" $cfiles $atarget '
res := os.exec(cmd) or {
println('failed thirdparty object build cmd: $cmd')
cerror(err)