Visual Studio support

Added cmake-based visual studio support.  The majority of changes were pure infrastructure; lots of includes fence-posted with #ifdef's, the inclusion of a couple of functions built when needed (since MSVC is not `C99` compliant), and a bit of rewiring externals using `#define` to set up proper import/export libraries on Windows.

Tested with Visual Studio 2010, 32 and 64-bit builds.  Also tested on OSX to make sure nothing was inadvertently broken.