-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started with MinGW on Windows
Windows can be notoriously tricky to get started with. The following however should do the trick for a fresh install of MinGW; tested on Windows 8 but should work on any recent version.
NOTE: If you already have a MinGW installation you're on your own; you might want to consider backing up your existing install and just following the below anyway.
The best way to install MinGW is really to install a distro maintained by someone else. An excellent choice with most of the stuff you need is at nuwen.net. Follow the instructions there to install the latest version of g++. When you've got it installed (to C:/MinGW) run C:/MinGW/open_distro_window.bat.
The distro includes SDL2 and SDL2_mixer but is missing SDL2_image, SDL2_ttf and tmxparser (as well as the tmxparser dependency "tinyxml2")
Mainly you need to make sure the libraries end up in /MinGW/lib, the includes in /MinGW/include and the binaries in /MinGW/bin. Note that the default "make install" installs to your Program Files (x86) directory (assuming you have admin)
When running cmake you'll probably need to define -DCMAKE_PREFIX_PATH=/MinGW.
-
SDL2_image
Binaries available for mingw here; be sure to copy the x86_64 versions. No need to build. -
SDL2_ttf
As with SDL2_image, just extract and copy paste.
git clone git@github.com:leethomason/tinyxml2.git
mkdir build && cd build
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/MinGW ..
make && make install # and copy paste to /MinGW
git clone git@github.com:andrewrk/tmxparser.git
mkdir build && cd build
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/MinGW -DZLIB_LIBRARIES=/MinGW/lib/libz.a ..
# we define the zlib library specifically because MinGW can get confused if it finds a zlib dll on the PATH
make && make install # and copy paste to /MinGW
Just compiling the library should go smoothly if you've set up your dependencies correctly. It should be as simple as:
cd APG
mkdir build && cd build
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/MinGW
make
Running applications linked against APG might need DLLs that were compiled in the above step; if upon running an example you get a message about missing DLLs you can probably find it in C:\MinGW\bin and copy-paste.
For compiling your own application with APG, you'll probably need to link against some windows specific libraries; check in CMakeLists.txt
for a list of the libraries. A possibly-not-exhaustive list is: Version Imm32 winmm vorbisfile ogg vorbis mingw32
. You'll likely also want to pass -mwindows as a compiler argument.