Skip to content

Commit

Permalink
Merge pull request numpy#25189 from charris/backport-25073
Browse files Browse the repository at this point in the history
BLD,BUG: quadmath required where available [f2py]
  • Loading branch information
charris authored Nov 19, 2023
2 parents 66c631d + 1996f87 commit f975164
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 15 additions & 3 deletions doc/source/f2py/windows/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,30 @@ F2PY and Windows

.. warning::

F2PY support for Windows is not at par with Linux support, and
OS specific flags can be seen via ``python -m numpy.f2py``
F2PY support for Windows is not always at par with Linux support

.. note::
`ScPy's documentation`_ has some information on system-level dependencies
which are well tested for Fortran as well.

Broadly speaking, there are two issues working with F2PY on Windows:

- the lack of actively developed FOSS Fortran compilers, and,
- the linking issues related to the C runtime library for building Python-C extensions.

The focus of this section is to establish a guideline for developing and
extending Fortran modules for Python natively, via F2PY on Windows.
extending Fortran modules for Python natively, via F2PY on Windows.

Currently supported toolchains are:

- Mingw-w64 C/C++/Fortran compilers
- Intel compilers
- Clang-cl + Flang
- MSVC + Flang

Overview
========

From a user perspective, the most UNIX compatible Windows
development environment is through emulation, either via the Windows Subsystem
on Linux, or facilitated by Docker. In a similar vein, traditional
Expand Down Expand Up @@ -206,3 +217,4 @@ path using a hash. This needs to be added to the ``PATH`` variable.
.. _are outdated: https://github.com/conda-forge/conda-forge.github.io/issues/1044
.. _now deprecated: https://github.com/numpy/numpy/pull/20875
.. _LLVM Flang: https://releases.llvm.org/11.0.0/tools/flang/docs/ReleaseNotes.html
.. _ScPy's documentation: http://scipy.github.io/devdocs/building/index.html#system-level-dependencies
4 changes: 4 additions & 0 deletions numpy/f2py/_backends/meson.build.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project('${modulename}',
'warning_level=1',
'buildtype=${buildtype}'
])
fc = meson.get_compiler('fortran')

py = import('python').find_installation(pure: false)
py_dep = py.dependency()
Expand All @@ -28,6 +29,8 @@ inc_f2py = include_directories(incdir_f2py)
fortranobject_c = incdir_f2py / 'fortranobject.c'

inc_np = include_directories(incdir_numpy, incdir_f2py)
# gh-25000
quadmath_dep = fc.find_library('quadmath', required: false)

py.extension_module('${modulename}',
[
Expand All @@ -37,6 +40,7 @@ ${source_list},
include_directories: [inc_np],
dependencies : [
py_dep,
quadmath_dep,
${dep_list}
],
install : true)

0 comments on commit f975164

Please sign in to comment.