ci: add Windows Fortran#62
Merged
Merged
Conversation
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
10cad15 to
3b53345
Compare
scikit-build-core builds with Ninja on Windows, where CMake auto-detects MSVC for C. MSVC has no Fortran compiler, so the gfortran from setup-fortran was never used and configure failed with 'No CMAKE_Fortran_COMPILER could be found'. Force the full GNU toolchain on Windows via a scikit-build-core override. Assisted-by: ClaudeCode:claude-opus-4.8
setup-fortran installs MinGW via choco, which only edits the persistent machine PATH; GitHub Actions does not reload that into the running job, so gcc/gfortran were absent from PATH and CMake could not find the Fortran compiler (C silently fell back to MSVC). Add the MinGW bin directory to GITHUB_PATH on Windows. Assisted-by: ClaudeCode:claude-opus-4.8
The GITHUB_PATH addition alone did not let CMake find bare gfortran, so set CC/CXX/FC to absolute compiler paths (independent of PATH) and drop the now-redundant pi-fortran override. Keep the bin dir on PATH for the runtime DLLs and add a diagnostic step. Assisted-by: ClaudeCode:claude-opus-4.8
CC/FC env vars set by setup-fortran are not honored through the uv build chain (CMake kept selecting MSVC and missing gfortran), but -D defines passed via CMAKE_ARGS reach cmake authoritatively. Set full-path CMAKE_C_COMPILER/CMAKE_Fortran_COMPILER there; drop the diagnostic step. Assisted-by: ClaudeCode:claude-opus-4.8
The Windows runners preset CMAKE_GENERATOR to Visual Studio, which has no Fortran support: it ignored CMAKE_C_COMPILER (C stayed MSVC) and drove gfortran through devenv/.sln, which cannot compile Fortran. Scope a Ninja generator and the MinGW C/Fortran compilers to the pi-fortran nox session so the MSVC-based projects keep using Visual Studio. CI just puts the MinGW bin on PATH for the noxfile lookup. Assisted-by: ClaudeCode:claude-opus-4.8
numpy.f2py.get_include() returns a backslash path on Windows; passing it into python_add_library made FindPython re-parse it as cmake code and fail with 'Invalid character escape'. Convert it with file(TO_CMAKE_PATH). Assisted-by: ClaudeCode:claude-opus-4.8
The MinGW-built module failed to import (DLL load failed) because its libgfortran/libgcc/libwinpthread dependencies were not found; Python 3.8+ ignores PATH for extension DLL resolution. Link the GNU runtime statically so the module is self-contained. Assisted-by: ClaudeCode:claude-opus-4.8
Drop the debug Write-Host and simplify the noxfile compiler-path handling. Assisted-by: ClaudeCode:claude-opus-4.8
scikit-build-core detects -GNinja from cmake.args and overrides support platform-system conditions, so the generator + MinGW compiler selection moves into pi-fortran's pyproject.toml. This reverts the noxfile env plumbing; CI still adds MinGW to PATH so the bare compilers resolve. Assisted-by: ClaudeCode:claude-opus-4.8
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.
See if we can add Windows Fortran.