-
Notifications
You must be signed in to change notification settings - Fork 108
A proposed "metadata" command to include metadata from the TOML configuration file in a Fortran-readable format #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sounds like a good idea, having to maintain redundant information in different places is really error prone. For meson and CMake I use |
@awvwgk is a Would there be any advantages to doing this with a (read-only) namelist or maybe having a public |
Preferably we keep in line with existing |
Can you point me to a Fortran example of yours in a public repository? I still have trouble grasping if the concept relies upon use of the Is the following a valid setup example? I have a template file called
In the manifest file of the project, we then specify this as a target for configuration, with the actual preprocessing/replacement done by an extension to Finally in the main module of my project, I can include the configured template file as:
|
For an example see: https://github.com/MarDiehl/stdlib_os/blob/c03a636/src/os.name.in I made a small implementation here when working on the fpm-dist command https://github.com/fortran-lang/fpm/blob/e2a837b/fpm/src/fpm/dist/meson.f90#L433-L473 |
Interesting, if |
You can just cut the loop short and drop Haskell fpm from it, with support for |
As a simpler scheme that leverages some of the existing fpm components and required user knowledge, and does not require a preprocessor I would propose something like this: This could be ignored by the fpm user, but if desired they could include "use fpm_metadata, only : metadata" in their program and then get to at least a standard set of keywords by using such things as: write(*,*)'VERSION',metadata%version
write(*,*)'COMPILE_TIME',metadata%compile_time and so on. As more functions become available (via stdlib, preferably) such things as the equivalent of the output of a uname(1) command could also become default behavior. This would require no preprocessing of the user code, supply a standard set of variables that could be used by all packages, The drawback to the user would be that no such module would exist outside of fpm. So adding -DFPM to the build lines would allow for #ifdef FPM to be used as a preprocessor directive, and leaving the built code in build/ for the user to grab or use as a template for a build outside of fpm(1) would be desirable. |
Something I miss using fpm(1) versus my own tools is being able to provide metadata to the Fortran files directly such as the build time, compiler version used (which some compilers can now provide via Fortran intrinsics), the version number and
such. Essentially if there were a command that converted the TOML metadata into PARAMETER statements each time the build command were used you would have much the same functionality available. Packages past and present such as sccs(1) provided some way to do this but (unless I missed it) git(1) does not. I am not suggesting this is high priority for fpm(1) but would like it discussed and added to the list as appropriate. If an INCLUDE file could be generated automatically or via a subcommand it would be much easier to include correct version and license information in programs without having to edit the code files or a manual editing of an include file it is so often easy to overlook changing the build date or version in.
The text was updated successfully, but these errors were encountered: