Tuesday, July 17, 2012
C/C++ world, please do yourselves a favour..
..and make it donkey easy to build your projects. I was looking for C/C++ JSON libraries. JsonCpp seemed to fit the bill, but has silly build bits. They do have the amalgamated version, but it's not in the latest stable release. They seem to use scons python build tool for the normal src build. Hadn't heard of that one, so not a great start. Fortunately, the amalgamated one just needed:
g++ main.cpp jsoncpp.cpp -I . -DJSON_IS_AMALGAMATIONI have some chunky JSON files (> 100MB), so wanted a streaming API. I found YAJL, but it failed to build on cygwin. A symlink (api/yajl -> api), a file copy (yajl_version.h.cmake -> yajl_version.h), with a single line change (defining YAJL_VERSION to be a number), and presto:
gcc *.c -I apiIt's much easier to understand the dependencies like this, I reckon, than trying to work out why the build system is breaking.