summaryrefslogtreecommitdiff
path: root/src/task_ar.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-09-27 21:32:17 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-09-27 21:32:17 +0200
commite73ee708292aac55070701ff0157db4eab6c06f4 (patch)
treec377bc83c6975e5a75b4445afda43407d720e904 /src/task_ar.cc
parentf30d40ec44e7bb4dda5cdd75e9761d67288af4a7 (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_ar.cc')
-rw-r--r--src/task_ar.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/task_ar.cc b/src/task_ar.cc
index d767912..84cda1b 100644
--- a/src/task_ar.cc
+++ b/src/task_ar.cc
@@ -30,13 +30,17 @@ std::string readFile(const std::string &fileName)
TaskAR::TaskAR(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;
@@ -51,7 +55,7 @@ TaskAR::TaskAR(const BuildConfiguration& config,
depFiles.push_back(depFile);
}
- flagsFile = settings.builddir / targetFile.stem();
+ flagsFile = base / targetFile.stem();
flagsFile += ".flags";
target_type = TargetType::StaticLibrary;
@@ -59,6 +63,7 @@ TaskAR::TaskAR(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;