diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-09-27 21:32:17 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-09-27 21:32:17 +0200 |
commit | e73ee708292aac55070701ff0157db4eab6c06f4 (patch) | |
tree | c377bc83c6975e5a75b4445afda43407d720e904 /src/task_ld.cc | |
parent | f30d40ec44e7bb4dda5cdd75e9761d67288af4a7 (diff) |
Add folder hierarchy in build folder corresponding to that of the source folders and store build-files in corresponding locations.
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r-- | src/task_ld.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc index 7710bb0..10b8bce 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -29,7 +29,8 @@ std::string readFile(const std::string &fileName) TaskLD::TaskLD(const BuildConfiguration& config, const Settings& settings, const std::string& target, - const std::vector<std::string>& objects) + const std::vector<std::string>& objects, + const std::string& sourcePath) : Task(config) , config(config) , settings(settings) @@ -40,8 +41,11 @@ TaskLD::TaskLD(const BuildConfiguration& config, target_type = TargetType::Executable; } - targetFile = settings.builddir; - targetFile /= target; + std::filesystem::path base = settings.builddir; + base /= sourcePath; + std::filesystem::create_directories(base); + + targetFile = base / target; for(const auto& object : objects) { std::filesystem::path objectFile = object; @@ -56,7 +60,7 @@ TaskLD::TaskLD(const BuildConfiguration& config, depFiles.push_back(depFile); } - flagsFile = settings.builddir / targetFile.stem(); + flagsFile = base / targetFile.stem(); flagsFile += ".flags"; source_language = Language::C; |