1 #include "AutoGenerated.inc"
2 #include "llvm/System/Path.h"
5 extern char *ProgramName;
8 // Returns the platform specific directory separator via #ifdefs.
9 static std::string GetDirSeparator(void) {
14 std::string GetBinDir (void) {
15 // Construct a Path object from the program name.
16 llvm::sys::Path ProgramFullName(llvmc::ProgramName,
17 strlen(llvmc::ProgramName));
19 // Get the dir name for the program. It's last component should be 'bin'.
20 std::string BinDir = ProgramFullName.getDirname();
22 return BinDir + GetDirSeparator();
25 std::string GetInstallDir (void) {
26 llvm::sys::Path BinDirPath = llvm::sys::Path(GetBinDir());
28 // Go one more level up to get the install dir.
29 std::string InstallDir = BinDirPath.getDirname();
31 return InstallDir + GetDirSeparator();
34 std::string GetStdHeadersDir (void) {
35 return GetInstallDir() + "include";
38 std::string GetStdAsmHeadersDir (void) {
39 return GetInstallDir() + "inc";
41 std::string GetStdLinkerScriptsDir (void) {
42 return GetInstallDir() + "lkr";
45 std::string GetStdLibsDir (void) {
46 return GetInstallDir() + "lib";