wscript 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import Options
  2. from os import unlink, symlink, popen
  3. from os.path import exists
  4. srcdir = "."
  5. blddir = "build"
  6. VERSION = "0.1.0"
  7. def set_options(opt):
  8. opt.tool_options("compiler_cxx")
  9. opt.add_option( '--debug'
  10. , action='store_true'
  11. , default=False
  12. , help='Build debug variant [Default: False]'
  13. , dest='debug'
  14. )
  15. def configure(conf):
  16. conf.check_tool("compiler_cxx")
  17. conf.check_tool("node_addon")
  18. conf.env.append_value('CXXFLAGS', ['-O3', '-funroll-loops'])
  19. # conf.env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
  20. # conf.check(lib='node', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='NODE')
  21. def build(bld):
  22. obj = bld.new_task_gen("cxx", "shlib", "node_addon")
  23. obj.target = "bson"
  24. obj.source = ["bson.cc"]
  25. # obj.uselib = "NODE"
  26. def shutdown():
  27. # HACK to get compress.node out of build directory.
  28. # better way to do this?
  29. if Options.commands['clean']:
  30. if exists('bson.node'): unlink('bson.node')
  31. else:
  32. if exists('build/default/bson.node') and not exists('bson.node'):
  33. symlink('build/default/bson.node', 'bson.node')