Skip to content

Commit

Permalink
3 air
Browse files Browse the repository at this point in the history
  • Loading branch information
CCIGAMES committed Mar 2, 2024
1 parent 1ea4a79 commit e9a137f
Show file tree
Hide file tree
Showing 28 changed files with 2,806 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: hidapi-hidraw
Description: C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the hidraw implementation.
Version: @VERSION@
Libs: -L${libdir} -lhidapi-hidraw
Cflags: -I${includedir}/hidapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: hidapi-libusb
Description: C Library for USB HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the libusb implementation.
Version: @VERSION@
Libs: -L${libdir} -lhidapi-libusb
Cflags: -I${includedir}/hidapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: hidapi
Description: C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows.
Version: @VERSION@
Libs: -L${libdir} -lhidapi
Cflags: -I${includedir}/hidapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@


OS=$(shell uname)

ifeq ($(OS), Darwin)
FILE=Makefile.mac
endif

ifneq (,$(findstring MINGW,$(OS)))
FILE=Makefile.mingw
endif

ifeq ($(OS), Linux)
FILE=Makefile.linux
endif

ifeq ($(OS), FreeBSD)
FILE=Makefile.freebsd
endif

ifeq ($(FILE), )
all:
$(error Your platform ${OS} is not supported at this time.)
endif

include $(FILE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ $(CFLAGS_TESTGUI)

if OS_LINUX
## Linux
bin_PROGRAMS = hidapi-hidraw-testgui hidapi-libusb-testgui

hidapi_hidraw_testgui_SOURCES = test.cpp
hidapi_hidraw_testgui_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la $(LIBS_TESTGUI)

hidapi_libusb_testgui_SOURCES = test.cpp
hidapi_libusb_testgui_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la $(LIBS_TESTGUI)
else
## Other OS's
bin_PROGRAMS = hidapi-testgui

hidapi_testgui_SOURCES = test.cpp
hidapi_testgui_LDADD = $(top_builddir)/$(backend)/libhidapi.la $(LIBS_TESTGUI)
endif

if OS_DARWIN
hidapi_testgui_SOURCES = test.cpp mac_support_cocoa.m mac_support.h
# Rules for copying the binary and its dependencies into the app bundle.
TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT): hidapi-testgui$(EXEEXT)
$(srcdir)/copy_to_bundle.sh

all: all-am TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT)

endif

EXTRA_DIST = \
copy_to_bundle.sh \
Makefile-manual \
Makefile.freebsd \
Makefile.linux \
Makefile.mac \
Makefile.mingw \
TestGUI.app.in \
testgui.sln \
testgui.vcproj

distclean-local:
rm -rf TestGUI.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
###########################################
# Simple Makefile for HIDAPI test program
#
# Alan Ott
# Signal 11 Software
# 2010-06-01
###########################################

all: testgui

CC=cc
CXX=c++
COBJS=../libusb/hid.o
CPPOBJS=test.o
OBJS=$(COBJS) $(CPPOBJS)
CFLAGS=-I../hidapi -I/usr/local/include `fox-config --cflags` -Wall -g -c
LDFLAGS= -L/usr/local/lib
LIBS= -lusb -liconv `fox-config --libs` -pthread


testgui: $(OBJS)
$(CXX) -Wall -g $^ $(LDFLAGS) -o $@ $(LIBS)

$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@

clean:
rm *.o testgui

.PHONY: clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
###########################################
# Simple Makefile for HIDAPI test program
#
# Alan Ott
# Signal 11 Software
# 2010-06-01
###########################################

all: testgui

CC=gcc
CXX=g++
COBJS=../libusb/hid.o
CPPOBJS=test.o
OBJS=$(COBJS) $(CPPOBJS)
CFLAGS=-I../hidapi -Wall -g -c `fox-config --cflags` `pkg-config libusb-1.0 --cflags`
LIBS=-ludev -lrt -lpthread `fox-config --libs` `pkg-config libusb-1.0 --libs`


testgui: $(OBJS)
g++ -Wall -g $^ $(LIBS) -o testgui

$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@

clean:
rm *.o testgui

.PHONY: clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
###########################################
# Simple Makefile for HIDAPI test program
#
# Alan Ott
# Signal 11 Software
# 2010-07-03
###########################################

all: hidapi-testgui

CC=gcc
CXX=g++
COBJS=../mac/hid.o
CPPOBJS=test.o
OBJCOBJS=mac_support_cocoa.o
OBJS=$(COBJS) $(CPPOBJS) $(OBJCOBJS)
CFLAGS=-I../hidapi -Wall -g -c `fox-config --cflags`
LDFLAGS=-L/usr/X11R6/lib
LIBS=`fox-config --libs` -framework IOKit -framework CoreFoundation -framework Cocoa


