SConstruct 560 B

123456789101112131415161718192021222324252627282930313233
  1. def ParseOptions():
  2. AddOption('--opt',
  3. dest='opt',
  4. action='store_true',
  5. default='false',
  6. help='build in opt mode, or dbg mode')
  7. ParseOptions()
  8. env = DefaultEnvironment()
  9. env.Append(LIBS=[
  10. 'gflags',
  11. 'glog',
  12. 'gtest',
  13. ])
  14. if GetOption('opt') == True:
  15. env['root'] = 'opt'
  16. env.Append(CCFLAGS='-g')
  17. env.Append(LIBS='tcmalloc_debug')
  18. else:
  19. env['root'] = 'dbg'
  20. env.Append(CCFLAGS='-O2 -g')
  21. env.Append(LIBS='tcmalloc')
  22. env.Append(CPPPATH=Dir(env['root']).abspath)
  23. Export('env')
  24. SConscript('src/SConscript', build_dir=env['root'], duplicate=0)