Skip to content

Commit 045d06f

Browse files
committed
[ENH][pacakges] Enable installation of development files
- This introduces changes to pacakge definitions and new patches to install development files. The motivation is to enable the development of 3D Slicer extensions
1 parent 5688c31 commit 045d06f

22 files changed

+1750
-318
lines changed

guix-systole/packages.scm

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@
2626
(string-append directory "/packages/patches") directory))
2727
%load-path))
2828

29-
;; Define a modified %patch-path that includes custom patch directory
3029
(define %patch-path
31-
(make-parameter (list systole-patches
32-
(string-append systole-patches "/slicer")
33-
%original-patch-path)))
30+
(make-parameter (append
31+
(list systole-patches
32+
(string-append systole-patches "/ctk")
33+
(string-append systole-patches "/qrestapi")
34+
(string-append systole-patches "/slicer")
35+
(string-append systole-patches "/slicer-openigtlink")
36+
)
37+
%original-patch-path)))
3438

35-
;; Define search-patch function
39+
;; Define search-patch functio
3640
(define (search-patch file-name)
3741
"Search the patch FILE-NAME. Raise an error if not found."
3842
(or (search-path (%patch-path) file-name)

guix-systole/packages/ctk.scm

Lines changed: 97 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -15,79 +15,89 @@
1515
#:use-module (gnu packages tbb)
1616
#:use-module (gnu packages xiph) ; Theora lib.
1717
#:use-module (gnu packages xml) ; libxml2, expat
18+
#:use-module (gnu packages) ; libxml2, expat
1819
#:use-module (guix build-system cmake)
1920
#:use-module (guix download)
21+
#:use-module (guix gexp)
2022
#:use-module ((guix licenses)
2123
#:prefix license:)
2224
#:use-module (guix packages)
2325
#:use-module (guix-systole packages itk)
2426
#:use-module (guix-systole packages maths)
25-
#:use-module (guix-systole packages vtk))
27+
#:use-module (guix-systole packages vtk)
28+
#:use-module (guix-systole packages))
2629

2730
;; --------------------------- CTK ---------------------------
2831
(define-public ctk
2932
(package
30-
(name "ctk")
31-
(version "0.1")
32-
(source
33-
(origin
34-
(method url-fetch)
35-
(uri
36-
"https://github.com/commontk/CTK/archive/82cae5781621845486bad2697aed095f04cfbe76.tar.gz")
37-
(sha256
38-
(base32 "1g2jv4hjimf4baqbmpmc29ara2f8gk8604g1v8k243x882f0ls9z"))))
39-
(build-system cmake-build-system)
40-
(arguments
41-
'(#:tests? #f
42-
#:parallel-build? #t ; Scheme building using multiple threads.
43-
#:configure-flags
44-
(list ;; --------------------------- Build Flags ---------------------------
45-
"-DCTK_USE_GIT_PROTOCOL:BOOL=OFF" ;turning off git protocol, as it is not supported by modern GitHub
46-
"-DCTK_SUPERBUILD:BOOL=OFF" ;Disable Superbuild
47-
"-DBUILD_TESTING:BOOL=OFF"
48-
"-DCTK_INSTALL_LIB_DIR=lib" ; Hardcoded path for CTK install directory. Fix for CTK-Widgets.
33+
(name "ctk")
34+
(version "0.1")
35+
(source
36+
(origin
37+
(method url-fetch)
38+
(uri
39+
"https://github.com/commontk/CTK/archive/82cae5781621845486bad2697aed095f04cfbe76.tar.gz")
40+
(sha256
41+
(base32 "1g2jv4hjimf4baqbmpmc29ara2f8gk8604g1v8k243x882f0ls9z"))
42+
(patches (search-patches
43+
"0001-ENH-Fix-locating-DCMTK-when-using-CTK.patch"))
44+
))
45+
(build-system cmake-build-system)
46+
(arguments
47+
(list #:tests? #f
48+
#:parallel-build? #t ; Scheme building using multiple threads.
49+
#:configure-flags
50+
#~(list ;; --------------------------- Build Flags ---------------------------
51+
"-DCTK_USE_GIT_PROTOCOL:BOOL=OFF" ;turning off git protocol, as it is not supported by modern GitHub
52+
"-DCTK_SUPERBUILD:BOOL=OFF" ;Disable Superbuild
53+
"-DBUILD_TESTING:BOOL=OFF"
54+
"-DCTK_INSTALL_LIB_DIR=lib" ; Hardcoded path for CTK install directory. Fix for CTK-Widgets.
4955

50-
;; NOTE: (from Slicer) These may need to change in the future.
51-
"-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=ON"
52-
;; "-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=${Slicer_BUILD_QT_DESIGNER_PLUGINS}"
53-
;; "-DCTK_INSTALL_QTPLUGIN_DIR:STRING=${Slicer_INSTALL_QtPlugins_DIR}"
54-
;; -------------------------- CTKdata flags --------------------------
55-
;; NOTE: Testing should be reviewed and added at some point
56-
"-DCTK_ENABLE_CTKDATA:BOOL=OFF" ;CTKData is only needed for testing
57-
;; ---------------------------- VTK flags ----------------------------
58-
"-DCTK_USE_SYSTEM_VTK:BOOL=ON"
59-
;; ---------------------------- ITK flags ----------------------------
60-
"-DCTK_USE_SYSTEM_ITK:BOOL=ON"
61-
;; --------------------------- DICOM Flags ---------------------------
62-
"-DCTK_USE_SYSTEM_DCMTK:BOOL=ON"
63-
"-DCTK_APP_ctkDICOM:BOOL=ON"
64-
"-DCTK_LIB_DICOM/Core:BOOL=ON"
65-
"-DCTK_LIB_DICOM/Widgets:BOOL=ON"
66-
;; ------------------------ CTK Widgets Flags-------------------------
67-
"-DCTK_LIB_Widgets:BOOL=ON"
68-
"-DCTK_LIB_Visualization/VTK/Widgets:BOOL=ON" ; \
69-
"-DCTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS:BOOL=ON" ; -> Needs GuiSupportQT
70-
"-DCTK_LIB_ImageProcessing/ITK/Core:BOOL=ON" ; /
71-
"-DCTK_LIB_PluginFramework:BOOL=OFF"
72-
"-DCTK_PLUGIN_org.commontk.eventbus:BOOL=OFF"
73-
;; ---------------------- PythonQt wrapping ----------------------
74-
"-DCTK_LIB_Scripting/Python/Core:BOOL=OFF"
75-
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK:BOOL=OFF"
76-
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE:BOOL=OFF"
77-
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTGUI:BOOL=OFF"
78-
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTUITOOLS:BOOL=OFF"
79-
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTNETWORK:BOOL=OFF"
80-
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTMULTIMEDIA:BOOL=OFF"
81-
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKIT:BOOL=OFF"
82-
"-DCTK_LIB_Scripting/Python/Widgets:BOOL=OFF"
83-
"-DCTK_ENABLE_Python_Wrapping:BOOL=OFF")))
84-
(inputs
85-
(list qtbase-5
86-
qttools-5
87-
qtsvg-5
88-
dcmtk
89-
vtk-slicer
90-
itk-slicer
56+
;; NOTE: (from Slicer) These may need to change in the future.
57+
"-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=ON"
58+
;; "-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=${Slicer_BUILD_QT_DESIGNER_PLUGINS}"
59+
;; "-DCTK_INSTALL_QTPLUGIN_DIR:STRING=${Slicer_INSTALL_QtPlugins_DIR}"
60+
;; -------------------------- CTKdata flags --------------------------
61+
;; NOTE: Testing should be reviewed and added at some point
62+
"-DCTK_ENABLE_CTKDATA:BOOL=OFF" ;CTKData is only needed for testing
63+
;; ---------------------------- VTK flags ----------------------------
64+
"-DCTK_USE_SYSTEM_VTK:BOOL=ON"
65+
;; ---------------------------- ITK flags ----------------------------
66+
"-DCTK_USE_SYSTEM_ITK:BOOL=ON"
67+
;; --------------------------- DICOM Flags ---------------------------
68+
"-DCTK_USE_SYSTEM_DCMTK:BOOL=ON"
69+
"-DCTK_APP_ctkDICOM:BOOL=ON"
70+
"-DCTK_LIB_DICOM/Core:BOOL=ON"
71+
"-DCTK_LIB_DICOM/Widgets:BOOL=ON"
72+
;; ------------------------ CTK Widgets Flags-------------------------
73+
"-DCTK_LIB_Widgets:BOOL=ON"
74+
"-DCTK_LIB_Visualization/VTK/Widgets:BOOL=ON" ; \
75+
"-DCTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS:BOOL=ON" ; -> Needs GuiSupportQT
76+
"-DCTK_LIB_ImageProcessing/ITK/Core:BOOL=ON" ; /
77+
"-DCTK_LIB_PluginFramework:BOOL=OFF"
78+
"-DCTK_PLUGIN_org.commontk.eventbus:BOOL=OFF"
79+
;; ---------------------- PythonQt wrapping ----------------------
80+
"-DCTK_LIB_Scripting/Python/Core:BOOL=OFF"
81+
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK:BOOL=OFF"
82+
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE:BOOL=OFF"
83+
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTGUI:BOOL=OFF"
84+
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTUITOOLS:BOOL=OFF"
85+
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTNETWORK:BOOL=OFF"
86+
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTMULTIMEDIA:BOOL=OFF"
87+
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKIT:BOOL=OFF"
88+
"-DCTK_LIB_Scripting/Python/Widgets:BOOL=OFF"
89+
"-DCTK_ENABLE_Python_Wrapping:BOOL=OFF"
90+
(string-append "-DDCMTK_DIR:PATH="
91+
#$(this-package-input "dcmtk")
92+
"/lib/cmake/dcmtk")
93+
)))
94+
(inputs
95+
(list qtbase-5
96+
qttools-5
97+
qtsvg-5
98+
dcmtk
99+
vtk-slicer
100+
itk-slicer
91101
; --- Libraries for Visualization VTK widgets and ITK core ---
92102
hdf5-1.10
93103
python
@@ -111,8 +121,8 @@
111121
(home-page "github.com/commontk/CTK")
112122
(synopsis "A set of common support code for medical imaging, surgical
113123
navigation, and related purposes. ")
114-
(description
115-
"The goal of CTK is to support biomedical image computing. CTK
124+
(description
125+
"The goal of CTK is to support biomedical image computing. CTK
116126
code is licensed under Apache 2.0. This means that users of CTK are allowed to
117127
use the code for academic, commercial, or other purposes without paying license
118128
fees or being restricted in their ability to redistribute their code or keep it
@@ -122,30 +132,30 @@ CTK works on topics that are not covered by existing toolkits that support the
122132
mutual interest and needs of the CTK community. The main scope of current CTK
123133
efforts includes the topics DICOM, DICOM Application Hosting, Widgets, and
124134
Plugin Framework.")
125-
(license license:asl2.0)))
135+
(license license:asl2.0)))
126136

127137
(define-public ctkapplauncher
128138
(package
129-
(name "ctkapplauncher")
130-
(version "0.1")
131-
(source
132-
(origin
133-
(method url-fetch)
134-
(uri
135-
"https://github.com/commontk/AppLauncher/archive/8759e03985738b8a8f3eb74ab516ba4e8ef29988.tar.gz")
136-
(sha256
137-
(base32 "1lrrcg9s39n357z2dhfhv8ff99biivdnwwxaggwvnpv9knppaz83"))))
138-
(build-system cmake-build-system)
139-
(arguments
140-
'(#:tests? #f
141-
#:configure-flags (list "-DBUILD_TESTING=OFF"
142-
"-DCTKAppLauncher_QT_VERSION=5"
143-
"-DCTKAppLauncher_INSTALL_LauncherLibrary=ON"
144-
)))
145-
(inputs (list qtbase-5))
146-
(home-page "http://www.commontk.org/")
147-
(synopsis
148-
"Simple and small program allowing to set the environment of any executable.")
149-
(description
150-
"Simple and small program allowing to set the environment of any executable.")
151-
(license license:asl2.0)))
139+
(name "ctkapplauncher")
140+
(version "0.1")
141+
(source
142+
(origin
143+
(method url-fetch)
144+
(uri
145+
"https://github.com/commontk/AppLauncher/archive/8759e03985738b8a8f3eb74ab516ba4e8ef29988.tar.gz")
146+
(sha256
147+
(base32 "1lrrcg9s39n357z2dhfhv8ff99biivdnwwxaggwvnpv9knppaz83"))))
148+
(build-system cmake-build-system)
149+
(arguments
150+
'(#:tests? #f
151+
#:configure-flags (list "-DBUILD_TESTING=OFF"
152+
"-DCTKAppLauncher_QT_VERSION=5"
153+
"-DCTKAppLauncher_INSTALL_LauncherLibrary=ON"
154+
)))
155+
(inputs (list qtbase-5))
156+
(home-page "http://www.commontk.org/")
157+
(synopsis
158+
"Simple and small program allowing to set the environment of any executable.")
159+
(description
160+
"Simple and small program allowing to set the environment of any executable.")
161+
(license license:asl2.0)))

