Skip to content

Commit

Permalink
Build VMTK with VTK 9 and ITK 5. Update python versions to all supported
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertnash committed Mar 7, 2023
1 parent 05f30e4 commit 0881221
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 77 deletions.
121 changes: 59 additions & 62 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,46 @@ on:
push:
branches: [main]

pull_request:

release:
types: [created]

env:
VTK_VERSION: 8.2.0
ITK_VERSION: 4.13.3
VMTK_VERSION: 1.4.1-rc4
VMTK_HASH: 63a3b990328d8dfaa6ffd31968fc341cad9dbe67
VTK_VERSION: 9.1.0
ITK_VERSION: 5.2.1
VMTK_VERSION: 1.5.0
VMTK_FORK: vmtk
VMTK_HASH: 30b0fdad5674d6f134e8a8b601bcef7917671b0a
PLATFORM: ubuntu

jobs:

VTK-build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:
- name: Checkout this repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: builder

- name: Cache
id: cache-vtk
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /opt/vtk
key: VTK-${{ env.VTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}-${{ hashFiles('builder/configure-vtk-ubuntu.sh') }}

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
if: steps.cache-vtk.outputs.cache-hit != 'true'
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -49,17 +52,12 @@ jobs:

- name: Checkout VTK
if: steps.cache-vtk.outputs.cache-hit != 'true'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: kitware/vtk
path: vtk
ref: v${{ env.VTK_VERSION }}

- name: Patch (to support python >= 3.8)
if: steps.cache-vtk.outputs.cache-hit != 'true'
working-directory: vtk
run: patch -p1 < ${{ github.workspace }}/builder/vtk-py38.patch

- name: Configure
if: steps.cache-vtk.outputs.cache-hit != 'true'
env:
Expand All @@ -72,17 +70,17 @@ jobs:
if: steps.cache-vtk.outputs.cache-hit != 'true'
run: cmake --build build -j 4

- name: Get failed build tree
if: failure()
uses: actions/upload-artifact@v3
with:
path: build
name: vtk-${{ env.VTK_VERSION }}-failed-build

- name: Install
if: steps.cache-vtk.outputs.cache-hit != 'true'
run: cmake --install build

- name: Un-hardcode the python location in CMake config
if: steps.cache-vtk.outputs.cache-hit != 'true'
env:
BUILD_DIR: build
CMAKE_CONFIG_DIR: /opt/vtk/lib/cmake
run: builder/unhardcode-python-location.sh

- name: Make visible to setuptools
env:
SITE_PACKAGES_DIR: /opt/vtk/lib/python${{ matrix.python-version }}/site-packages
Expand All @@ -96,36 +94,35 @@ jobs:
${{ github.workspace }}/VTK-${{ env.VTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz
*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: VTK-${{ env.VTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}
path: VTK-${{ env.VTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz

ITK-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:

- name: Checkout this repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: builder

- name: Cache
id: cache-itk
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /opt/itk
key: ITK-${{ env.ITK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}-${{ hashFiles('builder/configure-itk-ubuntu.sh') }}

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
if: steps.cache-itk.outputs.cache-hit != 'true'
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -136,7 +133,7 @@ jobs:

- name: Checkout ITK
if: steps.cache-itk.outputs.cache-hit != 'true'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: InsightSoftwareConsortium/ITK
path: itk
Expand Down Expand Up @@ -165,39 +162,38 @@ jobs:
${{ github.workspace }}/ITK-${{ env.ITK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz
*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: ITK-${{ env.ITK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}
path: ITK-${{ env.ITK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz

VMTK-build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: [VTK-build, ITK-build]

strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:

- name: Checkout this repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: builder

- name: Cache VMTK
id: cache-vmtk
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /opt/vmtk
key: VMTK-${{ env.VMTK_HASH }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}-vtk${{ env.VTK_VERSION }}-itk${{ env.ITK_VERSION }}-${{ hashFiles('builder/configure-vmtk-ubuntu.sh') }}

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
if: steps.cache-vmtk.outputs.cache-hit != 'true'
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -208,15 +204,15 @@ jobs:

- name: Checkout VMTK
if: steps.cache-vmtk.outputs.cache-hit != 'true'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: vmtk/vmtk
repository: ${{ env.VMTK_FORK }}/vmtk
path: vmtk
ref: ${{ env.VMTK_HASH }}

- name: Get VTK
if: steps.cache-vmtk.outputs.cache-hit != 'true'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: VTK-${{ env.VTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}
path: deps
Expand All @@ -227,7 +223,7 @@ jobs:

- name: Get ITK
if: steps.cache-vmtk.outputs.cache-hit != 'true'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ITK-${{ env.ITK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}
path: deps
Expand All @@ -251,7 +247,7 @@ jobs:

- name: Store failed build tree
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: failed-VMTK-${{ env.VMTK_HASH }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}
path: build
Expand All @@ -273,39 +269,39 @@ jobs:
${{ github.workspace }}/VMTK-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz
*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: VMTK-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}
path: VMTK-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz

package:
needs: [VTK-build, ITK-build, VMTK-build]

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get VTK
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: VTK-${{ env.VTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}

- name: Get ITK
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ITK-${{ env.ITK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}

- name: Get VMTK
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: VMTK-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}

Expand All @@ -322,7 +318,7 @@ jobs:
cd /opt/vmtk
tar -czf ${{ github.workspace }}/all-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz *
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: all-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}
path: all-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}.tar.gz
Expand All @@ -332,35 +328,36 @@ jobs:

needs: [package]

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get VTK
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: VTK-${{ env.VTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}

- name: Get ITK
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ITK-${{ env.ITK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}

- name: Get VMTK
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: VMTK-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}

- name: Get All
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: all-${{ env.VMTK_VERSION }}-${{ env.PLATFORM }}-py${{ matrix.python-version }}

Expand Down
34 changes: 22 additions & 12 deletions configure-itk-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#!/bin/bash
thisdir=$(readlink -f $(dirname $BASH_SOURCE))
. $thisdir/cmake_help.sh

declare -A D

cmake \
-B build \
-S itk \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_EXAMPLES:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DITK_USE_REVIEW:BOOL=ON \
-DITK_USE_REVIEW_STATISTICS:BOOL=ON \
-DITK_USE_OPTIMIZED_REGISTRATION_METHODS:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF
D[CMAKE_INSTALL_PREFIX]=$INSTALL_PREFIX
D[CMAKE_BUILD_TYPE]=Release
D[BUILD_SHARED_LIBS]=ON
D[BUILD_EXAMPLES]=OFF
D[BUILD_TESTING]=OFF
D[CMAKE_BUILD_WITH_INSTALL_RPATH]=OFF
D[CMAKE_INSTALL_RPATH_USE_LINK_PATH]=TRUE

# From Superbuild ITK 5
D[ITK_LEGACY_REMOVE]=OFF #<-- Allow LEGACY ITKv4 features for now.
D[ITK_LEGACY_SILENT]=ON #<-- Use of legacy code will produce compiler warnings
D[Module_ITKDeprecated]=ON #<-- Needed for ITKv5 now. (itkMultiThreader.h and MutexLock backwards compatibility.)
D[Module_ITKReview]=OFF

mkdir -p build
cd build

run_cmake D ../itk
1 change: 0 additions & 1 deletion configure-vmtk-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ cmake \
-DVMTK_USE_RENDERING:STRING=ON \
-DITK_DIR:PATH=$ITK_DIR \
-DVTK_DIR:PATH=$VTK_DIR \
-DVMTK_USE_VTK8:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF
Loading

0 comments on commit 0881221

Please sign in to comment.