Danushka and I decided to start a new game engine, and this time portability and simplicity are our two major concerns. The portability is mainly because Danu wants to use linux, and I don’t. Even if we were’t going for portability, we would probably still try to use open tools like Eclipse CDT because the Eclipse platform will allow us to maintain a completely integrated development environment for the engine, including any custom tooling needed for the engine, right through to the end-users of the engine (the game developers).
So, as you may have guessed by now, our tool-chain focusses around the Eclipse CDT (C/C++ Development Tools). In order to use this on windows, you’re going to need a version of gcc, and if you want to build any libraries you’ll probably need a BASH-esque command line replacement. So the tool-chain I am using is this:
- Eclipse CDT (Gaynemede/3.4)
Also, to facilitate portable development we are using a couple of libraries, namely:
This first part in my series on “Portable C++ on Windows” will discuss setting up MinGW, MinGW-GDB and MinGW-MSYS. The second part will discuss building Boost, SFML and Xerces, and the third will show you how to put it all together in the Eclipse CDT.
Part 1 – Compilers and Command Lines
These instructions are based on my experiences following these instructions. I am running Vista, and I have hand-picked a combination of the versions of the tools listed below because they worked for me. I also did things slightly differently to the aforementioned instructions because I ran into problems. If you have any problems, drop me a comment and I’ll try get back to ya.
Yout first step should be to download the following (just download them, don’t do anything with them yet):
- MinGW v5.1.4
- MinGW-MSYS Installer
- MinGW-MSYS Update
Ok, step 2: Install MinGW to c:MinGW. It is a very good idea to install into a path where there are no spaces, MinGW doesn’t really like them. The post install process will run, follow it through, it’s quite straight-forward.
Step 3: Install GDB into the c:MinGW folder. The archive contains a folder structure that is analogous to the c:MinGW folder, so merge the two. gdb.exe should end up in c:MinGWbin.
Step 4 is to install MinGW-MSYS, run the installer, telling it to install in c:msys1.0. This will install version 1.0.10. Extract the update archive (version 1.0.11) into the c:msys1.0 folder. Again the archive’s structure is analogous to the installed structure so the two should merge.
Step 5: Install the msys dtk by running the installer.
Step 6: Install the latest version of m4. Make sure that m4.exe goes into c:msys1.0bin
By now you should have an “M” icon on your desktop. Make sure you always choose to “Run As Administrator” for this if you are on Vista and you’re not a local admin (But don’t run it yet).
Step 7: Extract the automake, autoconf and libtool archives to c:temp (they will each then have their own folder, eg c:tempautomake-1.10 etc…)
Step 8: Run msys as administrator. You are now presented with a unix-esque command line. Directories are mounted so that all of your c-drive contents are under /c, so c:temp would be /c/temp. Change directory into each of the folders extracted in step 7, and run the following:
./configure --prefix=/mingw && make && make install
If you have problems building or installing the above, you may not be running as administrator.
Step 9: Get a real text editor, like TextPad, or Notepad++ (or any other one that allows you to choose your line ending type, we want LF endings), and edit C:msys1.0etcprofile. Make the following changes:
Find the line that says:
export HOME LOGNAME MSYSTEM HISTFILE
and replace it with:
export HOME LOGNAME MSYSTEM HISTFILE CFLAGS PKG_CONFIG_PATH CVS_RSH
Then add the following immediately before the line you just changed:
CFLAGS="-pipe -O2 -mms-bitfields -march=i686"
That’s it. Close MSYS and re-open it, and you should be away laughing. Stay tuned for the next part of the series on building Xerces, Boost and SFML (we may not have to build SFML).