Skip to content

Commit

Permalink
Build for Windows
Browse files Browse the repository at this point in the history
Fixes #47.
  • Loading branch information
lpsinger committed Nov 13, 2023
1 parent c19cbe3 commit a6bee1f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4
Expand All @@ -40,10 +40,18 @@ jobs:
with:
platforms: arm64

# See https://docs.scipy.org/doc/scipy/building/index.html
- name: Install MinGW
if: runner.os == 'Windows'
run: |
choco install rtools -y --no-progress --force --version=4.0.0.20220206
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_WINDOWS: AMD64
CIBW_ENVIRONMENT_MACOS: FC=gfortran-11
# Skip musllinux wheels, which take a long time to build because Numpy must be built from source
# Skip PyPy wheels
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ following articles:

* The CCMC IGRF code has spatially varying errors of a few percent, which will
result in a striped pattern in the resulting particle flux.
* This package does not support Windows yet. If you are a Windows developer,
then please help us out by contributing a pull request! Meanwhile, if you
need to use this package on Windows, then we recommend using Python under
Linux within Windows Subsystem for Linux (WSL), Docker, or a virtual machine.
See https://github.com/nasa/radbelt/issues/47.

[International Geomagnetic Reference Field (IGRF)]: https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html
[Astropy]: https://www.astropy.org
Expand Down
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ add_global_arguments(

add_languages('fortran')

is_windows = host_machine.system() == 'windows'
if is_windows
add_project_link_arguments('-lquadmath', language : 'c')
endif

py_mod = import('python')
py = py_mod.find_installation(pure: false)

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Operating System :: Unix",
Expand All @@ -40,3 +41,7 @@ test = ["pytest-doctestplus"]
[tool.cibuildwheel]
test-extras = ["test"]
test-command = "pytest --pyargs radbelt --doctest-plus"

[tool.cibuildwheel.windows]
before-build = "pip install delvewheel"
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"

0 comments on commit a6bee1f

Please sign in to comment.