hidapi-testgui: $(OBJS) TestGUI.app
g++ -Wall -g $(OBJS) $(LIBS) $(LDFLAGS) -o hidapi-testgui
./copy_to_bundle.sh
#cp TestGUI.app/Contents/MacOS/hidapi-testgui TestGUI.app/Contents/MacOS/tg
#cp start.sh TestGUI.app/Contents/MacOS/hidapi-testgui

$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@

$(OBJCOBJS): %.o: %.m
$(CXX) $(CFLAGS) -x objective-c++ $< -o $@

TestGUI.app: TestGUI.app.in
rm -Rf TestGUI.app
mkdir -p TestGUI.app
cp -R TestGUI.app.in/ TestGUI.app

clean:
rm -f $(OBJS) hidapi-testgui
rm -Rf TestGUI.app

.PHONY: clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
###########################################
# Simple Makefile for HIDAPI test program
#
# Alan Ott
# Signal 11 Software
# 2010-06-01
###########################################

all: hidapi-testgui

CC=gcc
CXX=g++
COBJS=../windows/hid.o
CPPOBJS=test.o
OBJS=$(COBJS) $(CPPOBJS)
CFLAGS=-I../hidapi -I../../hidapi-externals/fox/include -g -c
LIBS= -mwindows -lsetupapi -L../../hidapi-externals/fox/lib -Wl,-Bstatic -lFOX-1.6 -Wl,-Bdynamic -lgdi32 -Wl,--enable-auto-import -static-libgcc -static-libstdc++ -lkernel32


hidapi-testgui: $(OBJS)
g++ -g $^ $(LIBS) -o hidapi-testgui

$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@

clean:
rm -f *.o hidapi-testgui.exe

.PHONY: clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string></string>
<key>CFBundleExecutable</key>
<string>hidapi-testgui</string>
<key>CFBundleIconFile</key>
<string>Signal11.icns</string>
<key>CFBundleIdentifier</key>
<string>us.signal11.hidtestgui</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>testgui</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APPL????
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash

#### Configuration:
# The name of the executable. It is assumed
# that it is in the current working directory.
EXE_NAME=hidapi-testgui
# Path to the executable directory inside the bundle.
# This must be an absolute path, so use $PWD.
EXEPATH=$PWD/TestGUI.app/Contents/MacOS
# Libraries to explicitly bundle, even though they
# may not be in /opt/local. One per line. These
# are used with grep, so only a portion of the name
# is required. eg: libFOX, libz, etc.
LIBS_TO_BUNDLE=libFOX


function copydeps {
local file=$1
# echo "Copying deps for $file...."
local BASE_OF_EXE=`basename $file`

# A will contain the dependencies of this library
local A=`otool -LX $file |cut -f 1 -d " "`
local i
for i in $A; do
local BASE=`basename $i`

# See if it's a lib we specifically want to bundle
local bundle_this_lib=0
local j
for j in $LIBS_TO_BUNDLE; do
echo $i |grep -q $j
if [ $? -eq 0 ]; then
bundle_this_lib=1
echo "bundling $i because it's in the list."
break;
fi
done

# See if it's in /opt/local. Bundle all in /opt/local
local isOptLocal=0
echo $i |grep -q /opt/local
if [ $? -eq 0 ]; then
isOptLocal=1
echo "bundling $i because it's in /opt/local."
fi

# Bundle the library
if [ $isOptLocal -ne 0 ] || [ $bundle_this_lib -ne 0 ]; then

# Copy the file into the bundle if it exists.
if [ -f $EXEPATH/$BASE ]; then
z=0
else
cp $i $EXEPATH
chmod 755 $EXEPATH/$BASE
fi


# echo "$BASE_OF_EXE depends on $BASE"

# Fix the paths using install_name_tool and then
# call this function recursively for each dependency
# of this library.
if [ $BASE_OF_EXE != $BASE ]; then

# Fix the paths
install_name_tool -id @executable_path/$BASE $EXEPATH/$BASE
install_name_tool -change $i @executable_path/$BASE $EXEPATH/$BASE_OF_EXE

# Call this function (recursive) on
# on each dependency of this library.
copydeps $EXEPATH/$BASE
fi
fi
done
}

rm -f $EXEPATH/*

# Copy the binary into the bundle. Use ../libtool to do this if it's
# available beacuse if $EXE_NAME was built with autotools, it will be
# necessary. If ../libtool not available, just use cp to do the copy, but
# only if $EXE_NAME is a binary.
if [ -x ../libtool ]; then
../libtool --mode=install cp $EXE_NAME $EXEPATH
else
file -bI $EXE_NAME |grep binary
if [ $? -ne 0 ]; then
echo "There is no ../libtool and $EXE_NAME is not a binary."
echo "I'm not sure what to do."
exit 1
else
cp $EXE_NAME $EXEPATH
fi
fi
copydeps $EXEPATH/$EXE_NAME
Loading

0 comments on commit e9a137f

Please sign in to comment.