Skip to content

ci: add Windows Fortran#62

Merged
henryiii merged 10 commits into
scikit-build:mainfrom
henryiii:henryiii/ci/fortran
Jun 22, 2026
Merged

ci: add Windows Fortran#62
henryiii merged 10 commits into
scikit-build:mainfrom
henryiii:henryiii/ci/fortran

Conversation

@henryiii

Copy link
Copy Markdown
Contributor

See if we can add Windows Fortran.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii henryiii force-pushed the henryiii/ci/fortran branch from 10cad15 to 3b53345 Compare June 22, 2026 15:30
henryiii added 9 commits June 22, 2026 12:30
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
@henryiii henryiii marked this pull request as ready for review June 22, 2026 22:46
@henryiii henryiii changed the title ci: try to add Windows Fortran ci: add Windows Fortran Jun 22, 2026
@henryiii henryiii merged commit 5405ef9 into scikit-build:main Jun 22, 2026
11 checks passed
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.

1 participant