From 7b8aaf562febeed81a1d27a6e498d63b8b4f6877 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sat, 3 Feb 2024 17:13:12 +0100 Subject: [PATCH] feat: Add support for MSVC /Tc and /Tp options Closes #1387. --- src/argprocessing.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index a61317e5f..f1a11ab3a 100644 --- a/src/argprocessing.cpp +++ b/src/argprocessing.cpp @@ -555,10 +555,19 @@ process_option_arg(const Context& ctx, return Statistic::none; } - // MSVC -Fo with no space. - if (util::starts_with(arg, "-Fo") && config.is_compiler_group_msvc()) { - args_info.output_obj = arg.substr(3); - return Statistic::none; + if (config.is_compiler_group_msvc()) { + // MSVC /Fo with no space. + if (util::starts_with(arg, "-Fo")) { + args_info.output_obj = arg.substr(3); + return Statistic::none; + } + + // MSVC /Tc and /Tp options for specifying input file. + if (arg.length() > 3 && util::starts_with(arg, "-T") + && (arg[2] == 'c' || arg[2] == 'p')) { + size_t file_index = arg[3] == ' ' ? 4 : 3; + state.input_files.emplace_back(arg.substr(file_index)); + } } // when using nvcc with separable compilation, -dc implies -c -- 2.47.2