Added the command line switch -foc-compiler-path to allow for setting

the compiler's path without having to look at PATH environment variable
This commit is contained in:
Pedro Navarro 2017-05-09 15:19:47 -07:00
parent 474f359d2f
commit 773af0e75c
2 changed files with 14 additions and 3 deletions

View File

@ -167,6 +167,11 @@ bool usegcclibstdcxx(Target &target, const char *, const char *, char **) {
return true; return true;
} }
bool compilerpath(Target &target, const char *, const char *path, char **) {
target.compilerpath = path;
return true;
}
bool runprog(Target &target, const char *, const char *progname, char **cargs) { bool runprog(Target &target, const char *, const char *progname, char **cargs) {
auto *prog = program::getprog(progname); auto *prog = program::getprog(progname);
@ -258,6 +263,7 @@ constexpr struct Opt {
{"-icxx-isystem", checkincludepath, true, true}, {"-icxx-isystem", checkincludepath, true, true},
{"-cxx-isystem", checkincludepath, true, true}, {"-cxx-isystem", checkincludepath, true, true},
{"-I", checkincludepath, true, true}, {"-I", checkincludepath, true, true},
{"-foc-compiler-path", compilerpath, true, false, "="} // sets a custom path for the compiler
}; };
bool parse(int argc, char **argv, Target &target) { bool parse(int argc, char **argv, Target &target) {

View File

@ -288,6 +288,10 @@ void Target::setCompilerPath() {
compilerexecname = getTriple(); compilerexecname = getTriple();
compilerexecname += "-"; compilerexecname += "-";
compilerexecname += compilername; compilerexecname += compilername;
} else {
if (!compilerpath.empty()) {
compilerpath += "/";
compilerpath += compilername;
} else { } else {
if (!realPath(compilername.c_str(), compilerpath, ignoreCCACHE)) if (!realPath(compilername.c_str(), compilerpath, ignoreCCACHE))
compilerpath = compilername; compilerpath = compilername;
@ -295,6 +299,7 @@ void Target::setCompilerPath() {
compilerexecname += compilername; compilerexecname += compilername;
} }
} }
}
bool Target::findClangIntrinsicHeaders(std::string &path) { bool Target::findClangIntrinsicHeaders(std::string &path) {
static std::stringstream dir; static std::stringstream dir;