diff --git a/configure.ac b/configure.ac
index f518150..0ff0144 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,8 @@ if test "x$testgui_enabled" != "xno"; then
LIBS_TESTGUI+=" -framework Cocoa -L/usr/X11R6/lib"
CFLAGS_TESTGUI+=`$foxconfig --cflags`
OBJCFLAGS+=" -x objective-c++"
+ mkdir -p testgui/TestGUI.app
+ cp -R ${srcdir}/testgui/TestGUI.app.in/ testgui/TestGUI.app
elif test "x$os" = xwindows; then
# On Windows, just set the paths for Fox toolkit
if test "x$win_implementation" = xmingw; then
diff --git a/testgui/.gitignore b/testgui/.gitignore
index 11ef5e4..f989ea8 100644
--- a/testgui/.gitignore
+++ b/testgui/.gitignore
@@ -17,3 +17,4 @@ hidapi-libusb-testgui
.libs
*.la
*.lo
+TestGUI.app
diff --git a/testgui/Makefile.am b/testgui/Makefile.am
index 0604da1..3aebe4f 100644
--- a/testgui/Makefile.am
+++ b/testgui/Makefile.am
@@ -22,7 +22,7 @@ if OS_DARWIN
hidapi_testgui_SOURCES = test.cpp mac_support_cocoa.m
# Rules for copying the binary and its dependencies into the app bundle.
TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT): hidapi-testgui$(EXEEXT)
- ./copy_to_bundle.sh
+ $(srcdir)/copy_to_bundle.sh
all: all-am TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT)
diff --git a/testgui/Makefile.mac b/testgui/Makefile.mac
index 218858d..35bd581 100644
--- a/testgui/Makefile.mac
+++ b/testgui/Makefile.mac
@@ -15,11 +15,12 @@ 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)
- g++ -Wall -g $^ $(LIBS) -o hidapi-testgui
+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
@@ -33,8 +34,13 @@ $(CPPOBJS): %.o: %.cpp
$(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 $(OBJS) hidapi-testgui
+ rm -f $(OBJS) hidapi-testgui
+ rm -Rf TestGUI.app
.PHONY: clean
diff --git a/testgui/TestGUI.app/Contents/Info.plist b/testgui/TestGUI.app.in/Contents/Info.plist
similarity index 95%
rename from testgui/TestGUI.app/Contents/Info.plist
rename to testgui/TestGUI.app.in/Contents/Info.plist
index e199a1b..ab473d5 100644
--- a/testgui/TestGUI.app/Contents/Info.plist
+++ b/testgui/TestGUI.app.in/Contents/Info.plist
@@ -7,7 +7,7 @@
CFBundleDisplayName
CFBundleExecutable
- TestGUI
+ hidapi-testgui
CFBundleIconFile
Signal11.icns
CFBundleIdentifier
diff --git a/testgui/TestGUI.app/Contents/MacOS/libFOX-1.7.0.dylib b/testgui/TestGUI.app.in/Contents/MacOS/libFOX-1.7.0.dylib
similarity index 100%
rename from testgui/TestGUI.app/Contents/MacOS/libFOX-1.7.0.dylib
rename to testgui/TestGUI.app.in/Contents/MacOS/libFOX-1.7.0.dylib
diff --git a/testgui/TestGUI.app/Contents/MacOS/libpng12.0.dylib b/testgui/TestGUI.app.in/Contents/MacOS/libpng12.0.dylib
similarity index 100%
rename from testgui/TestGUI.app/Contents/MacOS/libpng12.0.dylib
rename to testgui/TestGUI.app.in/Contents/MacOS/libpng12.0.dylib
diff --git a/testgui/TestGUI.app/Contents/MacOS/libz.1.dylib b/testgui/TestGUI.app.in/Contents/MacOS/libz.1.dylib
similarity index 100%
rename from testgui/TestGUI.app/Contents/MacOS/libz.1.dylib
rename to testgui/TestGUI.app.in/Contents/MacOS/libz.1.dylib
diff --git a/testgui/TestGUI.app/Contents/MacOS/testgui b/testgui/TestGUI.app.in/Contents/MacOS/testgui
similarity index 100%
rename from testgui/TestGUI.app/Contents/MacOS/testgui
rename to testgui/TestGUI.app.in/Contents/MacOS/testgui
diff --git a/testgui/TestGUI.app/Contents/PkgInfo b/testgui/TestGUI.app.in/Contents/PkgInfo
similarity index 100%
rename from testgui/TestGUI.app/Contents/PkgInfo
rename to testgui/TestGUI.app.in/Contents/PkgInfo
diff --git a/testgui/TestGUI.app/Contents/Resources/English.lproj/InfoPlist.strings b/testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings
similarity index 100%
rename from testgui/TestGUI.app/Contents/Resources/English.lproj/InfoPlist.strings
rename to testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings
diff --git a/testgui/TestGUI.app/Contents/Resources/Signal11.icns b/testgui/TestGUI.app.in/Contents/Resources/Signal11.icns
similarity index 100%
rename from testgui/TestGUI.app/Contents/Resources/Signal11.icns
rename to testgui/TestGUI.app.in/Contents/Resources/Signal11.icns
diff --git a/testgui/copy_to_bundle.sh b/testgui/copy_to_bundle.sh
index 5e316d3..aa5de1c 100755
--- a/testgui/copy_to_bundle.sh
+++ b/testgui/copy_to_bundle.sh
@@ -53,6 +53,7 @@ function copydeps {
z=0
else
cp $i $EXEPATH
+ chmod 755 $EXEPATH/$BASE
fi