Win32

From uGFX Wiki
Revision as of 15:17, 1 July 2014 by Tectu (Talk | contribs) (Created page with "µGFX can be run natively on a Windows system. This simplifies the process of developing your embedded GUI application. The following steps are our tested method of running µ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

µGFX can be run natively on a Windows system. This simplifies the process of developing your embedded GUI application. The following steps are our tested method of running µGFX on a Windows system:

  1. Make sure you got MinGW (32-bit) and CyGWIN installed.
  2. Compile using the Makefile below.

Example

While we do all our testing using the MinGW toolchain, it should compile equally well using Microsoft Visual Studio compilers with some changes to the Makefile.

  1. # Compiler, optimizer and uGFX library location
  2. GFXLIB  = path/to/your/ugfx
  3. CC      = mingw32-gcc
  4. CCOPT   = -g -ggdb -O0 -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes
  5. LDOPT   = -g 
  6.  
  7.  
  8. # ******* Start: Your Project Settings **************
  9.  
  10.  
  11. # Your project directories
  12. UINCDIR =
  13. ULIBDIR =
  14.  
  15. # Your project definitions and libraries
  16. UDEFS   =
  17. ULIBS   =
  18.  
  19. # Your project executable
  20. PROJECT = uGFX.exe
  21.  
  22. # Your project C source files
  23. SRC     =
  24.  
  25. # Your project uGFX drivers
  26. include $(GFXLIB)/boards/base/Win32/board.mk
  27. include $(GFXLIB)/demos/modules/gwin/widgets/demo.mk
  28.  
  29.  
  30. # ******* End: Your Project Settings **************
  31.  
  32.  
  33. # The default directories, libraries and source
  34. include $(GFXLIB)/gfx.mk
  35. DSRC    = $(GFXSRC) $(MYCSRC)
  36. DINCDIR = $(GFXINC) $(MYFILES)
  37. DLIBDIR = 
  38. DLIBS   = ws2_32 gdi32
  39. DDEFS   =
  40.  
  41. # Putting it all together - Object files and compiler flags
  42. OBJS    = $(DSRC:.c=.o) $(SRC:.c=.o)
  43. LDFLAGS = $(LDOPT) $(patsubst %,-L%, $(ULIBDIR) $(DLIBDIR)) $(patsubst %,-l%, $(ULIBS) $(DLIBS))
  44. CCFLAGS = $(CCOPT) $(patsubst %,-D%, $(UDEFS) $(DDEFS)) $(patsubst %,-I%, . $(UINCDIR) $(DINCDIR)) 
  45.  
  46. # Makefile rules 
  47. all: $(OBJS) $(PROJECT) 
  48.  
  49. %.o : %.c       
  50. 	$(CC) -DGFX_USE_OS_WIN32=TRUE -c $(CCFLAGS) $< -o $@ 
  51.  
  52. %.exe: $(OBJS)
  53. 	$(CC) $(OBJS) $(LDFLAGS) -o $@
  54.  
  55. run: $(PROJECT)
  56. 	./$(PROJECT)
  57.  
  58. clean:
  59. 	-rm -f $(OBJS)   
  60. 	-rm -f $(PROJECT)