From d4d7011a44fb131994f45ca3a2d25eceb9d14988 Mon Sep 17 00:00:00 2001 From: Sebastian Zagrodzki Date: Mon, 13 Feb 2017 17:08:46 +0100 Subject: [PATCH] Don't assume libusb headers are always in libusb-1.0. Use pkg-config to add correct include paths for libusb regardless of the platform. --- usb/config.go | 2 +- usb/constants.go | 2 +- usb/descriptor.go | 2 +- usb/device.go | 2 +- usb/endpoint.go | 2 +- usb/error.go | 2 +- usb/iso.c | 2 +- usb/iso.go | 2 +- usb/usb.go | 7 ++----- 9 files changed, 10 insertions(+), 13 deletions(-) diff --git a/usb/config.go b/usb/config.go index 53c5a97..0bfdba0 100644 --- a/usb/config.go +++ b/usb/config.go @@ -15,7 +15,7 @@ package usb -// #include +// #include import "C" import ( diff --git a/usb/constants.go b/usb/constants.go index 88a28b7..67c41ce 100644 --- a/usb/constants.go +++ b/usb/constants.go @@ -15,7 +15,7 @@ package usb -// #include +// #include import "C" type Class uint8 diff --git a/usb/descriptor.go b/usb/descriptor.go index fa6c1a3..79e5036 100644 --- a/usb/descriptor.go +++ b/usb/descriptor.go @@ -15,7 +15,7 @@ package usb -// #include +// #include import "C" type Descriptor struct { diff --git a/usb/device.go b/usb/device.go index 309fd4c..5f5422e 100644 --- a/usb/device.go +++ b/usb/device.go @@ -15,7 +15,7 @@ package usb -// #include +// #include import "C" import ( diff --git a/usb/endpoint.go b/usb/endpoint.go index 3baa10a..405f684 100644 --- a/usb/endpoint.go +++ b/usb/endpoint.go @@ -15,7 +15,7 @@ package usb -// #include +// #include import "C" import ( diff --git a/usb/error.go b/usb/error.go index 73c62ad..73115ee 100644 --- a/usb/error.go +++ b/usb/error.go @@ -19,7 +19,7 @@ import ( "fmt" ) -// #include +// #include import "C" type usbError C.int diff --git a/usb/iso.c b/usb/iso.c index 7cd4dd0..cfca006 100644 --- a/usb/iso.c +++ b/usb/iso.c @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include #include diff --git a/usb/iso.go b/usb/iso.go index 20a6da6..1ade2b0 100644 --- a/usb/iso.go +++ b/usb/iso.go @@ -16,7 +16,7 @@ package usb /* -#include +#include int submit(struct libusb_transfer *xfer); void print_xfer(struct libusb_transfer *xfer); diff --git a/usb/usb.go b/usb/usb.go index df25b5c..47784fb 100644 --- a/usb/usb.go +++ b/usb/usb.go @@ -16,11 +16,8 @@ // Package usb provides a wrapper around libusb-1.0. package usb -// #cgo windows CFLAGS: -ID:/lib/libusb-1.0.19/include -// #cgo windows,amd64 LDFLAGS: D:/lib/libusb-1.0.19/MinGW64/static/libusb-1.0.a -// #cgo windows,386 LDFLAGS: D:/lib/libusb-1.0.19/MinGW32/static/libusb-1.0.a -// #cgo !windows LDFLAGS: -lusb-1.0 -// #include +// #cgo pkg-config: libusb-1.0 +// #include import "C" import (