Add scripts to build windows dependencies, and some build fixes