summaryrefslogtreecommitdiff
path: root/src/task_cc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/task_cc.cc')
-rw-r--r--src/task_cc.cc31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/task_cc.cc b/src/task_cc.cc
index e9ef590..c4343b6 100644
--- a/src/task_cc.cc
+++ b/src/task_cc.cc
@@ -24,6 +24,7 @@ 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 += "-";
@@ -55,17 +56,14 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
if(source.output.empty())
{
_targetFile = base;
- _targetFile += ".obj";
+ _targetFile += ".o";
}
else
{
_targetFile = source.output;
}
-
- std::filesystem::create_directories(targetFile().parent_path());
-
depsFile = targetFile().parent_path() / targetFile().stem();
- depsFile += ".deps";
+ depsFile += ".d";
flagsFile = targetFile().parent_path() / targetFile().stem();
flagsFile += ".flags";
}
@@ -187,8 +185,7 @@ int TaskCC::runInner()
targetFile().lexically_normal().string() << "\n";
}
- const auto& cfg = configuration();
- return execute(compiler(), args, cfg.env, settings.verbose > 0);
+ return execute(compiler(), args, settings.verbose > 0);
}
int TaskCC::clean()
@@ -288,26 +285,8 @@ 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, depsFile.string()));
-// args.push_back("-MMD"); // https://github.com/ninja-build/ninja/issues/1806
+ append(args, getOption(tool_chain, opt::generate_dep_tree));
if(std::filesystem::path(config.target).extension() == ".so")
{