builder: fix msvc build thirdparty obj file from .cpp (fix #22772) (#22789)

This commit is contained in:
Felipe Pena 2024-11-08 07:35:14 -03:00 committed by GitHub
parent 7f497b660c
commit 43d9cd6e90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -226,7 +226,6 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
skip_files << 'examples/coroutines/coroutines_bench.v'
$if msvc {
skip_files << 'vlib/v/tests/consts/const_comptime_eval_before_vinit_test.v' // _constructor used
skip_files << 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v'
}
$if solaris {
skip_files << 'examples/pico/pico.v'

View File

@ -401,7 +401,11 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(mod string, path string,
}
println('${obj_path} not found, building it (with msvc)...')
flush_stdout()
cfile := '${path_without_o_postfix}.c'
cfile := if os.exists('${path_without_o_postfix}.c') {
'${path_without_o_postfix}.c'
} else {
'${path_without_o_postfix}.cpp'
}
flags := msvc_string_flags(moduleflags)
inc_dirs := flags.inc_paths.join(' ')
defines := flags.defines.join(' ')