Spacefight – Building and distributing the game – Part 11

The game starts to look complete and I am getting ready to build versions of the game, for the platforms I initially had in mind which are Linux, Windows and Mac OSX.

Building for Windows

First off I hoped I could build the Windows binaries in Linux with MinGW. I installed the compiler via apt-get and did a quick test compile. A simple hello world program seemed to compile and run under windows.

But it failed big when it came to compiling the actual game. The main problem with the MinGW distribution that I had installed (from the repository), is that the GCC package is old and ancient. Since my game is using quite a bit of the new features in C+11. The compiler refused to compile the project. Time to upgrade that package Ubuntu!

I took my time to look for guides on how to compile your own MinGW cross compiler, and it quickly scared me away. Apparently it’s quite a big deal compiling the GCC packages and I think it would take me days to build it via trial and error.

I ended up installing Code::Blocks on my Windows machine instead. That building processes couldn’t have been easier. I added all the sources and made a build.

I had to place all the SDL’s and PhysFS’s dlls in the same folder. I ran UPX on the binaries to compress the file sizes and the distribution was made. I also wanted an icon for the .exe file so I created a resource.rc file and a ico-file. If you’re running windows and want to have a go at C++ and SDL I can really recommend Code::Blocks.

Building for Linux

Linux is pretty hard to build for. There are hundreds of different distributions where the libraries are at different versions. I still don’t know which is the better approach.

  • Creating a deb package and install the dependencies. But that limits the application to Ubuntu and Debian.
  • Copy all the run-time libraries into the directory with cpld? Just the libraries fills up 20MB or 10MB (when using upx). Which is way too much for such a small game.
  • Have faith that all Linux users can download/install all the right libraries and run the compilation? Nah.. This is a tricky one.

I’m leaning against using option 2. Even though it takes up a lot more space.

Anyway, here’s the Makefile I’ve been using to compile the game. If anyone have ideas for the Linux packaging, or optimizations for the Makefile, please let me know.

Building for MacOSX

BuildingI don’t own an Mac. This makes pretty obvious it will be very challenging to compile a MacOSX build. I’ve attempted to install MacOSX 10.9 in VirtualBox and run it from there. After a couple of tweaks, it boots up OSX. But very very slow. (Imagine sitting on a remote desktop over a 56K modem).

But I managed to set up XCode and set up SDL. But it was a bit tricky. First you need to add sdlMain.m and sdlMain.h for your project, which works as glue for initialization (clueless when it comes to Mac). And pass on “-fno-objc-arc” which I found out here. But still I cannot get physfs to link properly, and it’s very frustration working with MacOSX under Virtualbox. So the Mac Build is kind of up in the air.

I might have luck compiling it via Virtualbox, but I at the moment it make take more time.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.