[CMake] Managing a local installation of cmake-built open source packages

Elizabeth A. Fischer elizabeth.fischer at columbia.edu
Thu Jan 19 11:09:10 EST 2017


Aldi,


> I believe spack is the closest to what I need. However, all these
> solutions (hunter, conan, spack...) have perhaps their strongest focus
> in packaging, dependencies, automatic downloads, etc... while I prefer
> to do all such tasks myself.  I prefer to not have packages, just

download the source in the original developer provided form, untar it,
> and to even build it on my own, following the developer instructions.
>

That is exactly what Spack does.  A Spack "package" is really just a recipe
that automates those tasks.  I think of the Spack recipe as a Python
encoding of the English-language build instructions.  In fact, when I want
to know how a package is built, I prefer to look at the Spack recipe.  It's
more concise than English, and frequently more complete.


> As I said, I think spack is the closest. However, I feel it tries to
> automate too much the build. Yes, it gives you a lot of customization
> options, but I'm not sure the complexity is worth the effort.
>

Spack should work out-of-the-box without customizing things.  Many of the
features --- shell integration, environment modules, etc --- are not
strictly necessary.

You might be interested in the `spack setup` command, which currently works
with CMake-based projects.  It is especially good for projects you're
developing, or otherwise already have the source code in your directory.  I
use this feature to configure all the projects I'm working on.  To use
Spack setup, you do the following:

 1. Download and untar the software yourself, in your favorite location.
 (This is especially useful for development versions that don't yet have a
tarball).
 2. Run `spack setup`.  This creates a script whose purpose it is to call
CMake with appropriate options for dependencies and install location.
 3. Run the Spack-generated script in place of CMake
 4. Build and install yourself.

http://spack.readthedocs.io/en/latest/workflows.html?highlight=spack%20setup

Here's an example...
$ tar xvfz myproject.tar.gz
$ cd myproject
$ spack setup myproject at develop
$ mkdir build
$ cd build
$ ../spconfig.py ..   # Calls through to CMake
$ make
$ make install


> I think that by using this approach, I could reconsider moving to
> spack in the future (I'd likely have to install all packages from
> scratch if I move to spack later, but my directory hierarchy will end
> up being the same, so all the work I do now -writing code and
> projects- would be reusable without modification).
>

With an auto-builder, I've found that re-installing everything is no big
deal.  I can re-install 100 packages in a few hours of wall time, and no
more than a few minutes of my time.

-- Elizabeth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170119/6a573fd5/attachment.html>


More information about the CMake mailing list