Explorar o código

SConscript add duplicate=0

tanghai %!s(int64=15) %!d(string=hai) anos
pai
achega
62d1ffb258
Modificáronse 1 ficheiros con 11 adicións e 13 borrados
  1. 11 13
      SConstruct

+ 11 - 13
SConstruct

@@ -1,35 +1,33 @@
 
 def ParseOptions():
-	AddOption('--mode',
-		dest='mode',
-		type='string',
-		nargs=1,
-		action='store',
-		default='dbg',
-		help='build in dbg or opt mode')
+	AddOption('--opt',
+		dest='opt',
+		action='store_true',
+		default='false',
+		help='build in opt mode, or dbg mode')
 
 ParseOptions()
 
 env = DefaultEnvironment()
 
-env['mode'] = GetOption('mode')
-
-env.Append(CPPPATH=Dir(env['mode']).abspath)
-
 env.Append(LIBS=[
 	'gflags',
 	'glog',
 	'gtest',
 ])
 
-if env['mode'] == 'dbg':
+if GetOption('opt') == True:
+	env['root'] = 'opt'
 	env.Append(CCFLAGS='-g')
 	env.Append(LIBS='tcmalloc_debug')
 else:
+	env['root'] = 'dbg'
 	env.Append(CCFLAGS='-O2 -g')
 	env.Append(LIBS='tcmalloc')
 
+env.Append(CPPPATH=Dir(env['root']).abspath)
+
 Export('env')
 
-SConscript('src/SConscript', build_dir=env['mode'])
+SConscript('src/SConscript', build_dir=env['root'], duplicate=0)