52
52
incdir : /opt/homebrew/Cellar/udunits/2.2.28/include
53
53
libdir : /opt/homebrew/Cellar/udunits/2.2.28/lib
54
54
xml_path : /opt/homebrew/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml
55
+ - os : " windows-latest"
56
+ arch : " AMD64"
57
+ xml_path : " C:/lib/share/udunits/udunits2.xml"
58
+ incdir : C:/lib/include/
59
+ libdir : C:/lib/lib/
55
60
exclude :
56
61
- os : " ubuntu-latest"
57
62
arch : " arm64"
69
74
if : startsWith(matrix.os, 'macos')
70
75
run : echo "MACOSX_DEPLOYMENT_TARGET=$([[ ${{ matrix.os }} == 'macos-latest' ]] && echo '14.0' || echo '13.0')" >> $GITHUB_ENV
71
76
77
+ - name : Export GitHub Actions cache environment variables
78
+ # https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
79
+ if : runner.os == 'Windows'
80
+ uses : actions/github-script@v7
81
+ with :
82
+ script : |
83
+ const path = require('path')
84
+ core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
85
+ core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
86
+ core.exportVariable('VCPKG_ROOT', process.env.VCPKG_INSTALLATION_ROOT);
87
+
88
+ - name : " install expat on win32"
89
+ if : runner.os == 'Windows'
90
+ run : vcpkg install expat:x64-windows
91
+ env :
92
+ # cache vcpkg
93
+ VCPKG_BINARY_SOURCES : " clear;x-gha,readwrite"
94
+
95
+ - name : " setup udunits2 on windows"
96
+ if : runner.os == 'Windows'
97
+ shell : bash
98
+ run : |
99
+ set -e -u -o -x pipefail
100
+
101
+ cd ~/Downloads
102
+ C:/msys64/usr/bin/wget.exe https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.zip
103
+
104
+ unzip udunits-2.2.28.zip
105
+
106
+ cd ./udunits-2.2.28/
107
+
108
+ cmake -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" -B build -S . -D CMAKE_INSTALL_PREFIX=C:/lib/ -D CMAKE_BUILD_TYPE=release
109
+ cmake --build build --config Release
110
+ cmake --install build
111
+
72
112
- name : " Building ${{ matrix.os }} (${{ matrix.arch }}) wheels"
73
113
74
114
env :
@@ -78,14 +118,22 @@ jobs:
78
118
CIBW_MANYLINUX_X86_64_IMAGE : manylinux2014
79
119
CIBW_BEFORE_BUILD_LINUX : yum install -y udunits2-devel
80
120
CIBW_BEFORE_BUILD_MACOS : brew install udunits
121
+ CIBW_BEFORE_BUILD_WINDOWS : python -m pip install delvewheel
81
122
CIBW_TEST_REQUIRES : pytest
82
- CIBW_TEST_COMMAND : >
83
- python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' &&
84
- python -m pytest --pyargs cf_units
123
+ CIBW_TEST_COMMAND : >-
124
+ python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' && python -m pytest --pyargs cf_units
125
+ CIBW_TEST_COMMAND_WINDOWS : python -m pytest --pyargs cf_units
85
126
UDUNITS2_INCDIR : ${{ matrix.incdir }}
86
127
UDUNITS2_LIBDIR : ${{ matrix.libdir }}
87
128
UDUNITS2_XML_PATH : ${{ matrix.xml_path }}
88
129
CIBW_ENVIRONMENT_PASS_LINUX : UDUNITS2_INCDIR UDUNITS2_LIBDIR UDUNITS2_XML_PATH
130
+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : >-
131
+ delvewheel repair -v
132
+ --add-path=C:\\lib\\bin\\
133
+ --add-path=C:\\lib\\lib\\
134
+ --add-path=${{ env.VCPKG_ROOT }}/installed/x64-windows/bin/
135
+ --wheel-dir={dest_dir}
136
+ {wheel}
89
137
90
138
- uses : actions/upload-artifact@v4
91
139
with :
0 commit comments