guix-systole/packages/itk.scm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"-DBUILD_EXAMPLES:BOOL=OFF"
4949
"-DITK_WRAPPING:BOOL=OFF"
5050
"-DITK_BUILD_DEFAULT_MODULES:BOOL=ON"
51-
"-DITK_INSTALL_NO_DEVELOPMENT:BOOL=ON"
5251
"-DITK_WRAP_PYTHON:BOOL=OFF"
5352
"-DKWSYS_USE_MD5:BOOL=ON" ;Required by SlicerExecutionModel
5453
"-DITK_USE_SYSTEM_DCMTK:BOOL=ON"
@@ -71,7 +70,7 @@
7170
"-DITK_LEGACY_REMOVE:BOOL=OFF" ;<-- Allow LEGACY ITKv4 features for now.
7271
"-DITK_LEGACY_SILENT:BOOL=OFF" ;<-- Use of legacy code will produce compiler warnings
7372
"-DModule_ITKDeprecated:BOOL=ON" ;<-- Needed for ITKv5 now. (itkMultiThreader.h and MutexLock backwards compatibility.)
74-
73+
7574
;; Optimization
7675
"-DITK_CXX_OPTIMIZATION_FLAGS:STRING=" ;Force compiler-default instruction set to ensure compatibility with older CPUs
7776
"-DITK_C_OPTIMIZATION_FLAGS:STRING=" ;Force compiler-default instruction set to ensure compatibility with older CPUs
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
From 496cb3feca5b34185382f62a93539f7b810f15e9 Mon Sep 17 00:00:00 2001
2+
From: Rafael Palomar <[email protected]>
3+
Date: Sat, 10 May 2025 13:05:32 +0200
4+
Subject: [PATCH] ENH: Allow passing DCMTK_DIR for system DCMTK
5+
6+
---
7+
CMakeExternals/DCMTK.cmake | 15 ++++++++-------
8+
1 file changed, 8 insertions(+), 7 deletions(-)
9+
10+
diff --git a/CMakeExternals/DCMTK.cmake b/CMakeExternals/DCMTK.cmake
11+
index afd37880..32dfbb8c 100644
12+
--- a/CMakeExternals/DCMTK.cmake
13+
+++ b/CMakeExternals/DCMTK.cmake
14+
@@ -6,13 +6,6 @@ set(proj DCMTK)
15+
16+
set(${proj}_DEPENDENCIES "")
17+
18+
-ExternalProject_Include_Dependencies(${proj}
19+
- PROJECT_VAR proj
20+
- DEPENDS_VAR ${proj}_DEPENDENCIES
21+
- EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
22+
- USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
23+
- )
24+
-
25+
# Let the user to chose whether to use libs installed in the system
26+
option(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} "Use installed ${proj} library in the system" OFF)
27+
mark_as_advanced(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
28+
@@ -20,6 +13,7 @@ mark_as_advanced(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
29+
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
30+
unset(DCMTK_DIR CACHE)
31+
find_package(DCMTK REQUIRED)
32+
+ message(FATAL_ERROR ${DCMTK_LIBRARIES})
33+
endif()
34+
35+
# Sanity checks
36+
@@ -27,6 +21,13 @@ if(DEFINED DCMTK_DIR AND NOT EXISTS ${DCMTK_DIR})
37+
message(FATAL_ERROR "DCMTK_DIR variable is defined but corresponds to non-existing directory")
38+
endif()
39+
40+
+ExternalProject_Include_Dependencies(${proj}
41+
+ PROJECT_VAR proj
42+
+ DEPENDS_VAR ${proj}_DEPENDENCIES
43+
+ EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
44+
+ USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
45+
+ )
46+
+
47+
if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
48+
set(revision_tag "11972eaa4ecdbf3aab0f46eff78f33d7e2b16bfe") # patched-DCMTK-3.6.6_20210115
49+
if(${proj}_REVISION_TAG)
50+
--
51+
2.49.0
52+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From e7cf054817a8bbc1fbd5c17ef31af41a92d376ee Mon Sep 17 00:00:00 2001
2+
From: Rafael Palomar <[email protected]>
3+
Date: Sun, 11 May 2025 07:50:52 +0200
4+
Subject: [PATCH] ENH: Fix locating DCMTK when using CTK
5+
6+
---
7+
CMake/CTKConfig.cmake.in | 4 ++++
8+
CMakeExternals/DCMTK.cmake | 14 +++++++-------
9+
2 files changed, 11 insertions(+), 7 deletions(-)
10+
11+
diff --git a/CMake/CTKConfig.cmake.in b/CMake/CTKConfig.cmake.in
12+
index dc3e5f8c..4e995317 100644
13+
--- a/CMake/CTKConfig.cmake.in
14+
+++ b/CMake/CTKConfig.cmake.in
15+
@@ -124,3 +124,7 @@ SET(CTK_BUILD_TYPE @CTK_BUILD_TYPE_CONFIG@)
16+
17+
# CTK external projects variables
18+
@CTK_SUPERBUILD_EP_VARS_CONFIG@
19+
+
20+
+set(DCMTK_DIR @DCMTK_DIR@)
21+
+include(CMakeFindDependencyMacro)
22+
+find_dependency(DCMTK)
23+
diff --git a/CMakeExternals/DCMTK.cmake b/CMakeExternals/DCMTK.cmake
24+
index afd37880..2009c487 100644
25+
--- a/CMakeExternals/DCMTK.cmake
26+
+++ b/CMakeExternals/DCMTK.cmake
27+
@@ -6,13 +6,6 @@ set(proj DCMTK)
28+
29+
set(${proj}_DEPENDENCIES "")
30+
31+
-ExternalProject_Include_Dependencies(${proj}
32+
- PROJECT_VAR proj
33+
- DEPENDS_VAR ${proj}_DEPENDENCIES
34+
- EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
35+
- USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
36+
- )
37+
-
38+
# Let the user to chose whether to use libs installed in the system
39+
option(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} "Use installed ${proj} library in the system" OFF)
40+
mark_as_advanced(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
41+
@@ -27,6 +20,13 @@ if(DEFINED DCMTK_DIR AND NOT EXISTS ${DCMTK_DIR})
42+
message(FATAL_ERROR "DCMTK_DIR variable is defined but corresponds to non-existing directory")
43+
endif()
44+
45+
+ExternalProject_Include_Dependencies(${proj}
46+
+ PROJECT_VAR proj
47+
+ DEPENDS_VAR ${proj}_DEPENDENCIES
48+
+ EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
49+
+ USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
50+
+ )
51+
+
52+
if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
53+
set(revision_tag "11972eaa4ecdbf3aab0f46eff78f33d7e2b16bfe") # patched-DCMTK-3.6.6_20210115
54+
if(${proj}_REVISION_TAG)
55+
--
56+
2.49.0
57+

0 commit comments

Comments
 (0)