Lately, I've been trying to get started on porting Hula Hoop (an Android app based on the GDX game programming library and the Box2D physics library) to C/C++. Of course, it's of utmost importance to shave a few yaks before getting started.
GNU/Linux is a software development environment in much the same way that git is a source code management tool: they're both of the "choose your own convention" variety so common in the Unix culture (linfo.org, joelonsoftware.com). Some things I've figured out so far:
- If the app is going to be built for a variety of platforms, I'm going to need to build the dependecies for those platforms too. That means I don't want to depend on system-wide library installations, and that means I have to figure out how to build each of the dependencies myself.
- CMake has become widely used across many open source projects and this is good.
- cgdb is nice to have around.
- Valgrind is all that everyone who says it's an invaluable tool for users of non-garbage collected languages on Linux says it is.
- Git Submodules are not appropriate for external build dependencies. This is mostly because the dependency graph is so rarely a tree.
I finally settled on an arrangement inspired by virtualenv and Go:
- A directory for this project with its own src, bin, lib, and include subdirectories. This directory is not version-controlled.
- Projects, including dependencies, are cloned & checked out under the src directory.
- Dependencies are configured with an install prefix that matches the top-level directory.
- A script called "activate.sh" in the bin directory sets a few environment variables that help with compiling, linking, and locating build outputs.
My activate.sh file currently looks like this:
export PATH=$HOME/code/hoop/bin:$PATH
export CPATH=$HOME/code/hoop/include:$CPATH
export LD_LIBRARY_PATH=$HOME/code/hoop/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$HOME/code/hoop/lib/pkgconfig:$PKG_CONFIG_PATH
I'll probably do everything differently in a few weeks, but I expect to have written some code to be proud of in the interim.