# Preparing minimalistic binary package for CI (use of cpack and disabling modules)

**URL:** https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937
**Category:** Support
**Created:** [January 1, 2021, 10:53pm UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937 "2021-01-01T22:53:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dsemikin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dsemikin/32/2492_2.png) [@dsemikin](https://discourse.vtk.org/u/dsemikin)
#### Post date: [January 1, 2021, 10:53pm UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/1 "2021-01-01T22:53:54Z")

</div>

Hello,

I have two questions (for the background see below):

**Question 1:**  
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](https://github.com/DmitrySemikin/vtk-mirror/commit/900c17ae0d17ba65155675b9afd0309e326bb468))

**Question 2:**  
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.

**Background**  
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](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](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.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [January 1, 2021, 11:57pm UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/2 "2021-01-01T23:57:02Z")

</div>

Regarding Question 2, I don’t think it’s possible to set `DONT_WANT` for all modules in one go.

The best you could do I think is to use `VTK_GROUP_ENABLE_<name>=DONT_WANT`, for all groups. That way you only have to specify it for every group, not for every module (and new groups are added more seldom than modules). I may be wrong and there’s some hidden way to do it for all modules though. I think @ben.boeckel will know.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [January 2, 2021, 12:18am UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/3 "2021-01-02T00:18:09Z")

</div>

Looking at the CMakeLists.txt of VTK, it seems only the StandAlone and Rendering groups are [turned on by default](https://gitlab.kitware.com/vtk/vtk/-/blob/master/CMakeLists.txt#L207-209), so maybe it would be enough with something like

```
cmake \
    -DVTK_GROUP_ENABLE_StandAlone=DONT_WANT \
    -DVTK_GROUP_ENABLE_Rendering=DONT_WANT \
    -DVTK_MODULE_ENABLE_<the_module_you_need>=ON

```

to get the minimal VTK you need.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 2, 2021, 12:32am UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/4 "2021-01-02T00:32:05Z")

</div>

> [@dsemikin](#):
>
> I would like to pack VTK binaries using CPack.

In the VTK-based projects that I know of, it is always the application that uses VTK creates the package and therefore only the application needs to include CPack.

---

<div class="post-metadata">

### Author: ![dsemikin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dsemikin/32/2492_2.png) [@dsemikin](https://discourse.vtk.org/u/dsemikin)
#### Post date: [January 3, 2021, 12:22am UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/5 "2021-01-03T00:22:25Z")

</div>

@lassoan:  
Thank you. I take it as “nobody except me ever wanted it” :).

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [January 4, 2021, 9:58am UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/6 "2021-01-04T09:58:25Z")

</div>

You may want to take a look at F3D: [https://gitlab.kitware.com/f3d/f3d](https://gitlab.kitware.com/f3d/f3d)

> I would like to pack VTK binaries using CPack.

We took the easy way and built VTK statically for the release.

> 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.

See our gitlab-ci. We use the cache of the buildbot to avoid rebuilding VTK everytime.

---

<div class="post-metadata">

### Author: ![dsemikin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dsemikin/32/2492_2.png) [@dsemikin](https://discourse.vtk.org/u/dsemikin)
#### Post date: [January 4, 2021, 2:36pm UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/7 "2021-01-04T14:36:16Z")

</div>

@mwestphal:  
Thank you. Nice to have it as a reference - to see, which build customizations are also available (like e.g. `VTK_LEGACY_REMOVE`). But I still prefer explicit download. I am not sure, how exactly build caches are handled by different CI systems, but e.g. Travis-CI explicitly tells, that caches should not be used to cache build artifacts. And in GitHub actions I believe artifats are similar to build cache. But I prefer “release artifacts” because for them the retention policies are more obvious and the whole logic is more explicit and thus more clear (at least IMO).

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [March 22, 2021, 12:31am UTC](https://discourse.vtk.org/t/preparing-minimalistic-binary-package-for-ci-use-of-cpack-and-disabling-modules/4937/8 "2021-03-22T00:31:31Z")

</div>

VTK tries to be relocatable in its install tree, so you should be able to install VTK and just pack up its install tree in a tarball. CPack does do that, but it’s not a setup we’ve typically used (VTK is now released as a source-only distribution due to the difficulties of making a VTK binary release which works for even a majority of people).
