Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pyushkevich/itksnap
Browse files Browse the repository at this point in the history
  • Loading branch information
pyushkevich committed Oct 4, 2024
2 parents 24368d7 + 3c8a711 commit 681452b
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 26 deletions.
92 changes: 68 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,27 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04,macos-13,macos-14,windows-2019]
os: [ubuntu-20.04,macos-13,macos-14,windows-2022]
itk_ver: [ '5.4.0' ]
vtk_ver: [ '9.3.1' ]
qt_ver: [ '6.6.3' ]
include:
- os: ubuntu-20.04
qt_host: linux
qt_arch: gcc_64
test_pref: xvfb-run -a
- os: macos-13
qt_host: mac
qt_arch: clang_64
test_pref: ''
- os: macos-14
qt_host: mac
qt_arch: clang_64
- os: windows-2019
test_pref: ''
- os: windows-2022
qt_host: windows
qt_arch: win64_msvc2019_64
test_pref: ''

steps:

Expand All @@ -57,32 +64,43 @@ jobs:
with:
brew: curl
apt: libcurl4-openssl-dev
choco: curl
# choco: curl

# Install curl on Windows
- name: Install libcurl on Windows
uses: johnwason/vcpkg-action@v6
if: ${{ runner.os == 'Windows' }}
with:
pkgs: curl
triplet: x64-windows-release
token: ${{ github.token }}
github-binarycache: false

# Install Qt
- name: Install Qt on Ubuntu
uses: jurplel/install-qt-action@v4
with:
version: '6.6.3'
version: ${{ matrix.qt_ver }}
target: 'desktop'
host: ${{ matrix.qt_host }}
arch: ${{ matrix.qt_arch }}
cache: true

# Use cached VTK build if available
- name: Cache VTK
- name: Restore VTK Cache
id: cache-vtk
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: ${{github.workspace}}/vtk/install
key: ${{ matrix.os }}-vtk-9.3.1
key: ${{ matrix.os }}-vtk-${{ matrix.vtk_ver }}

# Check out VTK
- name: Checkout VTK
if: steps.cache-vtk.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'Kitware/VTK.git'
ref: 'v9.3.1'
ref: v${{ matrix.vtk_ver }}
submodules: true
path: 'vtk'

Expand All @@ -93,9 +111,7 @@ jobs:
with:
source-dir: ${{github.workspace}}/vtk
build-dir: ${{github.workspace}}/vtk/build
build-args: |
-t
install
build-args: "-t install -- -k 0"
generator: Ninja
options: |
BUILD_TESTING:BOOL=FALSE
Expand All @@ -107,24 +123,33 @@ jobs:
VTK_MODULE_ENABLE_VTK_GUISupportQtSQL:STRING=NO
CMAKE_BUILD_TYPE=Release
CMAKE_INSTALL_PREFIX=${{github.workspace}}/vtk/install
${{ runner.os == 'Windows' && 'VTK_SMP_ENABLE_STDTHREAD=OFF' || '' }}
# Cache the VTK build
- name: Cache VTK
if: steps.cache-vtk.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{github.workspace}}/vtk/install
key: ${{ matrix.os }}-vtk-${{ matrix.vtk_ver }}

# Use cached ITK build if available. Unfortunately ITK make install fails to
# install one file, vnl_vector_ref.hxx so instead of caching the install dir
# we are caching the build dir
- name: Cache ITK
- name: Restore ITK Cache
id: cache-itk
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: ${{github.workspace}}/itk
key: ${{ matrix.os }}-itk-5.4.0-build
key: ${{ matrix.os }}-itk-${{ matrix.itk_ver }}-build

# Check out ITK
- name: Checkout ITK
if: steps.cache-itk.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'InsightSoftwareConsortium/ITK.git'
ref: 'v5.4.0'
ref: v${{ matrix.itk_ver }}
submodules: true
path: 'itk'

Expand All @@ -145,6 +170,13 @@ jobs:
Module_MorphologicalContourInterpolation:BOOL=TRUE
CMAKE_BUILD_TYPE=Release
CMAKE_INSTALL_PREFIX=${{github.workspace}}/itk/install
- name: Cache ITK
if: steps.cache-itk.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{github.workspace}}/itk
key: ${{ matrix.os }}-itk-${{ matrix.itk_ver }}-build

# Restore ITK-SNAP cache if requested by the user. This should allow us to create faster builds
# because only the updated files should require rebuilding
Expand All @@ -164,25 +196,37 @@ jobs:
clean: false
path: 'itksnap'

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

# Build ITK-SNAP
- name: Build ITK-SNAP
# Configure ITK-SNAP
- name: Configure ITK-SNAP
uses: threeal/[email protected]
continue-on-error: true
with:
source-dir: ${{github.workspace}}/itksnap
build-dir: ${{github.workspace}}/itksnap/build
generator: Ninja
build-args: |
-t
package
run-build: false
options: |
ITK_DIR=${{github.workspace}}/itk/build
VTK_DIR=${{github.workspace}}/vtk/install/lib/cmake/vtk-9.3
CMAKE_BUILD_TYPE=Release
DO_UPLOAD=ON
SITE=github-runner-${{ matrix.os }}
${{ runner.os == 'Windows' && 'CURL_LIBRARY=../../vcpkg/installed/x64-windows-release/lib/libcurl.lib' || '' }}
${{ runner.os == 'Windows' && 'CURL_INCLUDE_DIR=../../vcpkg/installed/x64-windows-release/include' || '' }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

# Build ITK-SNAP using CDash
- name: Build and Test ITK-SNAP
working-directory: ${{github.workspace}}/itksnap/build
run: |
${{ matrix.test_pref }} ctest -D ExperimentalStart
${{ matrix.test_pref }} ctest -D ExperimentalConfigure
${{ matrix.test_pref }} ctest -D ExperimentalBuild
${{ matrix.test_pref }} ctest -D ExperimentalTest ${{ runner.os != 'Windows' && '| echo "no problem"' || '' }}
${{ matrix.test_pref }} ctest -D ExperimentalSubmit
# Cache the ITK-SNAP build
- name: Cache ITK-SNAP build directory
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# This CMake file is modeled after QtTest example project from
# http://www.cmake.org/Wiki/BundleUtilitiesExample

PROJECT(SNAP)

#--------------------------------------------------------------------------------
# CMAKE PRELIMINARIES
#--------------------------------------------------------------------------------
Expand All @@ -17,6 +15,10 @@ cmake_policy(SET CMP0026 NEW)
cmake_policy(SET CMP0077 NEW)
cmake_policy(SET CMP0080 OLD)

#--------------------------------------------------------------------------------
# PROJECT DEFINITION
#--------------------------------------------------------------------------------
PROJECT(SNAP)
SET(CMAKE_MODULE_PATH ${SNAP_SOURCE_DIR}/CMake)

OPTION(BUILD_SHARED_LIBS "Build shared (dynamic) libraries" OFF)
Expand Down

0 comments on commit 681452b

Please sign in to comment.