build.py: do not generate if cache already exists
build.py: exit after `--open` (do not start test)
build.py: refactor for future
build.py: add `--pack` option (run cpack after build)