diff options
Diffstat (limited to 'backend/ninja')
-rw-r--r-- | backend/ninja/Ninja.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 624d1dc..9a445c2 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -724,11 +724,15 @@ namespace backend static string getCompilerCExecutable(Compiler compiler) { + char *cc = std::getenv("CC"); + if(cc) + return cc; + string result; switch(compiler) { case Compiler::GCC: - result = "cc"; + result = "ccache cc"; break; case Compiler::MINGW_W64: result = "x86_64-w64-mingw32-cc"; @@ -742,11 +746,15 @@ namespace backend static string getCompilerCppExecutable(Compiler compiler) { + char *cxx = std::getenv("CXX"); + if(cxx) + return cxx; + string result; switch(compiler) { case Compiler::GCC: - result = "c++"; + result = "ccache c++"; break; case Compiler::MINGW_W64: result = "x86_64-w64-mingw32-c++"; @@ -986,8 +994,7 @@ namespace backend case LibraryType::EXECUTABLE: { baseCompileCArgs.insert(baseCompileCArgs.end(), { - ninja::NinjaArg("ccache"), - ninja::NinjaArg(cCompilerName), + ninja::NinjaArg::createRaw(cCompilerName), ninja::NinjaArg("-c"), ninja::NinjaArg::createRaw("-fPIE -fPIC"), ninja::NinjaArg("$in"), @@ -1000,8 +1007,7 @@ namespace backend case LibraryType::DYNAMIC: { baseCompileCArgs.insert(baseCompileCArgs.end(), { - ninja::NinjaArg("ccache"), - ninja::NinjaArg(cCompilerName), + ninja::NinjaArg::createRaw(cCompilerName), ninja::NinjaArg("-c"), ninja::NinjaArg("-fPIC"), ninja::NinjaArg("$in"), @@ -1358,7 +1364,6 @@ namespace backend { string rpath = extractDynamicLibDirsFromLinkerFlags(dynamicLinkerFlags); buildExeArgs.insert(buildExeArgs.end(), { - ninja::NinjaArg::createRaw("ccache"), ninja::NinjaArg::createRaw(usesCppFiles ? cppCompilerName : cCompilerName), ninja::NinjaArg::createRaw("-o"), ninja::NinjaArg::createRaw("$out"), @@ -1580,7 +1585,6 @@ namespace backend case Compiler::GCC: { buildDynamicArgs.insert(buildDynamicArgs.end(), { - ninja::NinjaArg::createRaw("ccache"), ninja::NinjaArg::createRaw(usesCppFiles ? cppCompilerName : cCompilerName), ninja::NinjaArg::createRaw("$in"), ninja::NinjaArg::createRaw("-shared"), |