diff options
Diffstat (limited to 'src/task_cc.cc')
-rw-r--r-- | src/task_cc.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/task_cc.cc b/src/task_cc.cc index c4343b6..e9ef590 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -24,7 +24,6 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, sourceFile /= source.file; std::filesystem::path base = sourceFile.parent_path(); - std::filesystem::create_directories(std::filesystem::path(settings.builddir) / base); base /= cleanUp(config.target); base += "-"; @@ -56,14 +55,17 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, if(source.output.empty()) { _targetFile = base; - _targetFile += ".o"; + _targetFile += ".obj"; } else { _targetFile = source.output; } + + std::filesystem::create_directories(targetFile().parent_path()); + depsFile = targetFile().parent_path() / targetFile().stem(); - depsFile += ".d"; + depsFile += ".deps"; flagsFile = targetFile().parent_path() / targetFile().stem(); flagsFile += ".flags"; } @@ -185,7 +187,8 @@ int TaskCC::runInner() targetFile().lexically_normal().string() << "\n"; } - return execute(compiler(), args, settings.verbose > 0); + const auto& cfg = configuration(); + return execute(compiler(), args, cfg.env, settings.verbose > 0); } int TaskCC::clean() @@ -285,8 +288,26 @@ std::vector<std::string> TaskCC::getCompilerArgs() const auto compiler_flags = flags(); + // cl.exe (compiler - gcc/g++) + // https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically?view=msvc-170 + + // /c Compiles without linking. + // /Fo Object File Name (or path if .cc basename is re-used) + // /F Output-File + // /Fe (Name EXE File) + // /sourceDependencies <file> json file with dependenciy tree + // /I<dir> include path + // /LD Creates a dynamic-link library. + // /link <option> Passes the specified option to LINK. + + // link.exe (exe and dll linker - ld) + // https://docs.microsoft.com/en-us/cpp/build/reference/linker-options?view=msvc-170 + + // lib.exe (lib linker - ar) + // https://docs.microsoft.com/en-us/cpp/build/reference/overview-of-lib?view=msvc-170 std::vector<std::string> args; - append(args, getOption(tool_chain, opt::generate_dep_tree)); + append(args, getOption(tool_chain, opt::generate_dep_tree, depsFile.string())); +// args.push_back("-MMD"); // https://github.com/ninja-build/ninja/issues/1806 if(std::filesystem::path(config.target).extension() == ".so") { |