Skip to content

Commit

Permalink
dpu: makes GetUpmemSdkPath more reliable & use sysroot if specified
Browse files Browse the repository at this point in the history
Fix #3
  • Loading branch information
Romaric JODIN authored and jchauzi committed Aug 5, 2019
1 parent ed14237 commit 994b366
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions clang/lib/Driver/ToolChains/DPURTE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "CommonArgs.h"
#include "InputInfo.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "llvm/Option/ArgList.h"
Expand Down Expand Up @@ -38,14 +39,16 @@ char *DPURTE::GetUpmemSdkPath(const char *Path) {
asprintf(&result, "%s%s", PathToSDK, Path);
return result;
}
const std::string SysRoot(getDriver().SysRoot);
const std::string InstalledDir(getDriver().getInstalledDir());
const std::string UpmemDir(InstalledDir + "/../share/upmem");
if (getVFS().exists(UpmemDir)) {
if (!SysRoot.empty()) {
PathToSDK = strdup(SysRoot.c_str());
} else if (getVFS().exists(UpmemDir)) {
PathToSDK = strdup((InstalledDir + "/../..").c_str());
asprintf(&result, "%s%s", PathToSDK, Path);
return result;
} else {
PathToSDK = strdup(Path);
}
PathToSDK = strdup(getenv("UPMEM_HOME"));
asprintf(&result, "%s%s", PathToSDK, Path);
return result;
}
Expand Down

0 comments on commit 994b366

Please sign in to comment.