Making it easier to share efficient cross-platform code with others keeps me busy. I continue sharing a few thoughts about build systems, software licenses and code re-usability.
premake a try. I’m happy to report that it is doing a great job so far. Even though I had never used premake before, it only took an afternoon to have it auto generate Visual Studio, Mac OSX Xcode projects and Unix Makefiles the way I like it.
Premake takes away the suffering from cmake: its project files use relative paths so you can share its generated project files with others. Also it is easy to customize the various project configurations within one solution (32/64bit etc). You can see the result in a code base called Physics Effects that I recently open sourced together with Sony Computer Entertainment Japan. Just download a zipfile from jiglib etc.
In general it is best to avoid using code released under viral licenses such as LGPL and GPL in shipping games. Those licenses conflict with many non disclosure agreements (NDAs) and publishers won’t allow you to use those licenses. Just pick a permissive license if you want to share code with other game developers. If you are interested learning more about all aspects of open source, check out the book called ‘Producing Open Source’, there is a free download at free coding style, previously mentioned by Alex Evans.
Unfortunately when sharing collision detection and game physics snippets, it is often impractical to write code without at least a vector math library. At minimum it is convenient to have access to operators working on a float3/float4 vectors, unit quaternions and 3×3 and perhaps 4×4 matrices.
Switching to different underlying vector math library can be very labor intensive and error-prone, if you miss certain subtle details of those libraries. In some cases when merging several large software components, it can be better to leave each component using their own vector math libraries, rather than rewriting all using a common vector math library.
While merging Physics Effects with Bullet, I plan to replace Bullet’s current math library with Sony’s Vector Math library and let you know how things go.