Windows C++ binary compatibility: MinGW vs MSVC

OK, is there an example script on how to do the cross-compilation then? Could it also be done from cygwin? That way I could use Appveyor (which has cygwin too) to build the binaries automatically upon committing and upload binaries to github upon tagging (this is related to the thread about uploading binaries, Appveyor works very well for that, I’ll update that topic once the correct binaries are built and I can test a complete release).