Skip to content

Building from Source ​

AeroLiners Set uses CMake to organize the build: first the .pnml sources are expanded into a single .nml via the C preprocessor, then compiled into the final .grf with nmlc, and finally packaged into .tar release bundles.

Build dependencies ​

ToolPurposeGet it
C compiler (GCC/clang/MSVC)Used only as a C preprocessor to expand #include/#define in .pnmlSystem / MinGW
nmlcCompiles .nml into .grf (NML compiler)https://github.com/OpenTTD/nml/releases/latest
grfid (grfcodec suite)Computes the .grf MD5, processes doc templateshttps://www.openttd.org/downloads/grfcodec-releases/latest
CMake ≥ 3.23Build systemSystem package manager
Generator: Ninja / Make / VSActually runs the buildPick one

Windows users: install MSYS2 + MinGW to get make, gcc, sed, awk, etc. all at once. Other Unix-like systems usually already have them.

Build steps ​

1. Configure ​

Use CMake Presets to choose a generator (generated files land in build/<generator>/):

bash
# Ninja
cmake --preset ninja

# or Make
cmake --preset make

# or Visual Studio 2022
cmake --preset vs

2. Build ​

bash
# Ninja (default, non-verbose)
cmake --build build/ninja --preset ninja-default

# Make
cmake --build build/make --preset make-default

# Visual Studio
cmake --build build/vs2022 --preset vs-default

The build runs these custom targets in order:

  1. NML — expand WAS.pnml (summing src/header.pnml etc.) into bin/AeroLinersSet.nml via the C preprocessor.
  2. GRF — compile the .nml into bin/AeroLinersSet.grf with nmlc.
  3. Bundles (default ALL) — package the .grf and docs (readme.txt / license.txt / changelog.txt) into .tar / .tar.bz2 / .tar.gz / .tar.xz.

Build artifacts are in the bin/ directory.

3. Clean and rebuild ​

bash
cmake --build build/ninja --target clean        # clean intermediates
# or target a single step
cmake --build build/ninja --target NML
cmake --build build/ninja --target GRF

Verbose output ​

To see the full command lines, use the build preset with the -verbose suffix (sets CMAKE_VERBOSE_MAKEFILE=on and VERBOSE=on):

bash
cmake --build build/ninja --preset ninja-verbose

Build flow ​

text
WAS.pnml (include aggregation)
   │  C preprocessor (gcc -E)
   ▼
AeroLinersSet.nml
   │  nmlc -c
   ▼
AeroLinersSet.grf
   │  grfid -m + doc templates
   ▼
.tar / .tar.bz2 / .tar.gz / .tar.xz  (release bundles)

Notes ​

  • Version / revision: CMakeLists.txt computes "days since 2000-01-01" as REPO_REVISION via string(TIMESTAMP), writing it into custom_tags.txt for the NewGRF version field.
  • Multiplayer compatibility: if you modify the source, the compiled .grf will no longer be multiplayer-compatible with the official AeroLiners Set. Different grfcodec/nmlc versions also change the GRF checksum and break compatibility.
  • Do not hand-edit Makefile / CMakeCache.txt: they are generated by CMake.

Back: Project Structure → | Next: Liveries & Graphics →