aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 142927d..1bed895 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,6 +6,8 @@
6 6
7#include "viewplugger.h" 7#include "viewplugger.h"
8 8
9#include "cache.h"
10
9#include <bu/optparser.h> 11#include <bu/optparser.h>
10#include <bu/sio.h> 12#include <bu/sio.h>
11#include <sys/types.h> 13#include <sys/types.h>
@@ -24,11 +26,13 @@ public:
24 sView("default"), 26 sView("default"),
25 sAction("default"), 27 sAction("default"),
26 sConfig("default.bld"), 28 sConfig("default.bld"),
29 sCacheFile(".build_cache"),
27 bDot( false ), 30 bDot( false ),
28 bDebug( false ), 31 bDebug( false ),
29 bAutoInclude( true ), 32 bAutoInclude( true ),
30 bAstDump( false ), 33 bAstDump( false ),
31 bEnviron( true ), 34 bEnviron( true ),
35 bCache( true ),
32 iInfoLevel( 0 ) 36 iInfoLevel( 0 )
33 { 37 {
34 bool bClean = false; 38 bool bClean = false;
@@ -54,6 +58,8 @@ public:
54 "action is specified, this will modify it to run 'clean-action'."); 58 "action is specified, this will modify it to run 'clean-action'.");
55 addOption( slot(this, &Options::onChdir), 'C', "chdir", 59 addOption( slot(this, &Options::onChdir), 'C', "chdir",
56 "Change to directory before doing anything else."); 60 "Change to directory before doing anything else.");
61 addOption( sCacheFile, "cache", "Select a different cache file.");
62 addOption( bCache, "no-cache", "Disable using the cache.");
57 63
58 addHelpBanner("\nThe following options control debugging:"); 64 addHelpBanner("\nThe following options control debugging:");
59 addOption( bEnviron, "no-env", "Do not import environment variables."); 65 addOption( bEnviron, "no-env", "Do not import environment variables.");
@@ -71,6 +77,7 @@ public:
71 setOverride( "debug-ast", "true" ); 77 setOverride( "debug-ast", "true" );
72 setOverride( "info", "1" ); 78 setOverride( "info", "1" );
73 setOverride( 'c', "true" ); 79 setOverride( 'c', "true" );
80 setOverride( "no-cache", "false" );
74 81
75 addHelpOption(); 82 addHelpOption();
76 83
@@ -111,11 +118,13 @@ public:
111 Bu::FString sView; 118 Bu::FString sView;
112 Bu::FString sAction; 119 Bu::FString sAction;
113 Bu::FString sConfig; 120 Bu::FString sConfig;
121 Bu::FString sCacheFile;
114 bool bDot; 122 bool bDot;
115 bool bDebug; 123 bool bDebug;
116 bool bAutoInclude; 124 bool bAutoInclude;
117 bool bAstDump; 125 bool bAstDump;
118 bool bEnviron; 126 bool bEnviron;
127 bool bCache;
119 int iInfoLevel; 128 int iInfoLevel;
120}; 129};
121 130
@@ -155,6 +164,11 @@ int main( int argc, char *argv[] )
155 return 1; 164 return 1;
156 } 165 }
157 166
167 if( opts.bCache )
168 {
169 Cache::getInstance().bind( opts.sCacheFile );
170 }
171
158 // Load up the environment as vars. 172 // Load up the environment as vars.
159 if( opts.bEnviron ) 173 if( opts.bEnviron )
160 { 174 {