Open mefuller opened 3 years ago
@mefuller yes, it is absolutely reasonable to get it into fpm
. We want to be able to easily use any dependency using fpm
, no matter if it is originally written in C++, Rust or Python, as long as it has Fortran wrappers we want to be able to use it like any other Fortran module. So how to best proceed?
I just answered a similar question here:
So as a start, the simplest way forward might be to assume the C++ lib is already installed, and then make the fpm
package only for the wrapper and pass the proper options to fpm
to link against the C++ lib correctly.
Then we can go from there. For example down the road I would like fpm
to use any Spack or Conda package. So then we could use Spack or Conda for the C++ dependency. Or something like that.
@certik Thanks - I'll take a look at this in the coming days and see if I can get a PR started. Cantera is also in Conda, so that would also be a future option.
It's very exciting to be working on Fortran again
@mefuller nice to have you here, thanks for getting in touch with us.
I would recommend to simply assume Cantera is installed using Conda. And then do fpm
package just for the wrappers and try to figure out how to make it link correctly using $CONDA_PREFIX
.
We want to add first class Conda support in fpm
, and perhaps we can use Cantera as the guinea pig.
@certik on further inspection, unfortunately, the Conda install only presently provides the python interface, so I'll need to run with the locally built version. From here, I'm not sure if there's anything else needed:
I followed the posted instructions and have accordingly opened a pair of PRs: https://github.com/fortran-lang/fpm-registry/pull/58 https://github.com/fortran-lang/fortran-lang.org/pull/341
Once an end-user builds from source and installs, Cantera writes out the needed paths as output. A template for the makefile (and SConstruct) is also provided: https://github.com/Cantera/cantera/tree/main/samples/f90
Disclaimer:it's been about ten years since I was routinely working in Fortran, but I'm getting back into working with it via Cantera (https://github.com/Cantera/cantera).
I'm curious about getting cantera into fpm - it's primarily written in C++, but has Fortran bindings/interface (https://github.com/Cantera/cantera/tree/main/samples/f90)
So - is this even feasible/reasonable or is cantera outside the scope of fpm since it's not primarily Fortran source code?
Thanks