From 09236a438b31c0c6f8263d624e4856833946ec5c Mon Sep 17 00:00:00 2001 From: Emily Hudson Date: Fri, 26 Jun 2020 16:16:15 +0100 Subject: [PATCH] msvc: unique names for pdb files, remove test job limit --- .gitattributes | 1 + cmd/tools/modules/testing/common.v | 8 -------- vlib/v/builder/msvc.v | 12 +++++++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.gitattributes b/.gitattributes index bea12d4b71..1dee68f1ac 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ *.v linguist-language=V text=auto eol=lf *.vv linguist-language=V text=auto eol=lf +*.bat text=auto eol=crlf diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index e2ce07c820..68d0c5d276 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -96,14 +96,6 @@ pub fn (mut ts TestSession) test() { mtx: sync.new_mutex() } pool_of_test_runners.set_shared_context(ts) - $if msvc { - // NB: MSVC can not be launched in parallel, without giving it - // the option /FS because it uses a shared PDB file, which should - // be locked, but that makes writing slower... - // See: https://docs.microsoft.com/en-us/cpp/build/reference/fs-force-synchronous-pdb-writes?view=vs-2019 - // Instead, just run tests on 1 core for now. - pool_of_test_runners.set_max_jobs(1) - } pool_of_test_runners.work_on_pointers(remaining_files.pointers()) ts.benchmark.stop() eprintln(term.h_divider('-')) diff --git a/vlib/v/builder/msvc.v b/vlib/v/builder/msvc.v index 8d23ac2879..84885f3cde 100644 --- a/vlib/v/builder/msvc.v +++ b/vlib/v/builder/msvc.v @@ -200,6 +200,7 @@ pub fn (mut v Builder) cc_msvc() { return } out_name_obj := os.real_path(v.out_name_c + '.obj') + out_name_pdb := os.real_path(v.out_name_c + '.pdb') // Default arguments // volatile:ms enables atomic volatile (gcc _Atomic) // -w: no warnings @@ -209,12 +210,17 @@ pub fn (mut v Builder) cc_msvc() { if v.pref.is_prod { a << '/O2' a << '/MD' - a << '/Zi' a << '/DNDEBUG' } else { - a << '/Zi' a << '/MDd' } + + if v.pref.is_debug { + // /Zi generates a .pdb + // /Fd sets the pdb file name (so its not just vc140 all the time) + a << ['/Zi', '/Fd"$out_name_pdb"'] + } + if v.pref.is_shared { if !v.pref.out_name.ends_with('.dll') { v.pref.out_name += '.dll' @@ -337,7 +343,7 @@ fn build_thirdparty_obj_file_with_msvc(path string, moduleflags []cflag.CFlag) { // println('cfiles: $cfiles') btarget := moduleflags.c_options_before_target_msvc() atarget := moduleflags.c_options_after_target_msvc() - cmd := '"$msvc.full_cl_exe_path" /volatile:ms /Zi /DNDEBUG $include_string /c $btarget $cfiles $atarget /Fo"$obj_path"' + cmd := '"$msvc.full_cl_exe_path" /volatile:ms /DNDEBUG $include_string /c $btarget $cfiles $atarget /Fo"$obj_path"' // NB: the quotes above ARE balanced. println('thirdparty cmd line: $cmd') res := os.exec(cmd) or {