Custom Spack Installation

Building Spheral TPLs with your own Spack installation will require deeper knowledge of how Spack works. All of the steps to set up Spheral with your own spack installation are not detailed here, however you will want to at least:

  • Point your spack instances repo at the scripts/spack/packages/ dir. This contains all of our changes to spack packages that have not yet made it to upstream Spack.

  • You will want to model your compiler.yaml and packages.yaml files off of those found in scripts/spack/configs/ (Spack Configuration Files).

Further notes on setting up Spack and how it is used with the Spheral dev-tools scripts can be found in Development Documentation: Spheral Spack / Uberenv.

CMake Configurations

This section outlines the common CMake options Spheral provides for configuring how to build Spheral.

C++ Only Build

If you do not need to build the Python interface you can build the compiled C++ libraries alone with -DENABLE_CXXONLY=On. This will skip the Python wrapping stage of the build.

By default Spheral builds the libraries as shared objects. If instead you would like to build the C++ libraries as static libs use -DENABLE_STATIC_CXXONLY=On.

Third party libraries and Spheral

For just the C++ compiled Spheral a number of TPLs are required:

  • Zlib

  • Boost

  • Python

  • Eigen

  • Polytope

  • HDF5

  • Silo

  • Qhull


  • Opensubdiv

  • Polyclipper

  • Conduit

  • Axom

There are also a number of libraries / python packages that are required for compiling the python bindings and executing Spheral at runtime:

  • Python

  • pip

  • setuptools

  • pybind11

  • pyb11generator

  • sphinx

  • sphinx_rtd_theme

  • Scipy

  • Sobol

  • Cython

  • Twine

  • h5py

  • decorator

  • Matplotlib

  • mpi4py

  • Numpy-stl

Custom TPL Installation

You can build the Spheral TPLs manually or even with your own spack installation to bypass the use of Custom built TPL installations can be passed to Spheral’s CMake with -D<tpl-name>_DIR=<tpl-install-prefix>.

cmake -DBOOST_DIR=$HOME/my_boost_build_dir ...


OpenMP and MPI support is handled through BLT. Use the option flags -DENABLE_OPENMP and -DENABLE_MPI respectively, choosing ON or OFF as appropriate.

CMake variables

In this section we list the CMake variables that can be tweaked for a Spheral build. Where appropriate the options are listed, with the default value in italics.

CMAKE_BUILD_TYPE (Debug, Release, RelWithDebInfo, MinSizeRel)

Choose the type of build – for more information see the CMake documentation.


The top-level path for installing Spheral include files, libraries, and any Python modules or documentation.


Do not build python wrappers for Spheral.


Do not build python wrappers for Spheral. Build and export static library files for Spheral.


Build Spheral C++ libraries as shared libraries.


Builds separate internal C++ libraries for faster code development.


Directory of previously built TPL.


Link static libraries instead of shared for HDF5 and Conduit.


Support for OpenMP.


Support for MPI.

ENABLE_1D (On, Off)

Build Spheral with 1D support.

ENABLE_2D (On, Off)

Build Spheral with 2D support.

ENABLE_3D (On, Off)

Build Spheral with 3D support.


Install the ANEOS (Analytics Equation of State) package along with the Spheral interface to it. This is a legacy equation of state frequently used for geophysical materials. See descriptions in the iSALE documentation.


Compile the included Helmholtz equation of state, typically used in astrophysical calculations. See a discussion here.


Install the Opensubdiv library along with the Spheral interface to it. Opensubdiv is a Pixar provided library, which Spheral uses to implement refinement of polyhedra for some specialized problem generation capabilities.


Enable timer information from Spheral.

DBC_MODE (None, All, Pre)

Set the compile time design by contract (DBC) mode for Spheral. Design by contract statements are very useful developer tools, whereby the developer can insert tests in the code as they write it. These statements are both useful for tracking down bugs with fine-grained testing throughout the code, as well as useful documentation in the code about what sort of conditions are expected to hold.


Design by contract not enforced


All design by contract (REQUIRE, ENSURE, CHECK) statements active


Only prerequisites (REQUIRE) statements active

Note the default depends on the CMAKE_BUILD_TYPE:

CMAKE_BUILD_TYPE=Debug default DBC_MODE is All

In all other cases the default is None.

It is worth noting DBC_MODE=All is quite expensive at run time (of order 4x more), so this is not intended to be active for a release/production compilation of Spheral.


Enable compiler warnings.


If building with the Gnu compilers enable STL bound checking by passing -D_GLIBCXX_DEBUG=1 to the compiler. Note, this is a very expensive option at runtime!


Raise exceptions in the C++ code when floating-point exceptions occur. Gnu compilers only.


Choose whether or not to build this documentation.


Specify where the Sphinx executable is that should be used to build documentation. If not given, assumes the Spheral built Sphinx will be used.

SPHINX_THEME (sphinx_rtd_theme)

Give the Sphinx theme to use when generating documentation. Default based on read the docs theme.


Where to look for Sphinx themes.