SConstruct 561 B

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