aboutsummaryrefslogtreecommitdiff
path: root/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-01 16:10:29 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-01 16:10:29 +0000
commit81d0c2abc8263b2639fe5bfd9f8f9771571bd33d (patch)
tree8512c110e56b6993c06dca8a950e4a543145daba /tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
parent75657ab707b53c35e86b14ec750ac0122c106192 (diff)
Executables will be at InstallDir/bin directory. Std header files will be at InstallDir/include, libs will be at InstallDir/lib. Define hooks for these and use them in the options for various tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp')
-rw-r--r--tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
index add8acb4a5..09fb9695e9 100644
--- a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
+++ b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
@@ -1 +1,48 @@
#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";
+}
+}