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!

38 Likes

Is the fortran-lang/setup-fpm@v7 GitHub Action getting 0.13.0? It doesn’t seem to be for me.

1 Like

Oh, I see there is a v9 (which is getting 0.12). I guess a new update is needed to get 0.13?

1 Like

fpm-version is the variable for your action, it’s discussed at length in GitHub - fortran-lang/setup-fpm: GitHub Action to setup the Fortran Package Manager for CI on Ubuntu, MacOS and Windows. · GitHub

1 Like

I am starting to learn fpm, so please indulge me here.

In the GitHub page, the preferred ways to install fpm are either using conda-forge or homebrew. Both options install a containerized version of fpm in the user’s home (well, I know that conda does).

However, I prefer the old-fashioned system-wide installation (in /usr/local/bin). So I would rather manually download the tarball and compile locally. This is how I installed version 0.12 of fpm

Now I wonder if the whole task of checking the latest version in the GitHub repository, download the master file, build the latest version locally and installing it system-wide can be performed with the previously-existing version?

Or do I need to write a bash script to accomplish all these steps?

Thanks.

You can, but you don’t have to:

Or do I need to write a bash script to accomplish all these steps?

The script is already included in repository. You only need a Fortran compiler to bootstrap fpm.

All the installation options are documented in the link above, including the use of the installation script as @certik mentioned. If you have a system-wide python installation you can also use pip install fpm.

On Ubuntu I use the installation script, on windows I use winget.

1 Like

All you have to do to manually install fpm (Unix/macOS) is run the install.sh script in the repository root: it will automatically download a “safe” previously existing version (0.8.0) and it will use that to build and install the most recent one.

You only have to ensure is that either curl or wget is installed in your system.

Guix-science channel updated:

2 Likes