Add automatic build number generation, fix compilation errors on MinGW on Windows and update documentation