wscript 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # -*- Python -*-
  2. import sys;
  3. import os;
  4. hidapi_home='../hidapi'
  5. cflags=["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-Wall", "-fPIC" ]
  6. includes=[ hidapi_home + "/hidapi" ]
  7. def set_options(opt):
  8. opt.tool_options("compiler_cxx")
  9. opt.tool_options("compiler_cc")
  10. def configure(conf):
  11. conf.check_tool("compiler_cxx")
  12. conf.check_tool("node_addon")
  13. conf.check_tool("compiler_cc")
  14. if sys.platform == 'darwin':
  15. conf.env.append_value('LINKFLAGS', ['Release/libhidapi.a', '-framework', 'IOKit', '-framework', 'CoreFoundation'])
  16. else:
  17. conf.env.append_value('LINKFLAGS', ['Release/libhidapi.a', '-ludev' ])
  18. def build(bld):
  19. bld.add_group("hidapi")
  20. hidapi = bld.new_task_gen("cc", "staticlib")
  21. hidapi.includes = includes
  22. hidapi.cflags = cflags
  23. if sys.platform == 'darwin':
  24. hidapi.source = "../hidapi/mac/hid.c"
  25. else:
  26. hidapi.source = "../hidapi/linux/hid.c"
  27. hidapi.target = "hidapi"
  28. bld.add_group("adapter")
  29. adapter = bld.new_task_gen("cxx", "shlib", "node_addon", use = ['hidapi'])
  30. adapter.includes = includes
  31. adapter.cxxflags = cflags
  32. adapter.target = "HID"
  33. adapter.source = "HID.cc"