It’s not much, but I finally managed to learn how to use GNU make well enough to manage a cross-platform project successfully. All the project does is create a small library, which I call libFoo, and a main executable, called HelloWorld. I’m sure you know what an executable is, but for those who may not know what a “library” is, it’s basically a pre-made “sub-part” of the program. The engine, which you may recall is titled 3Quad, is designed to be built as a stand-alone library if needed, so it was necessary to make sure I could build it as a library on all platforms.
All the program does is output the string, “Hello, World!” from the main program and “Hello from libFoo too!”, to prove that the library is being called correctly. HelloWorld is notably simple, but it’s the traditional starting point for just about any new programming adventure. Here are the screenshots from each desktop platform:
(I named my Windows and Linux installations, beavis and butthead ;-P)
So there it is in all its glory (and about as exciting as dirt), our first truly cross-platform compatible program 😀
What’s really cool about it is that, as planned, I use only one set of source files and Makefile for all platforms, as opposed to an IDE project for each platform. To actually build the program on each platform, all I have to do is boot into the appropriate OS, then navigate to the project folder on the command line and type “make”, and it magically spits out the appropriate build for that platform. Yes, it is that easy!
That said, figuring out how to set it all up to be automatic like this took quite a bit of effort. Writing the Makefile itself, which manages the build process, took lots of trial and error and reading/studying/etc. Once I got it working on the Mac, it was trivial to get it running on Linux. Windows, on the other hand, was not as easy, but I managed to figure it out too, as you can see.
So the first step is accomplished, woohoo!
Next up: Make it a proper application on each platform, instead of a little command line executable. I’ll probably delve into SDL for that.
– Jake