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

Fortran-Package-Manager compatiblity #41

Merged
merged 4 commits into from
Jan 2, 2023
Merged

Fortran-Package-Manager compatiblity #41

merged 4 commits into from
Jan 2, 2023

Conversation

fedebenelli
Copy link
Contributor

Hello!

I've restructured the structure (it's a minimal change) to add compatibility with the Fortran-Package-Manager (fpm: https://fpm.fortran-lang.org/en/index.html)

With the package manager installed in the system, an user can now install packmol with just

fpm install --profile release

And this will automatically check dependencies order, compile and move the executable into ~/.local/bin, to make it accessible everywhere.

Optionally one could run:

fpm build

Compilers flag can be set with:

fpm build --flags "--flags-here"

And this will do the same thing, but move the executable (and compiled objects) into a build folder.

I thought in adding this build instructions into the README but all the build instructions are on the website so I'm not sure if that would be correct.

All the metadata (authors, license, maintainer, etc) is set on the fpm.toml file, I've left those fields empty since I wasn't sure what to put there.

I've tested against the original executable with the water example in the repo and I got the same results :)

Only bad side-effect: I had to delete the "data_types.f90" file since it can be compiled, but I didn't saw anywhere that it's contents were used.

@lmiq
Copy link
Member

lmiq commented Dec 22, 2022

Thanks, that is a nice contribution indeed.

I will probably take some time to merge it, because of the time of the year... and that changes a lot the directory structure so I have to check if nothing is breaking in the site, instructions, user guide, release scripts, etc. I won't be able to do that with the proper care before January.

One doubt: is it standard for fpm that one app directory contains a "special" source file with the main program? (seems strange that all other source files are in the src folder, except one).

@fedebenelli
Copy link
Contributor Author

Yes, totally understandable for this time of the year. I'm glad you find the contribution useful!

With respect with the structure, yes, it's standard for fpm to have the main program on the app folder, because you could even have multiple main programs that you want to compile individually to single executables, but both share the same library modules (everything inside src).

If you look into the fpm.toml file you can see

[[executable]]
name = "packmol"
source-dir = "app"
main = "packmol.f90"

This could be repeated for each desired executable (I don't think that's packmol case)

fpm also provides the fpm test and fpm run --example commands, those will compile and run any main programs that are included in separate test and example folders.

Another nice feature of fpm (also not necessary for packmol I think) is the possibility of adding external dependencies that can be fetched and cached at compile time, by adding them into the fpm.toml file.

@lmiq lmiq changed the base branch from master to FPM January 2, 2023 13:04
@lmiq
Copy link
Member

lmiq commented Jan 2, 2023

I've merged to the "FPM" branch, where I will work on the scripts that I need to update, before merging to main.

@lmiq lmiq merged commit 2601bc4 into m3g:FPM Jan 2, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants