SConstruct 551 B

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