GSoC 22: fpm-ize the Fortran Ecosystem || Blog Post by Arteev Raina || #4

Good Day Everyone,

This week marks the second week of the coding period of the GSoC 22 program. I was not that active last week because of unavoidable circumstances at my place. But, I am looking forward to getting back on track this week with better energy.

I am sharing a finalized syntax for the manifest file that will have the preprocessor support for a particular fpm project.

The following points have been kept in mind while creating this syntax for fpm.toml :

  • An fpm project can use more than one preprocessor so that syntax is preprocessor agnostic.
  • Fpm will preprocess all the files in the source if the suffixes or directories are not explicitly mentioned.
# This snippet will preprocess all the files using cpp preprocessor.
[preprocess]
[preprocess.cpp]
  • Manifest will have an option to define macros so that the user will not have to pass those macros using the command line, which will make the development process cumbersome.

Overall syntax looks like this :

# Preprocess table specifies that this fpm project requires preprocessing.
# If this table is not there in the fpm.toml file, hence no preprocessing
# is needed in that project.
[preprocess]
[preprocess.cpp]

# Mention the suffixes of the files to be preprocessed using
# cpp preprocessor.
suffixes = ["F90", "f90"]

# Mention the directories that should be preprocessed using
# cpp preprocessor.
directories = ["src/feature1", "src/models"]

# Define the macros here.
macros = []

[preprocess.fypp]
# Specify options for fypp preprocessor here.
# If this is an empty table it will preprocess all the files.

We still have one more ambiguity left on the side whether we need to consider the order of preprocessing that means should we consider the case whether a project needs to first be preprocessed using fypp and then cpp and not vice versa or should we consider that case unimportant for now? For this, I will create a separate post asking for community suggestions.

Also in the last meeting, we decided that I will create my first PR around the preprocess table and fpm should be able to parse it for now.

In this week, my main focus will be to explore the fpm code base and find out which files need to be changed and start writing the code for my first PR.

Thanks & Regards,
Arteev Raina