Support for windows building

This is incomplete, but should not break any other platforms currently.

@ZhaoXiangXML care to try the build again from this branch?