Hi all,
I am now using fpm for a fortran project and I have two questions:
First: it doesn’t appear to be possible to change the default compiler flags corresponding to the build
and debug
profiles. When looking at the output from `fpm build --verbose’, I can see that the compiler flags are:
-cpp -Wall -Wextra -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -fcoarray=single -fopenmp
However, if, for example, I wanted to have -fcheck=all
enabled, I could call fpm build --flag -fcheck=all
, (and I would also have to manually add the other flags which I would like to keep). Ideally, I would like to be able to configure the default compiler flags corresponding to the debug
and release
profiles, so that I don’t have to remember or copy/paste the flags each time. Based on the manifest reference it doesn’t seem possible to do it within fpm.toml
. Therefore, are my only options to:
a) Modify the environment variable FPM_FFLAGS? When I do this I see that the flag is added to the default flags, but it doesn’t seem to allow differentiating between debug and release builds nor does it allow for removing any of the default flags.
b) Write a script which calls fpm? Therefore I can configure the script to always call fpm with whichever flags I like using --flag. Then I can have a different script (or define my own flags for the script) for debug vs release builds. Or
c) Use a makefile for complete build control? I would prefer not to do this since I’ve never used make and would rather avoid having to learn another new tool (also I’m on windows so it’s slightly more annoying).
I’m leaning toward option b) since it seems relatively simple, but I’m wondering if I’m missing something more straightforward. And is the lack of configuration available through the manifest intended or is this something which may be added in future releases?
Second: when I call fpm build, the warnings for each file (from -Wall
and -Wextra
) are written to log files in the build folder. However, I would like to see the warnings directly when I run fpm build. Is it possible to tell fpm to print the warnings directly to the terminal? Or to a single file. I don’t see such an option available in the documentation. The inconvenience here is that if I have several modules I have to manually check each log file in order to see any compiler warnings. Here I can also write script to automate this (e.g., to combine all the log files), but I was wondering if I can avoid this.
I am quite new to formal software development procedures, so feel free to correct me if I have some fundamental misunderstanding in terms of how I’m approaching fpm as a tool.
Thank you for any and all help with this!