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

CMake: dowstream projects must enable Fortran if AMReX_FORTRAN=ON #1669

Merged
merged 2 commits into from
Dec 22, 2020

Conversation

mic84
Copy link
Contributor

@mic84 mic84 commented Dec 22, 2020

Summary

Note: this also changes the default of AMReX_FORTRAN to OFF.

Additional background

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • are described in the proposed changes to the AMReX documentation, if appropriate

@mic84 mic84 requested a review from ax3l December 22, 2020 02:05
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

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

Thank you! 🎁

@ax3l ax3l added the install label Dec 22, 2020
@@ -32,9 +32,6 @@ if (CMAKE_Fortran_COMPILER_LOADED)
INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/mod_files>
)
# adding those is a work-around that avoids that downstream C++ projects have
# to `enable_language(Fortran)`
target_link_libraries(amrex PUBLIC ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
Copy link
Member

@ax3l ax3l Dec 22, 2020

Choose a reason for hiding this comment

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

Note: this served us reasonably well but did not cover all bases, e.g. we saw issues on macOS with Fortran functionality, OpenMP and LLVM+GFortran mixes (did use the LLVM OpenMP libs but add libgfortran unconditionally) as well as issues with Windows' MSVC + CUDA #1585

Generally, the calling project must enable_language(Fortran) in CMake. Languages are not encapsulated.

@ax3l ax3l merged commit c9a571f into AMReX-Codes:development Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants