Skip to content

Commit f91e868

Browse files
authored
Merge pull request #248 from SimonRit/SetupOptions
2 parents bfe9b83 + 6a72964 commit f91e868

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

scripts/macpython-download-cache-and-build-module-wheels.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ brew upgrade cmake
4444

4545
# Fetch ITKPythonBuilds archive containing ITK build artifacts
4646
echo "Fetching https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.3.0}/ITKPythonBuilds-macosx.tar.zst"
47-
aria2c -c --file-allocation=none -o ITKPythonBuilds-macosx.tar.zst -s 10 -x 10 https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.3.0}/ITKPythonBuilds-macosx.tar.zst
47+
if [[ ! -f ITKPythonBuilds-macosx.tar.zst ]]; then
48+
aria2c -c --file-allocation=none -o ITKPythonBuilds-macosx.tar.zst -s 10 -x 10 https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.3.0}/ITKPythonBuilds-macosx.tar.zst
49+
fi
4850
unzstd --long=31 ITKPythonBuilds-macosx.tar.zst -o ITKPythonBuilds-macosx.tar
4951
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
5052
tar xf ITKPythonBuilds-macosx.tar --checkpoint=10000 --checkpoint-action=dot

scripts/windows-download-cache-and-build-module-wheels.ps1

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
#
1212
# > windows-download-cache-and-build-module-wheels.ps1 11
1313
#
14+
# - other parameters are passed to setup.py. If one of the parameters is "--",
15+
# the following parameters will be passed to cmake.
16+
# For instance, for Python 3.11, excluding nvcuda.dll during packaging
17+
# and setting RTK_USE_CUDA ON during configuration:
18+
#
19+
# > windows-download-cache-and-build-module-wheels.ps1 11 --exclude-libs nvcuda.dll "--" -DRTK_USE_CUDA:BOOL=ON
20+
#
21+
#
1422
# -----------------------------------------------------------------------
1523
# Environment variables used in this script:
1624
#
@@ -37,7 +45,12 @@ iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.co
3745

3846
if (-not $env:ITK_PACKAGE_VERSION) { $env:ITK_PACKAGE_VERSION = 'v5.3.0' }
3947
echo "Fetching build archive $env:ITK_PACKAGE_VERSION"
40-
Invoke-WebRequest -Uri "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/$env:ITK_PACKAGE_VERSION/ITKPythonBuilds-windows.zip" -OutFile "ITKPythonBuilds-windows.zip"
48+
if (Test-Path C:\P) {
49+
Remove-Item -Recurse -Force C:\P
50+
}
51+
if (-not (Test-Path ITKPythonBuilds-windows.zip)) {
52+
Invoke-WebRequest -Uri "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/$env:ITK_PACKAGE_VERSION/ITKPythonBuilds-windows.zip" -OutFile "ITKPythonBuilds-windows.zip"
53+
}
4154
7z x ITKPythonBuilds-windows.zip -oC:\P -aoa -r
4255

4356
# Optional: Update ITKPythonPackage build scripts
@@ -63,15 +76,26 @@ if ($env:ITKPYTHONPACKAGE_TAG) {
6376
}
6477

6578
# Get other build dependencies
66-
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -OutFile "doxygen-1.8.11.windows.bin.zip"
79+
if (-not (Test-Path doxygen-1.8.11.windows.bin.zip)) {
80+
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -OutFile "doxygen-1.8.11.windows.bin.zip"
81+
}
6782
7z x doxygen-1.8.11.windows.bin.zip -oC:\P\doxygen -aoa -r
68-
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -OutFile "grep-win.zip"
83+
if (-not (Test-Path grep-win.zip)) {
84+
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -OutFile "grep-win.zip"
85+
}
6986
7z x grep-win.zip -oC:\P\grep -aoa -r
7087
$env:Path += ";C:\P\grep"
7188

7289
# Build ITK module dependencies, if any
7390
$build_command = "& `"C:\Python$pythonVersion-x$pythonArch\python.exe`" `"C:\P\IPP\scripts\windows_build_module_wheels.py`" --no-cleanup --py-envs `"3$($args[0])-x64`""
74-
echo "Build command: $build_command"
91+
foreach ($arg in $args[1..$args.length]) {
92+
if ($arg.substring(0,2) -eq "--") {
93+
$build_command = "$build_command $($arg)"
94+
}
95+
else {
96+
$build_command = "$build_command `"$($arg)`""
97+
}
98+
}
7599

76100
echo "ITK_MODULE_PREQ: $env:ITK_MODULE_PREQ $ITK_MODULE_PREQ"
77101
if ($env:ITK_MODULE_PREQ) {

0 commit comments

Comments
 (0)