Skip to content

Commit d829a00

Browse files
committed
2 parents 03f40ac + 0c84c99 commit d829a00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1162
-197
lines changed

.github/workflows/build.yml

+130-30
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
99
required: false
1010
default: false
11+
use_cached_itksnap_build:
12+
type: boolean
13+
description: 'Use cached build results from last run'
14+
required: false
15+
default: false
1116
# push:
1217
# release:
1318
# types:
@@ -18,12 +23,37 @@ jobs:
1823
name: Build wheels on ${{ matrix.os }}
1924
runs-on: ${{ matrix.os }}
2025
strategy:
26+
fail-fast: false
2127
matrix:
22-
# os: [ubuntu-20.04,macos-13,macos-14,windows-2019]
23-
os: [ubuntu-20.04]
28+
os: [ubuntu-20.04,macos-13,macos-14,windows-2022]
29+
itk_ver: [ '5.4.0' ]
30+
vtk_ver: [ '9.3.1' ]
31+
qt_ver: [ '6.6.3' ]
32+
include:
33+
- os: ubuntu-20.04
34+
qt_host: linux
35+
qt_arch: gcc_64
36+
test_pref: xvfb-run -a
37+
- os: macos-13
38+
qt_host: mac
39+
qt_arch: clang_64
40+
test_pref: ''
41+
- os: macos-14
42+
qt_host: mac
43+
qt_arch: clang_64
44+
test_pref: ''
45+
- os: windows-2022
46+
qt_host: windows
47+
qt_arch: win64_msvc2019_64
48+
test_pref: ''
2449

2550
steps:
2651

52+
# Select MSVC tools on windows
53+
- name: Select MSVC 2019
54+
uses: ilammy/msvc-dev-cmd@v1
55+
if: ${{ runner.os == 'Windows' }}
56+
2757
# Setup ninja
2858
- name: Setup Ninja
2959
uses: seanmiddleditch/gha-setup-ninja@master
@@ -34,33 +64,44 @@ jobs:
3464
with:
3565
brew: curl
3666
apt: libcurl4-openssl-dev
37-
choco: curl
67+
choco: nsis
3868

69+
# Install curl on Windows
70+
- name: Install libcurl on Windows
71+
uses: johnwason/vcpkg-action@v6
72+
id: vcpkg
73+
if: ${{ runner.os == 'Windows' }}
74+
with:
75+
pkgs: curl
76+
triplet: x64-windows-release
77+
token: ${{ github.token }}
78+
github-binarycache: false
79+
3980
# Install Qt
4081
- name: Install Qt on Ubuntu
4182
uses: jurplel/install-qt-action@v4
42-
if: ${{ startsWith(matrix.os,'ubuntu') }}
4383
with:
44-
version: '6.6.3'
45-
host: 'linux'
84+
version: ${{ matrix.qt_ver }}
4685
target: 'desktop'
47-
arch: 'gcc_64'
86+
host: ${{ matrix.qt_host }}
87+
arch: ${{ matrix.qt_arch }}
88+
cache: true
4889

4990
# Use cached VTK build if available
50-
- name: Cache VTK
91+
- name: Restore VTK Cache
5192
id: cache-vtk
52-
uses: actions/cache@v4
93+
uses: actions/cache/restore@v4
5394
with:
5495
path: ${{github.workspace}}/vtk/install
55-
key: ${{ runner.os }}-vtk-9.3.1
96+
key: ${{ matrix.os }}-vtk-${{ matrix.vtk_ver }}
5697

5798
# Check out VTK
5899
- name: Checkout VTK
59100
if: steps.cache-vtk.outputs.cache-hit != 'true'
60101
uses: actions/checkout@v4
61102
with:
62103
repository: 'Kitware/VTK.git'
63-
ref: 'v9.3.1'
104+
ref: v${{ matrix.vtk_ver }}
64105
submodules: true
65106
path: 'vtk'
66107

@@ -71,9 +112,7 @@ jobs:
71112
with:
72113
source-dir: ${{github.workspace}}/vtk
73114
build-dir: ${{github.workspace}}/vtk/build
74-
build-args: |
75-
-t
76-
install
115+
build-args: "-t install -- -k 0"
77116
generator: Ninja
78117
options: |
79118
BUILD_TESTING:BOOL=FALSE
@@ -83,25 +122,35 @@ jobs:
83122
VTK_GROUP_ENABLE_Qt:STRING=YES
84123
VTK_MODULE_ENABLE_VTK_GUISupportQtQuick:STRING=NO
85124
VTK_MODULE_ENABLE_VTK_GUISupportQtSQL:STRING=NO
125+
CMAKE_BUILD_TYPE=Release
86126
CMAKE_INSTALL_PREFIX=${{github.workspace}}/vtk/install
127+
${{ runner.os == 'Windows' && 'VTK_SMP_ENABLE_STDTHREAD=OFF' || '' }}
87128
129+
# Cache the VTK build
130+
- name: Cache VTK
131+
if: steps.cache-vtk.outputs.cache-hit != 'true'
132+
uses: actions/cache/save@v4
133+
with:
134+
path: ${{github.workspace}}/vtk/install
135+
key: ${{ matrix.os }}-vtk-${{ matrix.vtk_ver }}
136+
88137
# Use cached ITK build if available. Unfortunately ITK make install fails to
89138
# install one file, vnl_vector_ref.hxx so instead of caching the install dir
90139
# we are caching the build dir
91-
- name: Cache ITK
140+
- name: Restore ITK Cache
92141
id: cache-itk
93-
uses: actions/cache@v4
142+
uses: actions/cache/restore@v4
94143
with:
95-
path: ${{github.workspace}}/itk/build
96-
key: ${{ runner.os }}-itk-5.4.0-build
144+
path: ${{github.workspace}}/itk
145+
key: ${{ matrix.os }}-itk-${{ matrix.itk_ver }}-build
97146

98147
# Check out ITK
99148
- name: Checkout ITK
100149
if: steps.cache-itk.outputs.cache-hit != 'true'
101150
uses: actions/checkout@v4
102151
with:
103152
repository: 'InsightSoftwareConsortium/ITK.git'
104-
ref: 'v5.4.0'
153+
ref: v${{ matrix.itk_ver }}
105154
submodules: true
106155
path: 'itk'
107156

@@ -120,35 +169,86 @@ jobs:
120169
BUILD_TESTING:BOOL=FALSE
121170
BUILD_EXAMPLES:BOOL=FALSE
122171
Module_MorphologicalContourInterpolation:BOOL=TRUE
172+
CMAKE_BUILD_TYPE=Release
123173
CMAKE_INSTALL_PREFIX=${{github.workspace}}/itk/install
174+
175+
- name: Cache ITK
176+
if: steps.cache-itk.outputs.cache-hit != 'true'
177+
uses: actions/cache/save@v4
178+
with:
179+
path: ${{github.workspace}}/itk
180+
key: ${{ matrix.os }}-itk-${{ matrix.itk_ver }}-build
124181

182+
# Restore ITK-SNAP cache if requested by the user. This should allow us to create faster builds
183+
# because only the updated files should require rebuilding
184+
- name: Restore ITK-SNAP Cache (optional)
185+
id: cache-restore-itksnap
186+
uses: actions/cache/restore@v4
187+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.use_cached_itksnap_build }}
188+
with:
189+
path: ${{github.workspace}}/itksnap
190+
key: ${{ matrix.os }}-itksnap-build-${{ github.ref }}
191+
125192
# Checkout ITK-SNAP code
126193
- name: Checkout code
194+
if: steps.cache-restore-itksnap.outputs.cache-hit != 'true'
127195
uses: actions/checkout@v4
128196
with:
129197
submodules: true
198+
clean: false
130199
path: 'itksnap'
131200

132-
- name: Setup tmate session
133-
uses: mxschmitt/action-tmate@v3
134-
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
135-
136-
# Build ITK-SNAP
137-
- name: Build ITK-SNAP
138-
if: ${{ 1 == 2 }}
201+
# Configure ITK-SNAP
202+
- name: Configure ITK-SNAP
203+
if: steps.cache-restore-itksnap.outputs.cache-hit != 'true'
139204
uses: threeal/cmake-action@v2.0.0
205+
continue-on-error: true
140206
with:
141207
source-dir: ${{github.workspace}}/itksnap
142208
build-dir: ${{github.workspace}}/itksnap/build
143-
build-args: |
144-
-t
145-
install
146209
generator: Ninja
210+
run-build: false
211+
args: ${{ runner.os == 'Windows' && steps.vcpkg.outputs.vcpkg-cmake-config || '' }}
147212
options: |
148213
ITK_DIR=${{github.workspace}}/itk/build
149214
VTK_DIR=${{github.workspace}}/vtk/install/lib/cmake/vtk-9.3
150-
CMAKE_PREFIX_PATH=${{github.workspace}}/../Qt/6.6.3/linux/lib/cmake
151215
CMAKE_BUILD_TYPE=Release
216+
DO_UPLOAD=ON
217+
SITE=github-runner-${{ matrix.os }}
218+
${{ runner.os == 'Windows' && format('CURL_LIBRARY={0}/vcpkg/installed/x64-windows-release/lib/libcurl.lib', github.workspace) || '' }}
219+
${{ runner.os == 'Windows' && format('CURL_INCLUDE_DIR={0}/vcpkg/installed/x64-windows-release/include', github.workspace) || '' }}
220+
221+
# Build ITK-SNAP using CDash
222+
- name: Build and Test ITK-SNAP
223+
if: steps.cache-restore-itksnap.outputs.cache-hit != 'true'
224+
working-directory: ${{github.workspace}}/itksnap/build
225+
run: |
226+
${{ matrix.test_pref }} ctest -D ExperimentalStart
227+
${{ matrix.test_pref }} ctest -D ExperimentalConfigure
228+
${{ matrix.test_pref }} ctest -D ExperimentalBuild
229+
${{ matrix.test_pref }} ctest -D ExperimentalTest ${{ runner.os != 'Windows' && '| echo "no problem"' || '' }}
230+
${{ matrix.test_pref }} ctest -D ExperimentalSubmit
231+
232+
# Cache the ITK-SNAP build
233+
- name: Cache ITK-SNAP build directory
234+
if: steps.cache-restore-itksnap.outputs.cache-hit != 'true'
235+
uses: actions/cache/save@v4
236+
with:
237+
path: ${{github.workspace}}/itksnap
238+
key: ${{ matrix.os }}-itksnap-build-${{ github.ref }}
239+
240+
- name: Setup tmate session
241+
uses: mxschmitt/action-tmate@v3
242+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
243+
244+
# Package ITK-SNAP
245+
- name: Package ITK-SNAP
246+
continue-on-error: true
247+
working-directory: ${{github.workspace}}/itksnap/build
248+
run: |
249+
ninja -v package
250+
251+
152252

153253

154254

CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# This CMake file is modeled after QtTest example project from
55
# http://www.cmake.org/Wiki/BundleUtilitiesExample
66

7-
PROJECT(SNAP)
8-
97
#--------------------------------------------------------------------------------
108
# CMAKE PRELIMINARIES
119
#--------------------------------------------------------------------------------
@@ -17,6 +15,10 @@ cmake_policy(SET CMP0026 NEW)
1715
cmake_policy(SET CMP0077 NEW)
1816
cmake_policy(SET CMP0080 OLD)
1917

18+
#--------------------------------------------------------------------------------
19+
# PROJECT DEFINITION
20+
#--------------------------------------------------------------------------------
21+
PROJECT(SNAP)
2022
SET(CMAKE_MODULE_PATH ${SNAP_SOURCE_DIR}/CMake)
2123

