summaryrefslogtreecommitdiff
path: root/task_cc.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-06-21 21:39:46 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-06-21 21:39:46 +0200
commitb25810b9668abe8f7cc7db24326a98c1b017966e (patch)
tree40cda88ffbf8dccfc2d2335783f608966874c58e /task_cc.cc
parentc53e622b648635539e4870fd0c9159c5d8c3be4a (diff)
Distinguish between host and target builds.
Diffstat (limited to 'task_cc.cc')
-rw-r--r--task_cc.cc29
1 files changed, 5 insertions, 24 deletions
diff --git a/task_cc.cc b/task_cc.cc
index 27b2176..845ad0e 100644
--- a/task_cc.cc
+++ b/task_cc.cc
@@ -105,11 +105,11 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
target_type = TargetType::Object;
if(sourceFile.extension().string() == ".c")
{
- _language = Language::C;
+ source_language = Language::C;
}
else
{
- _language = Language::Cpp;
+ source_language = Language::Cpp;
}
}
@@ -255,7 +255,7 @@ std::string TaskCC::toJSON() const
std::vector<std::string> TaskCC::flags() const
{
- switch(language())
+ switch(sourceLanguage())
{
case Language::C:
return config.cflags;
@@ -270,33 +270,14 @@ std::vector<std::string> TaskCC::flags() const
std::string TaskCC::flagsString() const
{
- std::string flagsStr;
+ std::string flagsStr = compiler();
for(const auto& flag : flags())
{
- if(!flagsStr.empty())
- {
- flagsStr += " ";
- }
- flagsStr += flag;
+ flagsStr += " " + flag;
}
return flagsStr;
}
-std::string TaskCC::compiler() const
-{
- switch(language())
- {
- 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;
- }
-}
-
std::vector<std::string> TaskCC::getCompilerArgs() const
{
auto compiler_flags = flags();