closes #1221, closes #1219, closes #1222, closes #1223
Some more compatibility for Qt5&6, and first try at build scripts.