forked from kaygdev/octdata4python
-
Notifications
You must be signed in to change notification settings - Fork 0
232 lines (199 loc) · 8.64 KB
/
windows.yml
File metadata and controls
232 lines (199 loc) · 8.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Windows Wheels
on:
workflow_dispatch:
workflow_call:
jobs:
build:
permissions:
contents: write
runs-on: windows-2025
env:
Boost_DIR: C:/Boost/lib/cmake/Boost-1.88.0
DCMTK_DIR: C:/tools/dcmtk-20241211-ac00290
OpenCV_DIR: C:/tools/opencv/build
OpenJPEG_DIR: C:/Program Files (x86)/OPENJPEG
Python310_ROOT_DIR: C:/hostedtoolcache/windows/Python/3.10.11/x64
Python311_ROOT_DIR: C:/hostedtoolcache/windows/Python/3.11.9/x64
Python312_ROOT_DIR: C:/hostedtoolcache/windows/Python/3.12.10/x64
Python313_ROOT_DIR: C:/hostedtoolcache/windows/Python/3.13.5/x64
steps:
- name: Checkout main repo
uses: actions/checkout@v4
- name: Install dependencies (numpy needed for boost)
run: |
# numpy must be installed first — boost's b2.exe build tool depends on it
$versions = @("Python310", "Python311", "Python312", "Python313")
foreach ($v in $versions) {
$root = (Get-Item "env:${v}_ROOT_DIR").Value
& "$root\python.exe" -m pip install --upgrade pip setuptools wheel
& "$root\Scripts\pip.exe" install numpy
}
- name: Clone required forks
run: |
mkdir C:/repos; if ($?) { cd C:/repos }
git clone https://github.com/kaygdev/oct_cpp_framework.git
git clone https://github.com/kaygdev/LibE2E.git
git clone https://github.com/fzhem/LibOctData.git
git clone https://github.com/fzhem/octdata4python.git
- name: Add missing boost find_package
run: |
(Get-Content C:/repos/oct_cpp_framework/CMakeLists.txt) -replace 'find_package\(OpenCV REQUIRED\)', "find_package(OpenCV REQUIRED)`r`nfind_package(Boost REQUIRED)" | Set-Content C:/repos/oct_cpp_framework/CMakeLists.txt
(Get-Content C:/repos/LibE2E/CMakeLists.txt) -replace 'find_package\(OpenCV REQUIRED\)', "find_package(OpenCV REQUIRED)`r`nfind_package(Boost REQUIRED)" | Set-Content C:/repos/LibE2E/CMakeLists.txt
- name: Restore OpenCV cache
id: restore-opencv-cache
uses: actions/cache/restore@v4
with:
key: opencv-4.11.0-windows-${{ runner.os }}
path: C:/tools/opencv
- name: Install OpenCV via Chocolatey
if: steps.restore-opencv-cache.outputs.cache-hit != 'true'
run: choco install opencv --version=4.11.0 -y --no-progress
- name: Save OpenCV cache
uses: actions/cache/save@v4
if: steps.restore-opencv-cache.outputs.cache-hit != 'true'
with:
key: opencv-4.11.0-windows-${{ runner.os }}
path: C:/tools/opencv
- name: Download Zlib from source
run: |
curl -L -o C:/tools/zlib.zip https://zlib.net/zlib131.zip
tar -xf C:/tools/zlib.zip -C C:/tools
- name: Build Zlib
shell: cmd
run: |
cd /d C:/tools/zlib-1.3.1
mkdir build && cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build . --config Release --target install
- name: Restore Boost zip cache
id: restore-boost-zip-cache
uses: actions/cache/restore@v4
with:
key: boost-1.88.0-zip-${{ runner.os }}
path: C:/tools/boost.zip
- name: Download Boost from source
if: steps.restore-boost-zip-cache.outputs.cache-hit != 'true'
run: |
curl -L -o C:/tools/boost.zip https://archives.boost.io/release/1.88.0/source/boost_1_88_0.zip
mkdir C:/local
tar -xf C:/tools/boost.zip -C C:/local
- name: Save Boost zip cache
uses: actions/cache/save@v4
if: steps.restore-boost-zip-cache.outputs.cache-hit != 'true'
with:
key: boost-1.88.0-zip-${{ runner.os }}
path: C:/tools/boost.zip
- name: Restore Boost build cache
id: restore-boost-build-cache
uses: actions/cache/restore@v4
with:
key: boost-1.88.0-build-${{ runner.os }}
path: C:/Boost
- name: Run Boost Bootstrap Script
if: steps.restore-boost-build-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
cd /d C:/local/boost_1_88_0
bootstrap.bat
- name: Build and Install Boost Libraries
env:
BOOST_BUILD_PATH: ${{ github.workspace }}
if: steps.restore-boost-build-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
cd /d C:/local/boost_1_88_0
b2 -j%NUMBER_OF_PROCESSORS% ^
toolset=msvc-14.3 address-model=64 variant=release link=shared threading=multi runtime-link=shared ^
python=3.10,3.11,3.12,3.13 ^
--with-iostreams --with-locale --with-log --with-python --with-program_options --with-serialization ^
--debug-configuration ^
--prefix=C:/Boost install
- name: Save Boost build cache
uses: actions/cache/save@v4
if: steps.restore-boost-build-cache.outputs.cache-hit != 'true'
with:
key: boost-1.88.0-build-${{ runner.os }}
path: C:/Boost
- name: Clone OpenJPEG
run: |
cd C:/repos
git clone --branch v2.5.3 https://github.com/uclouvain/openjpeg.git
- name: Build OpenJPEG
run: |
# Building OpenJPEG from source to dodge msvcp.dll version conflicts in the wheel package
# (Prebuilt binaries cause runtime headaches with mismatched MSVC runtime DLLs)
cd C:/repos/openjpeg
cmake -G "Visual Studio 17 2022" .
cmake --build . --config Release --target install
- name: Download libtiff from source
run: |
curl -L -o C:/tools/tiff.zip https://download.osgeo.org/libtiff/tiff-4.7.0.zip
tar -xf C:/tools/tiff.zip -C C:/tools
- name: Build libtiff
shell: cmd
run: |
cd /d C:/tools/tiff-4.7.0
cmake -G "Visual Studio 17 2022" .
cmake --build . --config Release --target install
- name: Download DCMTK
shell: cmd
run: |
curl -L -o C:/tools/dcmtk.zip https://github.com/DCMTK/dcmtk/releases/download/DCMTK-3.6.9/dcmtk-20241211-ac00290-win64.zip
tar -xf C:/tools/dcmtk.zip -C C:/tools
mkdir C:\dcmtk_support\libs\zlib-1.3\lib
copy C:\tools\zlib-1.3.1\build\Release\zlib.lib C:\dcmtk_support\libs\zlib-1.3\lib\zlib_o.lib
- name: Build oct_cpp_framework
run: |
cd C:/repos/oct_cpp_framework
mkdir build && cd build
cmake -G "Visual Studio 17 2022" ..
cmake --build . --config Release
- name: Build LibE2E
run: |
cd C:/repos/LibE2E
mkdir build && cd build
cmake -G "Visual Studio 17 2022" ..
cmake --build . --config Release
- name: Build LibOctData
run: |
cd C:/repos/LibOctData
mkdir build && cd build
cmake -G "Visual Studio 17 2022" `
-DBUILD_WITH_SUPPORT_DICOM=ON `
-DCMAKE_CXX_FLAGS="/Zc:__cplusplus /DNOMINMAX /EHsc" `
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ..
cmake --build . --config Release --target install
- name: Build octdata4python wheels
env:
TIFF_RELEASE: C:/tools/tiff-4.7.0/libtiff/Release
ZLIB_RELEASE: C:/tools/zlib-1.3.1/build/Release
run: |
cd C:/repos/octdata4python
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
$env:Path = "C:\Users\runneradmin\.local\bin;$env:Path"
$pyVersions = @("3.10", "3.11", "3.12", "3.13")
foreach ($ver in $pyVersions) {
echo "🌀 Syncing with Python $ver..."
uv sync --python=$ver
echo "📦 Building wheel for Python $ver..."
$env:CMAKE_ARGS = "-DPython3_VERSION=$ver"
.venv/Scripts/python -m build --installer=uv
echo "🛠️ Repairing wheels for Python $ver..."
$cp = $ver -replace '\.', ''
.venv/Scripts/delvewheel repair dist/octdata4python-*-cp$cp-cp$cp-*.whl `
--add-path=C:/repos/LibOctData/build/Release `
--add-path=C:/Boost/lib `
--add-path=$env:OpenCV_DIR/x64/vc16/bin `
--add-path=$env:OpenJPEG_DIR/bin `
--add-path=$env:TIFF_RELEASE `
--add-path=$env:ZLIB_RELEASE `
--add-path=$env:DCMTK_DIR/bin
}
- name: Fetch latest commit hash
id: get_commit_hash
run: echo "hash=$(git rev-parse --short HEAD)" >> $ENV:GITHUB_OUTPUT
- name: Upload Windows wheels
uses: actions/upload-artifact@v4
with:
name: windows-wheels
path: C:/repos/octdata4python/wheelhouse/*.whl