Mac OS X

From uGFX Wiki
Revision as of 15:21, 1 July 2014 by Tectu (Talk | contribs) (Example)

Jump to: navigation, search

µ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 below


Example

The following Makefile has been tested under Mac OS X 10.8. 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.

  1. # The name of the project / binary
  2. PROJECT = ugfx
  3.  
  4. # List C source files here
  5. SRC     = $(GFXSRC) \
  6.           main.c
  7.  
  8. # List all user directories here
  9. UINCDIR = $(GFXINC) \
  10.  
  11. # List all libraries
  12. LIBS    = -lX11
  13.  
  14. # Include uGFX
  15. GFXLIB  = /path/to/your/ugfx
  16. include $(GFXLIB)/gfx.mk
  17. include $(GFXLIB)/boards/base/Linux/board.mk
  18.  
  19.  
  20. ###############################################################################
  21. # Do not change anything below this line unless you know what you're doing    #
  22. ###############################################################################
  23.  
  24. # Your toolchain
  25. CC      = clang                                                                           
  26. INCDIR  = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) -I/opt/X11/include            
  27. LIBDIR  = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) -L/opt/X11/lib                
  28. OBJS    = $(SRC:.c=.o)
  29. CCFLAGS = -O2 -Wall
  30. LDFLAGS = 
  31.  
  32.  
  33. ###############################################################################
  34. # Actual Makefile rules                                                       #
  35. ###############################################################################
  36.  
  37. all: $(OBJS) $(PROJECT)
  38.  
  39. %.o : %.c
  40. 	$(CC) -c $(CCFLAGS) -I . $(INCDIR) $< -o $@
  41.  
  42. $(PROJECT): $(OBJS)
  43. 	$(CC) $(OBJS) $(LDFLAGS) $(LIBS) $(LIBDIR) -o $@
  44.  
  45. clean:                                      
  46. 	-rm -f $(OBJS)
  47. 	-rm -f $(PROJECT)