FPM version 0.13.0 released

FPM v0.13.0: Features, Profiles, and CPP Macro Parsing

Happy to announce the release of the Fortran Package Manager v0.13.0! This is a substantial release that introduces a build customization system we’ve been working toward for a long time: features and profiles.

:puzzle_piece: Features and profiles

fpm now supports features and profiles, a system for conditional compilation, compiler-specific settings, and platform-dependent behavior – all from your fpm.toml manifest. This has been one of the most requested capabilities in the project, and getting the design right took considerable effort across several PRs (#1177, #1181, #1243, #1244).

Features are configurable collections of package properties – flags, dependencies, preprocessor macros, library settings – that can be selectively enabled based on compiler, OS, or user choice. Profiles are named bundles of features, activated via the --profile CLI flag:

[features]
debug.flags = "-g -Wall"
debug.gfortran.flags = "-fcheck=bounds"
debug.gfortran.linux.flags = "-fsanitize=address"
release.flags = "-O3"
release.gfortran.flags = "-march=native"
mpi.dependencies.mpi = "*"
openmp.dependencies.openmp = "*"

[profiles]
debug = ["debug"]
release = ["release"]
parallel = ["release", "mpi", "openmp"]
fpm build --profile parallel
fpm test --profile debug
fpm build --features release,openmp

The system supports platform-specific resolution (compiler + OS selectors can be combined in any order), a default profile for baseline settings that are always applied, and the ability to request specific features or profiles from dependencies:

[dependencies]
my-lib = { git = "https://github.com/user/my-lib", profile = "parallel-mpi" }

The full specification is available in the features and profiles reference.

:magnifying_glass_tilted_left: CPP preprocessor source parsing

A long-standing pain point has been fpm’s inability to correctly resolve module dependencies when use statements sit behind CPP conditionals. v0.13.0 addresses this: fpm now evaluates #ifdef, #ifndef, #if defined(), #if MACRO == VALUE, #elif, and #else directives against manifest-defined macros during source parsing. This means your dependency graph is resolved accurately based on your actual build configuration, without needing a separate preprocessing step.

[preprocess.cpp]
macros = ["USE_MPI"]
#ifdef USE_MPI
  use mpi_f08
#endif

Built up incrementally over several rounds (#1179, #1218, #1232), we now cover the full range of CPP conditional syntax including boolean evaluation, case sensitivity, and NAME=VALUE comparisons. This is particularly important when different combination of features/profiles are employed, as used modules from different packages can now safeguarded within pre-processor macro blocks.

:package: Other highlights

  • Multiple simultaneous library targets – build both shared and static libraries with type = ["shared", "static"] (#1168)
  • Dependency metapackage propagation – metapackages like OpenMP, MPI, BLAS are now correctly propagated through the dependency tree (#1220)
  • Custom build folder via --build-dir (#1173)
  • Selective cleanfpm clean --test, --apps, --examples (#1171)
  • Custom module install directory (#1170)
  • macOS @rpath standardization for dynamic libraries (#1146)
  • macOS ARM64 and Intel x86_64 release artifacts now included (#1227)
  • gcc-15 compatibility fixes (thanks @krystophny in #1150)
  • FlexiBLAS added to the BLAS metapackage (thanks @grisuthedragon in #1241)
  • Source parsing performance optimizations (#1221)
  • Expanded compiler support. LLVM Flang (flang-new) and AMD’s amdflang are now first-class citizens in fpm, thanks to @rouson and @jorgeg who contributed patches (#1174, #1196, #1176).

:waving_hand: New contributors

Welcome new contributors: @Albkat, @SamueleGiuli, @jorgeg, @mskocic, @jinangshah21, and @grisuthedragon. Thank you for your contributions!

:down_arrow: Get it

Download from the GitHub release page, or install via fortran-lang/setup-fpm in CI. The full changelog is available in the comparison view.

As always, feedback, bug reports, and contributions are welcome. Let us know how features and profiles work for your projects!

17 Likes