Good Day Everyone,
My first PR for adding preprocessor support in fpm has finally been merged. The code can be checked here. So, this PR enables the fpm to do the following things :
- Define the preprocessor configuration in the manifest (fpm.toml) file.
[preprocess.cpp] suffixes = ["F90", "f90"] directories = ["src/feature1", "src/models"] macros = ["FOO", "BAR"]
cpppreprocessor configuration is detected in
fpm.tomlfile, then fpm will under the hood add the
-cppflag to the default flags so that users will not have to write it manually every time they build the project using fpm.
The tests for this feature and example project to test out this feature have also been added.
Last week, I spent my time improving this pull request so that the supported compilers should be able to identify the cpp flag when added to default flags. This is because
gfortran compiler understands c preprocessor flag as
-cpp and on the other hand in
lfortran the syntax to define this flag is like
--cpp and I accidentally implicitly assumed that all the compilers provider
-cpp flags. Thanks to @jeremie.vandenplas for pointing this out and @zoziha for reviewing the logic for updating the c preprocessor flag depending on the compiler.
Also, I have added the documentation for the preprocessor configuration in
fpm-docs repo here.
In this week, I am planning to add the functionality to parse and read the macros that are defined in the
fpm.toml file without having the need for the user to write them explicitly in the command. But, if there are any other tasks that mentors and community members want to prioritize before this, feel free to comment below. We will be also discussing about this in detail in our next GSoC Meeting on Thrusday July 14, 2022.
Thanks & Regards