Skip to content
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

Adding Cantera to fpm #57

Open
mefuller opened this issue Oct 8, 2021 · 4 comments
Open

Adding Cantera to fpm #57

mefuller opened this issue Oct 8, 2021 · 4 comments

Comments

@mefuller
Copy link

mefuller commented Oct 8, 2021

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

@certik
Copy link
Member

certik commented Oct 8, 2021

@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.

@mefuller
Copy link
Author

mefuller commented Oct 8, 2021

@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

@certik
Copy link
Member

certik commented Oct 8, 2021

@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.

@mefuller
Copy link
Author

mefuller commented Oct 9, 2021

@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:
#58
fortran-lang/fortran-lang.org#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants