Port to Macintosh
This commit is contained in:
parent
aba65b07bf
commit
2312575ace
5 changed files with 78 additions and 13 deletions
40
Info.plist
Normal file
40
Info.plist
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- Documentation for this format is at -->
|
||||
<!-- http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/ConfigFiles.html -->
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>IMUread</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.pjrc.teensy</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>IMUread</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.234</string>
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
<false/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>All Rights Reserved</string>
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<false/>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>gui</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.icns</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.234</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6.0</string>
|
||||
<key>LSRequiresNativeExecution</key>
|
||||
<true/>
|
||||
<key>LSExecutableArchitectures</key>
|
||||
<array>
|
||||
<string>i386</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
32
Makefile
32
Makefile
|
|
@ -1,8 +1,9 @@
|
|||
OS = LINUX
|
||||
#OS = LINUX
|
||||
#OS = MACOSX
|
||||
#OS = WINDOWS
|
||||
OS = WINDOWS
|
||||
|
||||
ifeq ($(OS), LINUX)
|
||||
ALL = gui imuread
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
CFLAGS = -O2 -Wall -D$(OS)
|
||||
|
|
@ -12,9 +13,16 @@ WXCONFIG = ~/wxwidgets/3.0.2.gtk2-opengl/bin/wx-config
|
|||
CLILIBS = -lglut -lGLU -lGL
|
||||
|
||||
else ifeq ($(OS), MACOSX)
|
||||
#TODO: Macintosh build...
|
||||
ALL = gui.app
|
||||
CC = gcc-4.2
|
||||
CXX = g++-4.2
|
||||
CFLAGS = -O2 -Wall -D$(OS)
|
||||
CXXFLAGS = $(CFLAGS) `$(WXCONFIG) --cppflags`
|
||||
WXCONFIG = ~/wxwidgets/3.0.2.mac-opengl/bin/wx-config
|
||||
CLILIBS = -lglut -lGLU -lGL
|
||||
|
||||
else ifeq ($(OS), WINDOWS)
|
||||
ALL = gui.exe
|
||||
CC = i686-w64-mingw32-gcc
|
||||
CXX = i686-w64-mingw32-g++
|
||||
CFLAGS = -O2 -Wall -D$(OS)
|
||||
|
|
@ -22,21 +30,31 @@ CXXFLAGS = $(CFLAGS) `$(WXCONFIG) --cppflags`
|
|||
LDFLAGS = -static -static-libgcc
|
||||
WXCONFIG = ~/wxwidgets/3.0.2.mingw-opengl/bin/wx-config
|
||||
CLILIBS = -lglut32 -lglu32 -lopengl32
|
||||
VERSION = 0.01
|
||||
|
||||
endif
|
||||
|
||||
|
||||
all: gui imuread
|
||||
all: $(ALL)
|
||||
|
||||
gui: gui.o visualize.o serialdata.o
|
||||
$(CXX) -s $(CFLAGS) $(LDFLAGS) -o $@ $^ `$(WXCONFIG) --libs all,opengl`
|
||||
ifeq ($(OS), WINDOWS)
|
||||
cp gui gui.exe
|
||||
endif
|
||||
|
||||
gui.exe: gui
|
||||
cp gui gui.exe
|
||||
|
||||
gui.app: gui Info.plist
|
||||
mkdir -p $@/Contents/MacOS
|
||||
mkdir -p $@/Contents/Resources/English.lproj
|
||||
sed "s/1.234/$(VERSION)/g" Info.plist > $@/Contents/Info.plist
|
||||
/bin/echo -n 'APPL????' > $@/Contents/PkgInfo
|
||||
cp $< $@/Contents/MacOS/
|
||||
#cp icon.icns $@/Contents/Resources/
|
||||
touch $@
|
||||
|
||||
imuread: imuread.o visualize.o serialdata.o
|
||||
$(CC) -s $(CFLAGS) $(LDFLAGS) -o $@ $^ $(CLILIBS)
|
||||
|
||||
clean:
|
||||
rm -f gui imuread *.o *.exe
|
||||
rm -rf gui.app .DS_Store
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#if defined(LINUX) || defined(MACOSX)
|
||||
#if defined(LINUX)
|
||||
|
||||
#include "imuread.h"
|
||||
#include <GL/glut.h> // sudo apt-get install xorg-dev libglu1-mesa-dev freeglut3-dev
|
||||
|
|
|
|||
14
imuread.h
14
imuread.h
|
|
@ -13,18 +13,26 @@
|
|||
#if defined(LINUX)
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#elif defined(WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#elif defined(MACOSX)
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
|
||||
#if defined(LINUX)
|
||||
#define PORT "/dev/ttyACM0"
|
||||
#elif defined(WINDOWS)
|
||||
#define PORT "COM3"
|
||||
#elif defined(MACOSX)
|
||||
#define PORT "/dev/cu.usbmodem123"
|
||||
#define PORT "/dev/cu.usbmodemfd132"
|
||||
#endif
|
||||
|
||||
#define TIMEOUT_MSEC 40
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ static void newdata(const unsigned char *data, int len)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(LINUX)
|
||||
#if defined(LINUX) || defined(MACOSX)
|
||||
|
||||
static int portfd=-1;
|
||||
|
||||
|
|
@ -349,5 +349,4 @@ void close_port(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue