mingw-w64 fixes

These fixes will allow building with minw-w64, however the cmake-build system is way far from ours with those pre-compiled headers so it would need to be re-factored. Mostly things are just changing MSVC to WIN32 but pre-compiled headers need some more thinking. I tried to factor it out but for some reason changes in sys_defines.h didn't propagate. I am assuming it's related to header compilation so I didn't investigate further, and the build system changes I made were just the same that we have under neo/ on the master branch regarding to unix.cmake and windows.cmake targets. Of course I recommend to switch in to our model of building where we could propose the changes nicely between the branches.