v.builder: move filtering logic for -parallel-cc to parallel_cc.v

This commit is contained in:
Delyan Angelov 2024-12-19 14:19:57 +02:00
parent 5573667552
commit 570f84933c
2 changed files with 3 additions and 4 deletions

View File

@ -84,6 +84,7 @@ fn parallel_cc(mut b builder.Builder, result c.GenOutput) {
} }
scompile_args := compile_args.join(' ') scompile_args := compile_args.join(' ')
slinker_args := linker_args.join(' ') slinker_args := linker_args.join(' ')
scompile_args_for_linker := compile_args.filter(it != '-x objective-c').join(' ')
mut o_postfixes := ['0', 'x'] mut o_postfixes := ['0', 'x']
mut cmds := []string{} mut cmds := []string{}
@ -100,7 +101,7 @@ fn parallel_cc(mut b builder.Builder, result c.GenOutput) {
eprint_time(sw, 'C compilation on ${util.nr_jobs} thread(s), processing ${cmds.len} commands') eprint_time(sw, 'C compilation on ${util.nr_jobs} thread(s), processing ${cmds.len} commands')
obj_files := fnames.map(it.replace('.c', '.o')).join(' ') obj_files := fnames.map(it.replace('.c', '.o')).join(' ')
link_cmd := '${cc} ${scompile_args} -o ${os.quoted_path(b.pref.out_name)} ${tmp_dir}/out_0.o ${obj_files} ${tmp_dir}/out_x.o ${slinker_args} ${cc_ldflags}' link_cmd := '${cc} ${scompile_args_for_linker} -o ${os.quoted_path(b.pref.out_name)} ${tmp_dir}/out_0.o ${obj_files} ${tmp_dir}/out_x.o ${slinker_args} ${cc_ldflags}'
sw_link := time.new_stopwatch() sw_link := time.new_stopwatch()
link_res := os.execute(link_cmd) link_res := os.execute(link_cmd)
eprint_result_time(sw_link, 'link_cmd', link_cmd, link_res) eprint_result_time(sw_link, 'link_cmd', link_cmd, link_res)

View File

@ -371,9 +371,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
// macOS code can include objective C TODO remove once objective C is replaced with C // macOS code can include objective C TODO remove once objective C is replaced with C
if v.pref.os in [.macos, .ios] { if v.pref.os in [.macos, .ios] {
if ccoptions.cc != .tcc && !user_darwin_ppc && !v.pref.is_bare && ccompiler != 'musl-gcc' { if ccoptions.cc != .tcc && !user_darwin_ppc && !v.pref.is_bare && ccompiler != 'musl-gcc' {
if !v.pref.parallel_cc { ccoptions.source_args << '-x objective-c'
ccoptions.source_args << '-x objective-c'
}
} }
} }
// The C file we are compiling // The C file we are compiling