2224
OPTION(BUILD_SHARED_LIBS "Build shared (dynamic) libraries" OFF)
@@ -230,7 +232,6 @@ SET(LOGIC_CXX
230232
Common/HistoryManager.cxx
231233
Common/IPCHandler.cxx
232234
Common/IRISException.cxx
233-
Common/IRISVectorTemplates.cxx
234235
Common/MultiFrameDicomSeriesSorter.cxx
235236
Common/Rebroadcaster.cxx
236237
Common/Registry.cxx

Common/IRISVectorTemplates.cxx

-29
This file was deleted.

Common/IRISVectorTypes.h

-3
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,18 @@ typedef iris_vector_fixed<int,2> Vector2i;
140140
typedef iris_vector_fixed<unsigned int,2> Vector2ui;
141141
typedef iris_vector_fixed<float,2> Vector2f;
142142
typedef iris_vector_fixed<double,2> Vector2d;
143-
typedef iris_vector_fixed<bool,2> Vector2b;
144143

145144
// Common 3D vector types
146145
typedef iris_vector_fixed<int,3> Vector3i;
147146
typedef iris_vector_fixed<unsigned int,3> Vector3ui;
148147
typedef iris_vector_fixed<float,3> Vector3f;
149148
typedef iris_vector_fixed<double,3> Vector3d;
150-
typedef iris_vector_fixed<bool,3> Vector3b;
151149

152150
// Common 3D vector types
153151
typedef iris_vector_fixed<int,4> Vector4i;
154152
typedef iris_vector_fixed<unsigned int,4> Vector4ui;
155153
typedef iris_vector_fixed<long,4> Vector4l;
156154
typedef iris_vector_fixed<double,4> Vector4d;
157-
typedef iris_vector_fixed<bool,4> Vector4b;
158155

159156
// A matrix definition
160157
typedef vnl_matrix_fixed<double,3,3> Matrix3d;

Common/PropertyModel.h

-3
Original file line numberDiff line numberDiff line change
@@ -804,9 +804,6 @@ MAKE_TYPEDEF_PM_RANGED(Vector4i, IntVec4)
804804
MAKE_TYPEDEF_PM_RANGED(Vector2ui, UIntVec2)
805805
MAKE_TYPEDEF_PM_RANGED(Vector3ui, UIntVec3)
806806
MAKE_TYPEDEF_PM_RANGED(Vector4ui, UIntVec4)
807-
MAKE_TYPEDEF_PM_RANGED(Vector2b, BooleanVec2)
808-
MAKE_TYPEDEF_PM_RANGED(Vector3b, BooleanVec3)
809-
MAKE_TYPEDEF_PM_RANGED(Vector4b, BooleanVec4)
810807

811808
// Macros for non-ranged types
812809
MAKE_TYPEDEF_PM_NONRNG(std::string, String)

Common/SystemInterface.cxx

+7-8
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@
3333
3434
=========================================================================*/
3535

36-
#ifdef WIN32
37-
#ifdef _WIN32_WINNT
38-
#undef _WIN32_WINNT
39-
#endif //_WIN32_WINNT
40-
#define _WIN32_WINNT 0x0600
41-
42-
#include <Shlobj.h>
43-
#endif //WIN32
4436

4537

4638
//#define WINVER 0x0600
@@ -67,7 +59,14 @@
6759
#include <itkRGBAPixel.h>
6860
#include <itkImage.h>
6961

62+
7063
#ifdef WIN32
64+
#ifdef _WIN32_WINNT
65+
#undef _WIN32_WINNT
66+
#endif //_WIN32_WINNT
67+
#define _WIN32_WINNT 0x0600
68+
69+
#include <Shlobj.h>
7170
#include <iostream>
7271
#include <process.h>
7372
#include <windows.h>

0 commit comments

Comments
 (0)