Skip to content

Commit

Permalink
Merge branch 'feature/no-dummy-go-files'
Browse files Browse the repository at this point in the history
  • Loading branch information
bearsh committed Sep 2, 2024
2 parents dbd6f0d + c46e6e7 commit d35c7c7
Show file tree
Hide file tree
Showing 38 changed files with 80 additions and 15,458 deletions.
27 changes: 0 additions & 27 deletions c_deps.go

This file was deleted.

8 changes: 8 additions & 0 deletions hid_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build !ios && cgo

package hid

import (
_ "github.com/bearsh/hid/hidapi"
_ "github.com/bearsh/hid/hidapi/mac"
)
35 changes: 3 additions & 32 deletions hid_enabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,15 @@
package hid

/*
#cgo CFLAGS: -I./hidapi/hidapi
#cgo CFLAGS: -I./hidapi/.
#cgo !hidraw,linux CFLAGS: -I. -I./libusb/libusb -DDEFAULT_VISIBILITY="" -DOS_LINUX -D_GNU_SOURCE -DPLATFORM_POSIX
#cgo !hidraw,linux,!android LDFLAGS: -lrt
#cgo !hidraw,linux,noiconv CFLAGS: -DNO_ICONV
#cgo hidraw,linux CFLAGS: -DOS_LINUX -D_GNU_SOURCE -DHIDRAW
#cgo hidraw,linux,!android pkg-config: libudev
#cgo darwin CFLAGS: -DOS_DARWIN
#cgo darwin LDFLAGS: -framework CoreFoundation -framework IOKit -framework AppKit
#cgo windows CFLAGS: -DOS_WINDOWS
#cgo windows LDFLAGS: -lsetupapi
#ifdef OS_LINUX
#ifdef HIDRAW
#include "hidapi/linux/hid.c"
#else
#include <poll.h>
#include "os/events_posix.c"
#include "os/threads_posix.c"
#include "os/linux_usbfs.c"
#include "os/linux_netlink.c"
#include "core.c"
#include "descriptor.c"
#include "hotplug.c"
#include "io.c"
#include "strerror.c"
#include "sync.c"
#undef _GNU_SOURCE // it's already defined in the c-file
#include "hidapi/libusb/hid.c"
#endif
#elif OS_DARWIN
#include "hidapi/mac/hid.c"
#elif OS_WINDOWS
#include "hidapi/windows/hid.c"
#endif
#include <stdlib.h>
#include "hidapi.h"
*/
import "C"

Expand Down
8 changes: 8 additions & 0 deletions hid_hidraw_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build hidraw && cgo

package hid

import (
_ "github.com/bearsh/hid/hidapi"
_ "github.com/bearsh/hid/hidapi/linux"
)
10 changes: 10 additions & 0 deletions hid_libusb_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build !hidraw && cgo

package hid

import (
_ "github.com/bearsh/hid/hidapi"
_ "github.com/bearsh/hid/hidapi/libusb"
_ "github.com/bearsh/hid/libusb/libusb"
_ "github.com/bearsh/hid/libusb/libusb/os"
)
8 changes: 7 additions & 1 deletion hid_windows.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//go:build cgo

package hid

import (
"errors"
"golang.org/x/sys/windows"
"unsafe"

"golang.org/x/sys/windows"

_ "github.com/bearsh/hid/hidapi"
_ "github.com/bearsh/hid/hidapi/windows"
)

/*
Expand Down
5 changes: 0 additions & 5 deletions hidapi/hidapi.go
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
//go:build dummy

// This Go file is part of a workaround for `go mod vendor`.
// Please see the file `c_deps.go` at the root for more information.

package hidapi
File renamed without changes.
6 changes: 0 additions & 6 deletions hidapi/hidapi/hidapi.go

This file was deleted.

10 changes: 6 additions & 4 deletions hidapi/libusb/libusb.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//go:build dummy

// This Go file is part of a workaround for `go mod vendor`.
// Please see the file `c_deps.go` at the root for more information.
//go:build !hidraw && linux && cgo

package libusb

/*
#cgo CFLAGS: -I../. -I../../libusb/libusb
*/
import "C"
10 changes: 6 additions & 4 deletions hidapi/linux/linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//go:build dummy

// This Go file is part of a workaround for `go mod vendor`.
// Please see the file `c_deps.go` at the root for more information.
//go:build hidraw && linux

package linux

/*
#cgo CFLAGS: -I../. -DHIDRAW
*/
import "C"
10 changes: 6 additions & 4 deletions hidapi/mac/mac.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//go:build dummy

// This Go file is part of a workaround for `go mod vendor`.
// Please see the file `c_deps.go` at the root for more information.
//go:build darwin && !ios

package mac

/*
#cgo CFLAGS: -I../. -DOS_DARWIN
*/
import "C"
10 changes: 6 additions & 4 deletions hidapi/windows/windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//go:build dummy

// This Go file is part of a workaround for `go mod vendor`.
// Please see the file `c_deps.go` at the root for more information.
//go:build windows

package windows

/*
#cgo CFLAGS: -I../. -DOS_WINDOWS -Dhidapi_winapi_EXPORTS
*/
import "C"
5 changes: 0 additions & 5 deletions libusb/libusb.go
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
//go:build dummy

// This Go file is part of a workaround for `go mod vendor`.
// Please see the file `c_deps.go` at the root for more information.

package libusb
17 changes: 13 additions & 4 deletions libusb/libusb/libusb.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
//go:build dummy

// This Go file is part of a workaround for `go mod vendor`.
// Please see the file `c_deps.go` at the root for more information.
//go:build !hidraw && linux && cgo

package libusb

/*
#cgo CFLAGS: -I../.. -DDEFAULT_VISIBILITY="" -DOS_LINUX -D_GNU_SOURCE -DPLATFORM_POSIX
#cgo !hidraw,linux,noiconv CFLAGS: -DNO_ICONV
//#include "os/events_posix.c"
//#include "os/threads_posix.c"
//#include "os/linux_usbfs.c"
//#include "os/linux_netlink.c"
*/
import "C"
Loading

0 comments on commit d35c7c7

Please sign in to comment.