Skip to content

rules_fortran

Period2025 ~
RoleMaintainer
Platform
Open Source
Tech
BazelFortranStarlark

Overview

rules_fortran is an open-source Bazel ruleset for Fortran projects. It focuses on straightforward setup, reproducible builds, and practical workflows for mixed-language codebases.

Goals

  • Make Fortran targets first-class in Bazel-based workflows.
  • Reduce setup friction for scientific and engineering projects.
  • Keep build logic readable, versioned, and easy to reuse.

WASM Support

rules_fortran is designed to work well with @miinso/flang (flang-releases), which provides Flang binaries with wasm32 cross-compilation support and includes libflang_rt.runtime.wasm32.a.

This makes it practical to compile Fortran sources for wasm32-unknown-emscripten and link them with Emscripten while keeping everything in one Bazel build graph.

With rules_fortran, toolchain wiring stays simple:

python
load("@rules_fortran//fortran:repositories.bzl", "flang_register_toolchains")

flang_register_toolchains()