diff options
Diffstat (limited to 'task_cc.cc')
-rw-r--r-- | task_cc.cc | 34 |
1 files changed, 28 insertions, 6 deletions
@@ -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 |