f90wrap
f90wrap copied to clipboard
Suggestions on wrapping a code
Hello,
First, I'd like to thank for this great package! I am trying to wrap a relatively large F90 code that has also a few dependences. I started using the examples provided for Makefile and made it work for a limited number of functions (see attachment). The issue comes when I try to extend it to a larger part of the codebase for two main reasons:
- Order of the dependencies: I do not know how to ensure the order to compile the modules to respect the dependency tree.
- External dependencies: this code uses dependencies (for example SUNDIALS), and when I try to wrap parts that contain them, I get the error that they are not found.
I would like to get some advice on how to approach these two issues.
Thanks in advance, Francisco
Both of these should be solvable. Satisfying dependencies just required compiling modules in the right order, while linking to external libraries is best done by adding linker options (e.g. of the form -L/path/to/library -llibrary) to the command ine passed to f2py-f90wrap rather than by attempting to generate wrappers all the way down into the dependencies. Here's the Makefile for a moderately complex example which may give you insipriation:
https://github.com/libAtoms/QUIP/blob/public/quippy/Makefile
I will have a look at QUIP. Do you suggest sticking to Make or use the meson builder? (I have never used it before)
Thanks a lot for the advices, I will keep you posted!
I've also mainly used Make for multi-language projects, but Meson is a more modern approach and has some nice features if you are starting from scratch.
Ok, I managed to get it started. I can compile a few modules and get some functions working with the includes as well. To generate the list of files to be compiled ans wrapped I use an external python script (I will integrate it later in the makefile). From my complete ignorance, is it possible to use the already compile modules (*.mod files), because I guess that could make things easier (or at least faster). I am not sure if this is done in the example you shared with me. I am attaching the current status of my case (based on the f90wrap examples) if that's of any help. Makefile1.txt
Thanks!