I have two questions (for the background see below):
I would like to pack VTK binaries using CPack. But it seems, that it is not supported (or at least not considered) because I don’t see “include(CPack)” in CMakeLists.txt, and the verison somehow seems to be broken, once one runs cpack.
Simply adding the line “include(CPack)” at the end of the “CMakeLists.txt” did the trick (except versions, which is not very critical for me), and the binary package seems to work. But my question is: why is CPack not enabled? Are there any issues with it, or just nobody needed it?
(the exact change can be seen here: https://github.com/DmitrySemikin/vtk-mirror/commit/900c17ae0d17ba65155675b9afd0309e326bb468)
There is a nice possibility to disable modules by using CMake variables VTK_MODULE_ENABLE_VTK_moduleName. But the eproblem with this approach is, that if one needs to use only couple modules, then she/he needs to disable (or set to DONT_WANT) all the others. Besides, new modules will not be excluded by default. The question is: is there any possibility to disable all modules by default except for explicity specified ones.
For my small project, which uses VTK I wanted to setup a CI, which for now just builds the project on linux. As the project is on GitHub, it seemed more or less logical to use GitHub Actions as a CI engine.
But to build the project I of course need VTK binaries. One solution would be to build VTK every time I build the project, but half an hour build of VTK to enable 10 seconds build of my project seems like an overkill… After some experimenting I found out, that I can create a binary package compatible with the environment used in CI, and I can make it relatively small by disabling most of the modules (currently the size is about 25M, which can be downloaded and unpacked in couple seconds by github actions). This is why I need to package the binaries (and cpack is the easiest way, if it works), and disable modules.
Just in case anyone is interested, how it was done, VTK was built in this repo (also using github actions to be sure, that the environment is the same): https://github.com/DmitrySemikin/vtk-mirror (branch: prepare-for-github-actions). The binaries generated by action were first published as artifact, then manually downloaded and published as release (I know, that I can be automated, but I don’t really need it).
Then in this repo: https://github.com/DmitrySemikin/das-mesh-workbench I just download the package with wget, unpack it and use for build while setting CMAKE_PREFIX_PATH to the extracted directory. Seems to work fine. The whole build takes about 1 minute, which I find acceptable.