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

Check that Fortran sources run; Robust Fortran features #1051

Merged
merged 9 commits into from
Jun 23, 2024

Conversation

perazz
Copy link
Contributor

@perazz perazz commented Jun 16, 2024

This PR enables fpm to perform checks on supported Fortran features at project build time, with the aim to improve/enable Fortran features support.

  • implement, test a check_fortran_source_runs compiler property to run Fortran sources on-the-fly, similar to CMake's CheckFortranSourceRuns
  • implement with_qp fortran feature that checks for quad-precision real kind support
  • implement with_xdp fortran feature that checks for 80-bit extended-precision real kind support

Later, I plan to add conditional fortran features quad-precision and extended-precision to the fortran table. We should decide on a suitable logic: automated setting of preprocessor flags such as WITH_QP and WITH_XDP every time? or just if required in the fortran table? etc.

Context:
#864
fortran-lang/stdlib#821
cc: @jvdp1 @jalvesz @awvwgk @fortran-lang/fpm @fortran-lang/stdlib

@perazz
Copy link
Contributor Author

perazz commented Jun 19, 2024

Will merge soon as there are no comments. Thanks.

@jalvesz
Copy link

jalvesz commented Jun 19, 2024

Hi @perazz I wanted to ask something before and got busy in between, sorry.

We should decide on a suitable logic: automated setting of preprocessor flags such as WITH_QP and WITH_XDP every time? or just if required in the fortran table?

Here, should it be understood that setting the option in the fortran table would be equivalent to adding a macro option under preprocessor.cpp ['-DWITH_QP'] for instance? in the sense that one should not need to added by hand? If that is the case LGTM. I did not fully understood the alternative.

@perazz
Copy link
Contributor Author

perazz commented Jun 19, 2024

Thanks @jalvesz, the current PR does not address that yet as it just builds the internal capability to check that the current compiler supports qp and xdp by compiling and running a small program.
That is exactly the aim I would like to address further in a separate PR. I think the options are:

  • Always generate standardized macros when those features are supported -> I'm very much in favor at least for these ones, WITH_QP, WITH_XDP, WITH_MPI, etc. so that conditional programming is always enabled, and that also consolidates standardized macros from fpm

  • Add these as mandatory features in the fortran table. In other words, if one package may require a specific precision to be supported

[fortran]
quadruple-precision=true

and fpm can check whether that is supported by the current compiler, and stop if it is not the case.

@jalvesz
Copy link

jalvesz commented Jun 19, 2024

Cristal clear! thanks!

@perazz perazz changed the title Check that Fortran sources run; Robust Fortran features: with_qp, with_xdp Check that Fortran sources run; Robust Fortran features Jun 22, 2024
@henilp105 henilp105 self-requested a review June 23, 2024 05:51
Copy link
Member

@henilp105 henilp105 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @perazz , Looks good to me!

@perazz perazz merged commit 83b4412 into fortran-lang:main Jun 23, 2024
20 checks passed
@perazz perazz deleted the compiler_checks branch June 23, 2024 13:09
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.

3 participants