Skip to content

Commit

Permalink
Fixed gyp building on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshartig committed May 6, 2012
1 parent 6df119e commit 41410a3
Showing 1 changed file with 48 additions and 10 deletions.
58 changes: 48 additions & 10 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
{
'variables': {
'driver%': 'libusb'
},
'targets': [
{
'target_name': 'hidapi',
'type': 'static_library',
'target_arch': 'ia32',
'conditions': [
[ 'OS=="mac"', {
'sources': [ 'hidapi/mac/hid.c' ],
'include_dirs+': [
'/usr/include/libusb-1.0/'
],
]
}],
[ 'OS=="linux"', {
'sources': [ 'hidapi/linux/hid-libusb.c' ],
'include_dirs+': [
'/usr/include/libusb-1.0/'
],
'conditions': [
[ 'driver=="libusb"', {
'sources': [ 'hidapi/linux/hid-libusb.c' ],
'include_dirs+': [
'/usr/include/libusb-1.0/'
]
}],
[ 'driver=="hidraw"', {
'sources': [ 'hidapi/linux/hid.c' ]
}]
]
}],
[ 'OS=="win"', {
'sources': [ 'hidapi/windows/hid.c' ],
Expand All @@ -40,29 +49,58 @@
'_LARGEFILE_SOURCE',
'_FILE_OFFSET_BITS=64',
],
'cflags': ['-g', '-Wall', '-fPIC']
'cflags': ['-g'],
'cflags!': [
'-ansi'
]
},
{
'target_name': 'HID',
'target_arch': 'ia32',
'sources': [ 'src/HID.cc' ],
'dependencies': ['hidapi'],
'defines': [
'_LARGEFILE_SOURCE',
'_FILE_OFFSET_BITS=64',
],
'conditions': [
[ 'OS=="mac"', {
'ldflags': [
'-framework',
'IOKit',
'-framework',
'CoreFoundation'
]
}],
[ 'OS=="linux"', {
'conditions': [
[ 'driver=="libusb"', {
'ldflags': [
'-lusb-1.0'
]
}],
[ 'driver=="hidraw"', {
'ldflags': [
'-ludev',
'-lusb-1.0'
]
}]
],
}],
[ 'OS=="win"', {
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'setupapi.lib',
'setupapi.lib'
]
}
}
}]
],
'cflags': ['-g', '-Wall', '-fPIC']
'cflags': ['-g'],
'cflags!': [
'-ansi'
],
'cflags_cc!': [ '-fno-exceptions' ]
}
]
}

0 comments on commit 41410a3

Please sign in to comment.