Skip to content

Compiling the code

Matt Hipsey edited this page Aug 30, 2026 · 2 revisions

Note

This page is a stub. The build options below are taken from build_glm.sh in the GLM 4 source, but the prerequisite lists and platform-specific notes still need to be written.

There are two ways to obtain and build the model source, depending on whether you want a stable build or are working on the development versions.

Entry point Use when
1 This repository (glm-aed) You want to build the stable, released GLM-AED bundle
2 AED_Tools / AED_Tools_Private You are developing the model, or need the development source trees and "plus" modules

Most users want option 1.


1. Building from this repository (stable)

This repository carries the GLM-AED source as a fixed set of sub-module commits, so it builds a known, reproducible version of the model. Once you have downloaded the code, build from the glm-source directory:

cd glm-source
./build_glm.sh

Automated builds of this repository are performed by the GitHub Actions workflow at .github/workflows/compile.yml, which is the authoritative reference for a known-good build environment.

Build options

build_glm.sh accepts the following arguments:

Option Purpose
--help List available options
--auto-prereq Attempt to install prerequisites automatically
--with-aed / --without-aed Build with or without the AED water quality libraries
--with-aed-plus / --without-aed-plus Build with or without the additional AED "plus" modules
--with-lib / --without-lib Build GLM as a linked library
--no-gui Build without plotting/display support
--debug Build with debugging enabled
--mdebug Build with mixing debug output
--checks Enable runtime checks
--fence Enable memory fencing

A compiler is selected with one of --gfort, --ifort, --ifx, --clang or --flang.

Build configuration is otherwise controlled by build_env.inc and build_aedlibs.inc in glm-source. Use clean.sh to remove build artefacts.


2. Building via AED_Tools (development)

For users working on the model rather than simply running it, AED_Tools is the preferred starting point. Rather than carrying the source itself, it provides scripts that fetch and update the source trees directly from their own repositories — so you work against live development branches rather than the pinned sub-module state in this repository.

AED_Tools provides:

  • fetch_sources.sh — download or update the source trees (Unix and Windows variants),
  • build scripts for each supported model, including build_glm.sh, build_aedlibs.sh, build_aed-fv.sh, build_elcom.sh, build_schism.sh, build_swan.sh and build_modflow6.sh,
  • shared build configuration in build_env.inc and build_aedlibs.inc,
  • scripts under admin to help track changes across the source trees and manage commits.

Important

fetch_sources uses SSH to reach GitHub, so it will only work once you have set up an SSH key on your GitHub account.

AED_Tools_Private is the equivalent repository for AED internal use. It additionally supports the "plus" versions of the software and has limited support for building TuflowFV. Access is restricted to the AED group.

Use this route if you need to build development versions, work across more than one AED-coupled model, or contribute changes back to the source repositories.


Still to document

  • The prerequisite packages for each supported platform (notably NetCDF and the Fortran compiler).
  • Which compiler versions are currently known to work, and known-bad combinations.
  • Building on Windows.
  • A fuller walkthrough of the AED_Tools workflow, including the admin change-tracking scripts.

Clone this wiki locally