summaryrefslogtreecommitdiff
path: root/task.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
parentc53e622b648635539e4870fd0c9159c5d8c3be4a (diff)
Distinguish between host and target builds.
Diffstat (limited to 'task.cc')
-rw-r--r--task.cc37
1 files changed, 35 insertions, 2 deletions
diff --git a/task.cc b/task.cc
index 928f95d..70d0b76 100644
--- a/task.cc
+++ b/task.cc
@@ -7,6 +7,7 @@ Task::Task(const BuildConfiguration& config,
const std::vector<std::string>& depends)
: dependsStr(depends)
, config(config)
+ , output_system(config.system)
{
}
@@ -97,7 +98,39 @@ TargetType Task::targetType() const
return target_type;
}
-Language Task::language() const
+Language Task::sourceLanguage() const
{
- return _language;
+ return source_language;
+}
+
+OutputSystem Task::outputSystem() const
+{
+ return output_system;
+}
+
+std::string Task::compiler() const
+{
+ switch(sourceLanguage())
+ {
+ case Language::C:
+ switch(outputSystem())
+ {
+ case OutputSystem::Target:
+ return getConfiguration(cfg::target_cc, "/usr/bin/gcc");
+ case OutputSystem::BuildHost:
+ return getConfiguration(cfg::host_cc, "/usr/bin/gcc");
+ }
+ case Language::Cpp:
+ switch(outputSystem())
+ {
+ case OutputSystem::Target:
+ return getConfiguration(cfg::target_cpp, "/usr/bin/g++");
+ case OutputSystem::BuildHost:
+ return getConfiguration(cfg::host_cpp, "/usr/bin/g++");
+ }
+ default:
+ std::cerr << "Unknown CC target type\n";
+ exit(1);
+ break;
+ }
}