diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-29 05:37:18 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-30 05:23:55 +0100 |
commit | abab2184ade33097f3441f8cdd95dd27c5653930 (patch) | |
tree | 4a2bd8619c8d1e7e765c36046ecf5b6a6cd2e165 /backend/ninja | |
parent | 948666962cc0a5757d147b295ab526674636fac3 (diff) |
Starting support for other languages than c/c++
Diffstat (limited to 'backend/ninja')
-rw-r--r-- | backend/ninja/Ninja.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index dda4aa4..d9b4eed 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -39,6 +39,14 @@ namespace backend return result; } + bool endsWith(const string &str, const string &endWithStr) + { + if(endWithStr.size() > str.size()) + return false; + else + return strncmp(&str[str.size() - endWithStr.size()], &endWithStr[0], endWithStr.size()) == 0; + } + Ninja::LibraryType getNinjaLibraryType(PackageType packageType) { switch(packageType) @@ -315,6 +323,9 @@ namespace backend objectNames.reserve(sourceFiles.size()); for(const string &sourceFile : sourceFiles) { + string sourceFileLanguage = "c++"; + if(endsWith(sourceFile, ".c")) + sourceFileLanguage = "c"; //string sourceFileEncoded = sourceFile; //replace(sourceFileEncoded, '/', '@'); string objectName = config.getPackageName() + "@exe/" + sourceFile + ".o"; |