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

Add Fortran libraries #1100

Merged
merged 11 commits into from
Jan 22, 2024
Merged

Add Fortran libraries #1100

merged 11 commits into from
Jan 22, 2024

Conversation

partouf
Copy link
Member

@partouf partouf commented Sep 26, 2023

Installs and builds fortran libraries

Todo:

  • Test with Conan
  • Test with CE

@partouf
Copy link
Member Author

partouf commented Sep 26, 2023

How fpm build roughly works: (see fpm build --verbose)

  • downloads the dependencies and builds them etc
  • builds the library, actually makes a lib*.a file as well
  • When compiling the main program:
    • passes to gfortran: -J build/folderwithallthemodfiles -Ibuild/folderwithallthemodfiles
    • links without mentioning dependencies

So I don't think we have to do anything with the .a files, but package the directory with the .mod files instead
However, the directory name is dynamically named (e.g. gfortran_5EC35857C81A7F73) and I'm not sure how to get that name other than looking at the filenames

@partouf
Copy link
Member Author

partouf commented Sep 27, 2023

Actually.. it might be always called gfortran_5EC35857C81A7F73 or probably compilerexename + _5EC35857C81A7F73

But there's no easy to find documentation on this

@partouf
Copy link
Member Author

partouf commented Sep 27, 2023

or maybe not, seemed to be a coincidence that I stumbled upon the same directory name

Problem is now a chicken and egg problem where I do not know the name of the directory where the .mod files go, and thus I cannot make a conanfile.py to get the right hash to check in conan if the library has already been uploaded...

@partouf
Copy link
Member Author

partouf commented Sep 27, 2023

And the fpm hash depends on the compile flags and arguments https://github.com/fortran-lang/fpm/blob/498bc484e7cb72f06c529033f9057ffce35468e6/src/fpm_targets.f90#L975 - so there's no real way to know that beforehand..

@partouf
Copy link
Member Author

partouf commented Sep 27, 2023

And the fpm hash depends on the compile flags and arguments https://github.com/fortran-lang/fpm/blob/498bc484e7cb72f06c529033f9057ffce35468e6/src/fpm_targets.f90#L975 - so there's no real way to know that beforehand..

fixed this by just using a */*.mod pattern in the conanfile, crisis averted

@partouf
Copy link
Member Author

partouf commented Sep 28, 2023

Also implemented a new endpoint to directly download shared libraries like curl from our conan server with https://conan.compiler-explorer.com/downloadcshared/libid/version (the signature kept changing so the urls kept going out of date)

@partouf
Copy link
Member Author

partouf commented Sep 28, 2023

The conan package will look like this:

  • lib
    • libjson-fortran.a
  • mod
    • json_module.mod
    • json_file_module.mod
    • etc

@partouf partouf marked this pull request as ready for review September 30, 2023 17:06
@partouf
Copy link
Member Author

partouf commented Sep 30, 2023

Need to fix all the lintchecks, but otherwise this is good to go

@partouf partouf merged commit 746671a into main Jan 22, 2024
3 checks passed
@partouf partouf deleted the fortranlibraries branch January 22, 2024 23:45
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.

1 participant