Fpm: profiles and file-dependent flags

Real world case

Hi, reviving the post to ask for support defining file-dependent compile flags via response files, if possible.

I want to make SciFortran[1] build (and even more importantly run a testsuite) via fpm as soon as possible. The long term goal would be to fpm-ize all the downstream condensed matter libraries we have and eventually just have a fpm.toml manifest for each single research project.
With respect to our current CMake build system (which is very functional as far as build and installation are concerned), I see the huge advantage of an exact version management of all the needed libraries: currently each driver program depends on SciFortran, DMFT-tools and usually another techinique-specific “solver” library (DMFT, Slave-Spins, Exact Diagonalization, etc…), so that a manual version management of each combination is quite a nightmare.
Basically in the research group people either update everything constantly (what I do), potentially dealing with annoying regressions if they manage their way to a git tag (it happens…) or totally freeze the whole environment, tipically for years (that is normally done by people doing “applied research” with long established “options”, I could never do that as I’m developing extensions to our solver libraries). I truly think fpm would drastically improve each one’s workflow and alleviate tremendously collaborations.

For SciFortran, currently, I believe the only one crucial thing I am missing is exactly support for file-dependent compilation flags, similarly to OP in that we have many legacy files here and there. The situation is quite pervasive, but just to give an example

minimize_krauth.f is a fixed-form external procedure, that is being called within a modern interface. The main pain point for fpm is that this procedure actually uses an implicit mapping together with several deprecated/removed legacy features, so it won’t compile with our debug profile (for gfortran: -O0 -p -g -fimplicit-none -Wsurprising -Waliasing -fwhole-file -fcheck=all -pedantic -fbacktrace -ffree-line-length-none).

In the CMake configuration we just define a weaker set of flags just for the legacy files, any idea on how to tackle this with an appropriate response file? Also, would it work when listing SciFortran as an fpm-dependency for another library? (i.e. can I make fpm call the custom response profile, instead of the default build?).

This would already go a long long way…


  1. GitHub - QcmPlab/SciFortran: A library of fortran modules and routines for scientific calculations (*in a way* just like scipy for python) ↩︎