Add support for building libcaffeine with CMake instead of FPM - #373
Merged
Merged
Conversation
Details: * New `install.sh` option `--enable-cmake` (aka `--disable-fpm`) activates the internal use of CMake instead of FPM to drive the build. * Homebrew support is extended to optionally install CMake instead FPM, as appropriate. * Still generates `run-fpm.sh`, which can optionally be used to invoke an FPM-driven build of the library or tests after running `install.sh` (e.g. if FPM is later installed) Limitations: * Does not support CMake-driven build of Caffeine unit tests or examples. Caffeine developers should install FPM and use `run-fpm.sh test` (or leverage the FPM in GitHub Actions CI).
Some FFLAGS and CFLAGS should not be exported via our pkg-config file, so separate those out into new *_lib variants and deploy appropriately.
When only FC is set, try to auto-detect appropriate CC. Also make the auto-suffixing logic a bit more robust.
Ensure that Caffeine's C compilation (caffeine.c in particular) use LFortran's copy of ISO_Fortran_binding.h
Other misc cleanups
We were relying on GASNet's detection of CFLAGS and CPPFLAGS which get injected into GASNET_CC and used to build GASNet, however they don't appear in the GASNET_CFLAGS and GASNET_CPPFLAGS that we pass to FPM or CMake. install.sh now directly detects these upon invocations and appends them to the CFLAGS used by FPM or CMake.
JDPailleux
approved these changes
Sep 22, 2026
JDPailleux
left a comment
Collaborator
There was a problem hiding this comment.
LGTM.
Tested locally and it works well. Thanks !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR supercedes #271 in providing a CMake-driven build of the Caffeine library, without requiring FPM.
By sharing 90.6% of the existing FPM-driven build system (in particular the fetch/build/install of GASNet-EX, generation of pkg-config files and installation to prefix), the result is more maintainable and provides a uniform install experience for end users (who don't directly invoke
cmakeat all). It also supports the full generality of library conduit, codemode and threadmode, while minimizing the required CMake version.This new feature is provided entirely by the first commit that only modifies
install.sh. The remaining commits on this PR make other tangential improvements, add CI coverage and fix existing problems that arose during extensive manual testing.Details:
install.shoption--enable-cmake(aka--disable-fpm) activates the internal use of CMake instead of FPM to drive the build.run-fpm.sh, which can optionally be used to invoke an FPM-driven build of the library or tests after runninginstall.sh(e.g. if FPM is later installed)caffeine.pc), and using them expandapp/Makefileto support PRIF-aware compilers; this enablesmake-driven build+execute ofapp/native-multi-image.F90over Caffeine, without FPM. This is not necessary for end-use of the Caffeine library, but provides a convenient smoke test for the Caffeine library built by CMake (or FPM).Limitations:
run-fpm.sh test(or leverage the FPM in GitHub Actions CI).libcaffeine*.a. This might be expanded in a future PR to include a shared library build.