Difference between revisions of "Mac OS X"

From uGFX Wiki
Jump to: navigation, search
Line 4: Line 4:
 
# Make sure you got [http://clang.llvm.org/ clang] installed
 
# Make sure you got [http://clang.llvm.org/ clang] installed
 
# Make sure you got [http://xquartz.macosforge.org/landing/ XQuartz] installed
 
# Make sure you got [http://xquartz.macosforge.org/landing/ XQuartz] installed
# Compile using the Makefile below
+
# Compile using the Makefile thatn can be found in ''/boards/base/OSX/example/''
 
+
 
+
== Example ==
+
The following Makefile has been tested under Mac OS X 10.8 and 10.9.2. Please let us know when you faced some problems running it under a different version. Modify the highlighted line(s).
+
 
+
'''''Note:''' The performance of the resulting programm is very bad. This is because the X driver just uses setPixel() and doesn't take any advantage of area blitting or double buffering. The application will run A LOT faster on the actual microcontroller.''
+
<syntaxhighlight lang=make line start="1" highlight="15">
+
# The name of the project / binary
+
PROJECT = ugfx
+
 
+
# List C source files here
+
SRC    = $(GFXSRC) \
+
          main.c
+
 
+
# List all user directories here
+
UINCDIR = $(GFXINC) \
+
 
+
# List all libraries
+
LIBS    = -lX11
+
 
+
# Include uGFX
+
GFXLIB  = /path/to/your/ugfx
+
include $(GFXLIB)/gfx.mk
+
include $(GFXLIB)/boards/base/Linux/board.mk
+
 
+
 
+
###############################################################################
+
# Do not change anything below this line unless you know what you're doing    #
+
###############################################################################
+
 
+
# Your toolchain
+
CC      = clang                                                                         
+
INCDIR  = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) -I/opt/X11/include           
+
LIBDIR  = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) -L/opt/X11/lib               
+
OBJS    = $(SRC:.c=.o)
+
CCFLAGS = -O2 -Wall
+
LDFLAGS =
+
 
+
 
+
###############################################################################
+
# Actual Makefile rules                                                      #
+
###############################################################################
+
 
+
all: $(OBJS) $(PROJECT)
+
 
+
%.o : %.c
+
$(CC) -c $(CCFLAGS) -I . $(INCDIR) $< -o $@
+
 
+
$(PROJECT): $(OBJS)
+
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) $(LIBDIR) -o $@
+
 
+
clean:                                     
+
-rm -f $(OBJS)
+
-rm -f $(PROJECT)
+
</syntaxhighlight>
+

Revision as of 05:30, 2 October 2014

µGFX can be run natively on a Mac OS X system. This simplifies the process of developing your embedded GUI application a lot.
The following steps are required to run µGFX on Mac OS X system:

  1. Make sure you got clang installed
  2. Make sure you got XQuartz installed
  3. Compile using the Makefile thatn can be found in /boards/base/OSX/example/