Difference between revisions of "Win32"

From uGFX Wiki
Jump to: navigation, search
(Example)
(Visual Studio)
 
(5 intermediate revisions by the same user not shown)
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 ==
+
'''''Note:''' You might want to checkout [[Your First Compile - Windows|this guide]] which is a detailed step-by-step guide on compiling a native uGFX application on a Windows environment.''
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
+
  
 
+
== Visual Studio ==
# ******* Start: Your Project Settings **************
+
If you'd like to compile µGFX using Visual Studio, please see this forum post: https://community.ugfx.io/topic/434-visual-studio-2013-build-issues
+
 
+
# 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>
+

Latest revision as of 15:57, 23 July 2021

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

Note: You might want to checkout this guide which is a detailed step-by-step guide on compiling a native uGFX application on a Windows environment.

Visual Studio

If you'd like to compile µGFX using Visual Studio, please see this forum post: https://community.ugfx.io/topic/434-visual-studio-2013-build-issues