# -*- Python -*- import sys; import os; hidapi_home='../hidapi' cflags=["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-Wall", "-fPIC" ] includes=[ hidapi_home + "/hidapi" ] def set_options(opt): opt.tool_options("compiler_cxx") opt.tool_options("compiler_cc") def configure(conf): conf.check_tool("compiler_cxx") conf.check_tool("node_addon") conf.check_tool("compiler_cc") if sys.platform == 'darwin': conf.env.append_value('LINKFLAGS', ['Release/libhidapi.a', '-framework', 'IOKit', '-framework', 'CoreFoundation']) else: conf.env.append_value('LINKFLAGS', ['Release/libhidapi.a', '-ludev' ]) def build(bld): bld.add_group("hidapi") hidapi = bld.new_task_gen("cc", "staticlib") hidapi.includes = includes hidapi.cflags = cflags if sys.platform == 'darwin': hidapi.source = "../hidapi/mac/hid.c" else: hidapi.source = "../hidapi/linux/hid.c" hidapi.target = "hidapi" bld.add_group("adapter") adapter = bld.new_task_gen("cxx", "shlib", "node_addon", use = ['hidapi']) adapter.includes = includes adapter.cxxflags = cflags adapter.target = "HID" adapter.source = "HID.cc"