Building GEOS
This page is a reference for the GEOS build. For a step-by-step walkthrough, see the Quick Start Guide.
Build steps
Create a host-config file that sets all system-specific CMake variables. Start from
host-configs/quick-start-template.cmakeor one of the host-config examples. Use the same host-config for both TPL and GEOS builds: certain options (such asENABLE_MPIorENABLE_CUDA) need to match between the two.Provide paths to all enabled TPLs. This can be done in one of two ways:
If you built the TPLs with the thirdPartyLibs repository, set the
GEOS_TPL_DIRvariable in your host-config to the TPL installation path, andinclude("/path/to/GEOS/host-configs/tpls.cmake")
which will set all the individual TPL paths for you.
Otherwise, provide each path via a separate CMake variable (see Third-party dependencies for path variable names).
Configure via the
config-build.pyscript:cd GEOS python3 scripts/config-build.py --hostconfig=/path/to/host-config.cmake --buildtype=Release --installpath=/path/to/install/dir
where
--hostconfigor-hcis a path to the host-config file.--buildtypeor-btis a wrapper to theCMAKE_BUILD_TYPEoption (Release,Debug,RelWithDebInfo).--buildpathor-bpis the build directory (by default, created in the current working directory).--installpathor-ipis the installation directory (wrapsCMAKE_INSTALL_PREFIX).--ninjaor-nuses the Ninja generator instead of Makefiles.all unrecognized options (typically
-D<OPTION>=<value>) are passed to CMake.
If
--buildpathis not used, the build directory is namedbuild-<config-filename-without-extension>-<buildtype>. It is possible to keep automatic naming and change the build root directory with--buildrootdir.--buildpathand--buildrootdircannot be used at the same time. The same pattern applies to the install path, with--installpathand--installrootdir. Runpython3 scripts/config-build.py -hfor the full list.Warning
config-build.pydeletes the build directory if it already exists.Run the build:
cd <buildpath> make -j $(nproc) make install
You may also run the CMake configure step manually instead of relying on config-build.py.
A full build typically takes between 10 and 30 minutes, depending on chosen compilers, options and number of cores.
Configuration options
Below is a list of the most useful CMake configuration options, in addition to the TPL options listed in Third-party dependencies.
Some options, when enabled, require additional settings (e.g. ENABLE_CUDA).
Please see the host-config examples.
The authoritative list, with default values, is in src/cmake/GeosOptions.cmake.
General options
Option |
Default |
Explanation |
|---|---|---|
|
|
Build with MPI (also applies to TPLs) |
|
|
Build with OpenMP (also applies to TPLs). Defaults to |
|
|
Build with CUDA (also applies to TPLs) |
|
|
Enable CUDA NVTX user instrumentation (via GEOS_MARK_SCOPE or GEOS_MARK_FUNCTION macros) |
|
|
Build with HIP/ROCm (also applies to TPLs) |
|
|
Where hypre runs: |
|
|
Choice of linear algebra backend ( |
|
|
Build the |
|
|
Build documentation (Sphinx and Doxygen) |
|
|
Treat all warnings as errors ( |
|
|
Enables code coverage |
|
|
Enables TotalView debugger custom view of GEOS data structures |
|
|
Enables unit testing targets |
|
|
Enables floating point exceptions (traps on invalid operations, divisions by zero and overflows) |
|
|
Enables array bounds checking (always |
|
|
Build coreComponents modules as CMake object libraries |
|
|
Build |
|
|
Maximum component count instantiated in compositional flow solvers (3 to 20) |
|
|
Choiсe of Linear Algebra backend (Hypre/Petsc/Trilinos) |
|
|
Use CMake Object Libraries build |
|
Max. number of compile jobs (when using Ninja), in addition to |
|
|
Max. number of link jobs (when using Ninja), in addition to |
|
|
|
Enables schema generation and installation |
|
|
Query git for version metadata printed at startup |
Physics packages
Each family of physics solvers can be disabled to reduce build time and binary size. All packages are enabled by default.
Option |
Package |
|---|---|
|
Single-phase, multiphase and compositional flow, wells |
|
Solid mechanics, including contact mechanics on fractures and faults |
|
Coupled solvers (poromechanics, hydraulic fracturing, …) |
|
Fracture surface generation |
|
Acoustic and elastic wave propagation |
|
Induced seismicity |
|
Simple PDE solvers (Laplace, phase-field damage) |
Note
The multiphysics package links against the fluid flow, solid mechanics, simple PDE and surface generation packages,
so these must stay enabled when GEOS_ENABLE_MULTIPHYSICS is ON.