Switch to cmake
64-bit compatibility
Fix some warnings