Add c++ bindings and add minor optimisation for not rebuilding when it's already built