Add example CMake toolchain files and fix compiler-dependent line-length flag#347
Open
amontoison wants to merge 4 commits into
Open
Add example CMake toolchain files and fix compiler-dependent line-length flag#347amontoison wants to merge 4 commits into
amontoison wants to merge 4 commits into
Conversation
amontoison
force-pushed
the
feature/cmake-toolchains
branch
from
July 24, 2026 02:46
c1b6004 to
156ff81
Compare
amontoison
force-pushed
the
feature/cmake-toolchains
branch
from
July 24, 2026 23:30
156ff81 to
2b2d9e0
Compare
Add a "Toolchain files" section to the Sphinx install guide describing cmake/toolchains/ (amdflang, gnu, intel, intel-classic, cray, nvhpc) and how to select one with -DCMAKE_TOOLCHAIN_FILE, mirroring the README. Cross-reference it from the compiler prerequisites and the quick-start guide.
Clarify in each toolchain file that free-form parsing and C preprocessing are enabled centrally by hipfort (CMAKE_Fortran_FORMAT and CMAKE_Fortran_PREPROCESS), and that CMake selects the per-compiler flag automatically (-cpp, -fpp, -Mpreprocess, -eZ), so users should not add these flags by hand.
amontoison
force-pushed
the
feature/cmake-toolchains
branch
from
July 25, 2026 00:13
62285a1 to
bd19ae6
Compare
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.
Addresses #81 (move architecture/compiler-dependent CMake variables into toolchain files).
Toolchain files
Adds
cmake/toolchains/with ready-to-use, commented toolchain files, selectable via-DCMAKE_TOOLCHAIN_FILE:amdflang.cmakeamdflang(ROCm LLVM Flang)gnu.cmakegfortranintel.cmakeifx(Intel LLVM)intel-classic.cmakeifort(EOL)cray.cmakeftnnvhpc.cmakenvfortranThey only set the compiler (plus optional
ROCM_PATH/HIP_PLATFORMhints). Pure CMake toolchain files, no dependency onhipfc(compatible with its removal in #334).Fix: line-length flag applied for every build type
-ffree-line-length-nonewas only added in the RELEASE flag set, so a default-build-type configure producedLine truncatederrors with GNU (the generated bindings have code lines up to 399 columns). Moved it to the general flags. It is applied viaSET_COMPILE_FLAG, which compile-tests the flag, so:-ffree-line-length-none.Verified
amdflang.cmake(default) andgnu.cmakeboth configure and fully build without-DCMAKE_BUILD_TYPE=RELEASE(all modules, both install trees, 84.modfiles).Known limitation (classic ifort)
Classic
ifortis EOL and caps free-form source lines at 132 columns with no extension option, so it cannot compile the current bindings as-is;intel-classic.cmakedocuments this and points users toifx. Fullifortsupport would require the generator to wrap long lines, a larger and separate change.Documentation
Documented the toolchain files in the Sphinx install guide (
docs/install/install.rst): a new Toolchain files section with the same table, cross-referenced from the compiler prerequisites and the quick-start guide, so the published docs match the README.