From a00903cb65268836c8071f25ee10cda140da3329 Mon Sep 17 00:00:00 2001 From: nodtem66 Date: Sat, 10 Jan 2015 05:44:09 +0700 Subject: [PATCH] add installation for Window in readme.md --- README.md | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 472793a..5ddb266 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Supported platforms include: - linux - darwin -Windows support is unconfirmed, but should work via cgo and [libusb-win32](http://sourceforge.net/apps/trac/libusb-win32/wiki). Contributing ============ @@ -19,8 +18,8 @@ You will need to send me the email address that you used to sign the agreement so that I can verify that it is on file before I can accept pull requests. -Installation -============ +Installation on Linux +===================== Dependencies ------------ @@ -46,6 +45,38 @@ There is also a `usbid` package that will not be installed by default by this co go get -v github.com/kylelemons/gousb/usb{,id} +Installation on Window7 +======================= +Dependencies +------------ +- Gcc (only tested on [Win-Builds](http://win-builds.org/), but any MSYS, CYGWIN, MINGW should be worked +- [libusb-1.0](http://sourceforge.net/projects/libusb/files/libusb-1.0/) + +Build +----- +- After downloaded, extract them to some directory; such as D:\lib\libusb-1.0.xx\ +- Remember two path which "libusb.h" file and "libusb-1.0.a" inside +*Note* For MinGW32, use MinGW32/static/libusb-1.0.a while MinGW64 use MinGW64/static/libusb-1.0.a for linker + +- Open $(GOPATH)/src/github.com/.../gousb/usb/usb.go. Then inject + // #cgo CFLAGS: -ID:/lib/libusbx-1.0.xx/include + // #cgo LDFLAGS: D:/lib/libusbx-1.0.xx/MinGW64/static/libusb-1.0.a + +before the line: + // #include + +This flag will tell the linker the exact path of static library + +- Go to $(GOPATH)/src/github.com/.../gousb/usb/. Run + // go install +- Go to $(GOPATH)/src/github.com/.../gousb/usbid/. Run + // go install + +Example: lsusb +-------------- +- Go to $(GOPATH)/src/github.com/.../gousb/lsusb/. Run + // go run main.go + Documentation ============= The documentation can be viewed via local godoc or via Gary Burd's excellent [godoc.org](http://godoc.org/):