Jump to content

Win32: Difference between revisions

From uGFX Wiki
No edit summary
Line 1: Line 1:
µ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:
µ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:


# Make sure you got [http://www.mingw.org/ MinGW] (32-bit) and [https://www.cygwin.com/ Cygwin] installed.
# Make sure you got [http://www.mingw.org/ MinGW] (32-bit) '''and''' [https://www.cygwin.com/ Cygwin] installed.
# Compile using the Makefile below.
# Compile using the Makefile that can be found in ''/boards/base/win32/example/''.
 
== 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. Modify the highlighted line(s).
<syntaxhighlight lang=make line start="1", highlight="2,27">
# Compiler, optimizer and uGFX library location
GFXLIB  = path/to/your/ugfx
CC      = mingw32-gcc
CCOPT  = -g -ggdb -O0 -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes
LDOPT  = -g
 
 
# ******* Start: Your Project Settings **************
 
# Your project directories
UINCDIR =
ULIBDIR =
 
# Your project definitions and libraries
UDEFS  =
ULIBS  =
 
# Your project executable
PROJECT = uGFX.exe
 
# Your project C source files
SRC    =
 
# Your project uGFX drivers
include $(GFXLIB)/boards/base/Win32/board.mk
include $(GFXLIB)/demos/modules/gwin/widgets/demo.mk
 
 
# ******* End: Your Project Settings **************
 
# The default directories, libraries and source
include $(GFXLIB)/gfx.mk
DSRC    = $(GFXSRC) $(MYCSRC)
DINCDIR = $(GFXINC) $(MYFILES)
DLIBDIR =
DLIBS  = ws2_32 gdi32
DDEFS  =
 
# Putting it all together - Object files and compiler flags
OBJS    = $(DSRC:.c=.o) $(SRC:.c=.o)
LDFLAGS = $(LDOPT) $(patsubst %,-L%, $(ULIBDIR) $(DLIBDIR)) $(patsubst %,-l%, $(ULIBS) $(DLIBS))
CCFLAGS = $(CCOPT) $(patsubst %,-D%, $(UDEFS) $(DDEFS)) $(patsubst %,-I%, . $(UINCDIR) $(DINCDIR))
 
# Makefile rules
all: $(OBJS) $(PROJECT)
 
%.o : %.c     
$(CC) -DGFX_USE_OS_WIN32=TRUE -c $(CCFLAGS) $< -o $@
 
%.exe: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) -o $@
 
run: $(PROJECT)
./$(PROJECT)
 
clean:
-rm -f $(OBJS) 
-rm -f $(PROJECT)
</syntaxhighlight>

Revision as of 20:42, 29 September 2014

µ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 that can be found in /boards/base/win32/example/.