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_so.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_so.cc')
-rw-r--r-- | src/task_so.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/task_so.cc b/src/task_so.cc index 863b80a..ce6e868 100644 --- a/src/task_so.cc +++ b/src/task_so.cc @@ -14,7 +14,8 @@ namespace { std::string readFile(const std::string &fileName) { - std::ifstream ifs(fileName.c_str(), std::ios::in | std::ios::binary | std::ios::ate); + std::ifstream ifs(fileName.c_str(), + std::ios::in | std::ios::binary | std::ios::ate); std::ifstream::pos_type fileSize = ifs.tellg(); ifs.seekg(0, std::ios::beg); @@ -29,13 +30,17 @@ std::string readFile(const std::string &fileName) TaskSO::TaskSO(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) { - 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; @@ -50,7 +55,7 @@ TaskSO::TaskSO(const BuildConfiguration& config, depFiles.push_back(depFile); } - flagsFile = settings.builddir / targetFile.stem(); + flagsFile = base / targetFile.stem(); flagsFile += ".flags"; target_type = TargetType::DynamicLibrary; @@ -58,6 +63,7 @@ TaskSO::TaskSO(const BuildConfiguration& config, for(const auto& source : config.sources) { std::filesystem::path sourceFile(source.file); + // TODO: Use task languages instead if(sourceFile.extension().string() != ".c") { source_language = Language::Cpp; |