summaryrefslogtreecommitdiff
path: root/task_cc.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-06-20 20:21:58 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-06-20 20:21:58 +0200
commitc53e622b648635539e4870fd0c9159c5d8c3be4a (patch)
treea154de97d62e2aad99ccb5498ca7c297ee93623e /task_cc.cc
parent4bc1ac3fe2fe3ae96ba0e5aa4d19fa4885a16c83 (diff)
Introduction of configuration generation for controlling tool-chain.
Diffstat (limited to 'task_cc.cc')
-rw-r--r--task_cc.cc34
1 files changed, 28 insertions, 6 deletions
diff --git a/task_cc.cc b/task_cc.cc
index 6c7e3b7..27b2176 100644
--- a/task_cc.cc
+++ b/task_cc.cc
@@ -85,7 +85,7 @@ std::vector<std::string> readDeps(const std::string& depFile)
TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
const std::string& sourceDir, const std::string& source)
- : Task({})
+ : Task(config)
, config(config)
, settings(settings)
, sourceDir(sourceDir)
@@ -101,6 +101,16 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
flagsFile = settings.builddir / sourceFile.stem();
flagsFile += ".flags";
+
+ target_type = TargetType::Object;
+ if(sourceFile.extension().string() == ".c")
+ {
+ _language = Language::C;
+ }
+ else
+ {
+ _language = Language::Cpp;
+ }
}
bool TaskCC::dirtyInner()
@@ -245,11 +255,17 @@ std::string TaskCC::toJSON() const
std::vector<std::string> TaskCC::flags() const
{
- if(std::string(sourceFile.extension()) == ".c")
+ switch(language())
{
+ case Language::C:
return config.cflags;
+ case Language::Cpp:
+ return config.cxxflags;
+ default:
+ std::cerr << "Unknown CC target type\n";
+ exit(1);
+ break;
}
- return config.cxxflags;
}
std::string TaskCC::flagsString() const
@@ -268,11 +284,17 @@ std::string TaskCC::flagsString() const
std::string TaskCC::compiler() const
{
- if(std::string(sourceFile.extension()) == ".c")
+ switch(language())
{
- return "/usr/bin/gcc";
+ case Language::C:
+ return getConfiguration("host-cc");
+ case Language::Cpp:
+ return getConfiguration("host-cpp");
+ default:
+ std::cerr << "Unknown CC target type\n";
+ exit(1);
+ break;
}
- return "/usr/bin/g++";
}
std::vector<std::string> TaskCC::getCompilerArgs() const