Difference between revisions of "Your First Compile - Windows"
(→Setting Your Environment) |
(→The First Build) |
||
Line 42: | Line 42: | ||
== The First Build == | == The First Build == | ||
− | + | Using the command prompt with the correctly set path (as above), change directory to your new project folder (TestProject). Type "make" to build your first demo. To run it after building: | |
+ | |||
<code> | <code> | ||
.build/TestProject.exe | .build/TestProject.exe |
Revision as of 03:26, 30 September 2014
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 later set up any of a number of development IDE's.
Contents
Getting the bits
You will need to download uGFX. See Getting Started for how to get the uGFX source code. You will also need to get cygwin [1]. You can either get the 32 bit or 64 bit installer. If you already have cygwin, make sure you update it to the latest version as older versions had problems with the make utility.
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
Open a command prompt and set the path for the window 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
Using the command prompt with the correctly set path (as above), change directory to your new project folder (TestProject). Type "make" to build your first demo. To run it after building:
.build/TestProject.exe
You can also use "make clean" to clean up all the object files etc that were created.
What's next
- Try change the GFXDEMO setting in the makefile to make a different demo. The demo's can be found in the uGFX/demos directory.
- 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.
- You may want to use an IDE to do your development. Some IDE's worth looking at:
- Code::Blocks - very easy to set up and use. Set your projects to be a "Custom Makefile" project
- 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
- 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.