13
0
livetrax/libs/hidapi/wscript

57 lines
2.0 KiB
Plaintext
Raw Normal View History

2016-10-23 16:53:10 -04:00
#!/usr/bin/env python
from waflib.extras import autowaf as autowaf
import re
import sys
HIDAPI_VERSION = '0.8.0'
def options(opt):
pass
2016-10-23 16:53:10 -04:00
def configure(conf):
if conf.is_defined('USE_EXTERNAL_LIBS'):
autowaf.check_pkg(conf, 'hidapi-hidraw', uselib_store='HIDAPI', mandatory=False)
else:
if conf.env['build_target'] == 'mingw':
conf.check (compiler='cxx', lib='setupapi', mandatory=True, uselib_store='SETUPAPI')
2016-10-27 09:57:47 -04:00
conf.define ('HAVE_HIDAPI', 1)
elif sys.platform == 'darwin':
conf.define ('HAVE_HIDAPI', 1)
2016-10-23 16:53:10 -04:00
elif re.search ("linux", sys.platform) != None:
autowaf.check_pkg(conf, 'libudev', uselib_store='UDEV', mandatory=False)
if conf.is_defined('HAVE_UDEV'):
conf.define ('HAVE_HIDAPI', 1)
2016-10-23 16:53:10 -04:00
else:
2016-10-27 09:57:47 -04:00
print ("hidapi is not yet available for the given system")
2016-10-23 16:53:10 -04:00
def build(bld):
if bld.is_defined('USE_EXTERNAL_LIBS'):
return
2016-10-27 09:57:47 -04:00
if not bld.is_defined('HAVE_HIDAPI'):
2016-10-23 16:53:10 -04:00
return
# Host Library
obj = bld(features = 'c cstlib')
autowaf.ensure_visible_symbols (obj, False)
obj.export_includes = ['hidapi']
obj.includes = ['hidapi']
obj.name = 'hidapi'
obj.target = 'hidapi'
obj.vnum = HIDAPI_VERSION
obj.install_path = bld.env['LIBDIR']
if bld.env['build_target'] == 'mingw':
obj.source = 'windows/hid.c'
obj.linkflags = [ '-lsetupapi', '-mwindows' ]
obj.uselib = 'SETUPAPI'
else:
obj.cflags += [ bld.env['compiler_flags_dict']['pic'] ]
2016-10-23 16:53:10 -04:00
if sys.platform == 'darwin':
obj.source = 'mac/hid.c'
obj.framework = [ 'IOKit', 'CoreFoundation' ]
else:
2024-09-03 13:34:44 -04:00
# with '-strict' this needs "-std=gnu99" to compile w/o warnings
2016-10-23 16:53:10 -04:00
obj.source = 'linux/hid.c'
if re.search ("linux", sys.platform) != None:
obj.uselib = 'UDEV'