Your First Compile - Windows

From uGFX Wiki
Revision as of 03:11, 30 September 2014 by Inmarket (Talk | contribs) (Created page with "This guide will help you set up your first compile under windows. We will be compiling one of the uGFX demo's using the command-line. Once you have this working you can set up...")

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

This guide will help you set up your first compile under windows. We will be compiling one of the uGFX demo's using the command-line. Once you have this working you can set up any of a number of development IDE's.

Some IDE's worth looking at:

  • Code::Blocks - very easy to set up and use
  • Eclipse - The standard for cross platform development. Can be tricky for normal windows developers
  • Microsoft Development Studio - The gold standard but pricey and untested with uGFX

Getting the bits

You will need to download uGFX. See Getting Started for how to get the uGFX source code. You will need to get cygwin [1]. You can either get the 32 bit or 64 bit installer.

Installing Cygwin

Run the installer and accept the default options until you get to the package selection. In the package selection expand the "Devel" branch and add the following packages:

  • make
  • mingw-binutils
  • mingw-gcc-core
  • mingw-w32api

Set Up Your Folder Structure

Select a directory to build your uGFX projects in. The pathname for this should probably not contain spaces (we simply haven't tested that). Create the following folders:

  • uGFX
  • TestProject

Into the uGFX directory copy the uGFX source. The uGFX folder will then contain a gfxconf.example.h file (as well as lots of other stuff). This folder will be used as the master source location for all your uGFX projects and is generally treated as a read-only store.

In the TestProjects directory copy the Makefile from the uGFX/boards/base/Win32/example directory. This will be your project directory and will eventually contain all your project source files. For now we are going to just build one of the predefined demos so the only thing needed is the makefile itself.

Setting Your Environment

Using the command prompt, change directory to your new project folder (TestProject). We now need to set your path to include the cygwin utilities. PATH=C:\cygwin\bin;%PATH%

or

PATH=C:\cygwin64\bin;%PATH%

for a 64 bit version of cygwin.

The First Build

Just type "make" to now make your first demo. To run it after building: .build/TestProject.exe

You can then use "make clean" to clean up all the object files etc that were created.

What's next

  1. Try change the GFXDEMO setting in the makefile to make a different demo. The demo's can be found in the uGFX/demos directory.
  2. Copy one of the demo's source to your project folder. Comment out the GFXDEMO line in the Makefile and add main.c to the SRC line. Making this will now make the demo from the source in your project directory. Play with your local main.c to experiment with uGFX. Note the gfxconf.h file. This file contains the configuration options for any program you create.
  3. You are now in a position to start playing with cross-compiling for other platforms. See some of the examples under the uGFX/boards/base directory.