49 lines
1.2 KiB
C++

#include "AutoGenerated.inc"
#include "llvm/System/Path.h"
namespace llvmc {
extern char *ProgramName;
}
// Returns the platform specific directory separator via #ifdefs.
static std::string GetDirSeparator(void) {
return "/";
}
namespace hooks {
std::string GetBinDir (void) {
// Construct a Path object from the program name.
llvm::sys::Path ProgramFullName(llvmc::ProgramName,
strlen(llvmc::ProgramName));
// Get the dir name for the program. It's last component should be 'bin'.
std::string BinDir = ProgramFullName.getDirname();
return BinDir + GetDirSeparator();
}
std::string GetInstallDir (void) {
llvm::sys::Path BinDirPath = llvm::sys::Path(GetBinDir());
// Go one more level up to get the install dir.
std::string InstallDir = BinDirPath.getDirname();
return InstallDir + GetDirSeparator();
}
std::string GetStdHeadersDir (void) {
return GetInstallDir() + "include";
}
std::string GetStdAsmHeadersDir (void) {
return GetInstallDir() + "inc";
}
std::string GetStdLinkerScriptsDir (void) {
return GetInstallDir() + "lkr";
}
std::string GetStdLibsDir (void) {
return GetInstallDir() + "lib";
}
}