Difference between revisions of "Win32"
From uGFX Wiki
(→Example) |
|||
Line 5: | Line 5: | ||
== 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. | + | 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"> | + | <syntaxhighlight lang=make line start="1", highlight="2,27"> |
# Compiler, optimizer and uGFX library location | # Compiler, optimizer and uGFX library location | ||
GFXLIB = path/to/your/ugfx | GFXLIB = path/to/your/ugfx |
Revision as of 15:20, 1 July 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:
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).
# 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)