Skip to content

[ENH][pacakges] Enable installation of development files #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions guix-systole/packages.scm
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@
(string-append directory "/packages/patches") directory))
%load-path))

;; Define a modified %patch-path that includes custom patch directory
(define %patch-path
(make-parameter (list systole-patches
(string-append systole-patches "/slicer")
%original-patch-path)))
(make-parameter (append
(list systole-patches
(string-append systole-patches "/ctk")
(string-append systole-patches "/qrestapi")
(string-append systole-patches "/slicer")
(string-append systole-patches "/slicer-openigtlink")
)
%original-patch-path)))

;; Define search-patch function
;; Define search-patch functio
(define (search-patch file-name)
"Search the patch FILE-NAME. Raise an error if not found."
(or (search-path (%patch-path) file-name)
Expand Down
184 changes: 97 additions & 87 deletions guix-systole/packages/ctk.scm
Original file line number Diff line number Diff line change
Expand Up @@ -15,79 +15,89 @@
#:use-module (gnu packages tbb)
#:use-module (gnu packages xiph) ; Theora lib.
#:use-module (gnu packages xml) ; libxml2, expat
#:use-module (gnu packages) ; libxml2, expat
#:use-module (guix build-system cmake)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module ((guix licenses)
#:prefix license:)
#:use-module (guix packages)
#:use-module (guix-systole packages itk)
#:use-module (guix-systole packages maths)
#:use-module (guix-systole packages vtk))
#:use-module (guix-systole packages vtk)
#:use-module (guix-systole packages))

;; --------------------------- CTK ---------------------------
(define-public ctk
(package
(name "ctk")
(version "0.1")
(source
(origin
(method url-fetch)
(uri
"https://github.com/commontk/CTK/archive/82cae5781621845486bad2697aed095f04cfbe76.tar.gz")
(sha256
(base32 "1g2jv4hjimf4baqbmpmc29ara2f8gk8604g1v8k243x882f0ls9z"))))
(build-system cmake-build-system)
(arguments
'(#:tests? #f
#:parallel-build? #t ; Scheme building using multiple threads.
#:configure-flags
(list ;; --------------------------- Build Flags ---------------------------
"-DCTK_USE_GIT_PROTOCOL:BOOL=OFF" ;turning off git protocol, as it is not supported by modern GitHub
"-DCTK_SUPERBUILD:BOOL=OFF" ;Disable Superbuild
"-DBUILD_TESTING:BOOL=OFF"
"-DCTK_INSTALL_LIB_DIR=lib" ; Hardcoded path for CTK install directory. Fix for CTK-Widgets.
(name "ctk")
(version "0.1")
(source
(origin
(method url-fetch)
(uri
"https://github.com/commontk/CTK/archive/82cae5781621845486bad2697aed095f04cfbe76.tar.gz")
(sha256
(base32 "1g2jv4hjimf4baqbmpmc29ara2f8gk8604g1v8k243x882f0ls9z"))
(patches (search-patches
"0001-ENH-Fix-locating-DCMTK-when-using-CTK.patch"))
))
(build-system cmake-build-system)
(arguments
(list #:tests? #f
#:parallel-build? #t ; Scheme building using multiple threads.
#:configure-flags
#~(list ;; --------------------------- Build Flags ---------------------------
"-DCTK_USE_GIT_PROTOCOL:BOOL=OFF" ;turning off git protocol, as it is not supported by modern GitHub
"-DCTK_SUPERBUILD:BOOL=OFF" ;Disable Superbuild
"-DBUILD_TESTING:BOOL=OFF"
"-DCTK_INSTALL_LIB_DIR=lib" ; Hardcoded path for CTK install directory. Fix for CTK-Widgets.

;; NOTE: (from Slicer) These may need to change in the future.
"-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=ON"
;; "-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=${Slicer_BUILD_QT_DESIGNER_PLUGINS}"
;; "-DCTK_INSTALL_QTPLUGIN_DIR:STRING=${Slicer_INSTALL_QtPlugins_DIR}"
;; -------------------------- CTKdata flags --------------------------
;; NOTE: Testing should be reviewed and added at some point
"-DCTK_ENABLE_CTKDATA:BOOL=OFF" ;CTKData is only needed for testing
;; ---------------------------- VTK flags ----------------------------
"-DCTK_USE_SYSTEM_VTK:BOOL=ON"
;; ---------------------------- ITK flags ----------------------------
"-DCTK_USE_SYSTEM_ITK:BOOL=ON"
;; --------------------------- DICOM Flags ---------------------------
"-DCTK_USE_SYSTEM_DCMTK:BOOL=ON"
"-DCTK_APP_ctkDICOM:BOOL=ON"
"-DCTK_LIB_DICOM/Core:BOOL=ON"
"-DCTK_LIB_DICOM/Widgets:BOOL=ON"
;; ------------------------ CTK Widgets Flags-------------------------
"-DCTK_LIB_Widgets:BOOL=ON"
"-DCTK_LIB_Visualization/VTK/Widgets:BOOL=ON" ; \
"-DCTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS:BOOL=ON" ; -> Needs GuiSupportQT
"-DCTK_LIB_ImageProcessing/ITK/Core:BOOL=ON" ; /
"-DCTK_LIB_PluginFramework:BOOL=OFF"
"-DCTK_PLUGIN_org.commontk.eventbus:BOOL=OFF"
;; ---------------------- PythonQt wrapping ----------------------
"-DCTK_LIB_Scripting/Python/Core:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTGUI:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTUITOOLS:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTNETWORK:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTMULTIMEDIA:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKIT:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Widgets:BOOL=OFF"
"-DCTK_ENABLE_Python_Wrapping:BOOL=OFF")))
(inputs
(list qtbase-5
qttools-5
qtsvg-5
dcmtk
vtk-slicer
itk-slicer
;; NOTE: (from Slicer) These may need to change in the future.
"-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=ON"
;; "-DCTK_BUILD_QTDESIGNER_PLUGINS:BOOL=${Slicer_BUILD_QT_DESIGNER_PLUGINS}"
;; "-DCTK_INSTALL_QTPLUGIN_DIR:STRING=${Slicer_INSTALL_QtPlugins_DIR}"
;; -------------------------- CTKdata flags --------------------------
;; NOTE: Testing should be reviewed and added at some point
"-DCTK_ENABLE_CTKDATA:BOOL=OFF" ;CTKData is only needed for testing
;; ---------------------------- VTK flags ----------------------------
"-DCTK_USE_SYSTEM_VTK:BOOL=ON"
;; ---------------------------- ITK flags ----------------------------
"-DCTK_USE_SYSTEM_ITK:BOOL=ON"
;; --------------------------- DICOM Flags ---------------------------
"-DCTK_USE_SYSTEM_DCMTK:BOOL=ON"
"-DCTK_APP_ctkDICOM:BOOL=ON"
"-DCTK_LIB_DICOM/Core:BOOL=ON"
"-DCTK_LIB_DICOM/Widgets:BOOL=ON"
;; ------------------------ CTK Widgets Flags-------------------------
"-DCTK_LIB_Widgets:BOOL=ON"
"-DCTK_LIB_Visualization/VTK/Widgets:BOOL=ON" ; \
"-DCTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS:BOOL=ON" ; -> Needs GuiSupportQT
"-DCTK_LIB_ImageProcessing/ITK/Core:BOOL=ON" ; /
"-DCTK_LIB_PluginFramework:BOOL=OFF"
"-DCTK_PLUGIN_org.commontk.eventbus:BOOL=OFF"
;; ---------------------- PythonQt wrapping ----------------------
"-DCTK_LIB_Scripting/Python/Core:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTGUI:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTUITOOLS:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTNETWORK:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTMULTIMEDIA:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKIT:BOOL=OFF"
"-DCTK_LIB_Scripting/Python/Widgets:BOOL=OFF"
"-DCTK_ENABLE_Python_Wrapping:BOOL=OFF"
(string-append "-DDCMTK_DIR:PATH="
#$(this-package-input "dcmtk")
"/lib/cmake/dcmtk")
)))
(inputs
(list qtbase-5
qttools-5
qtsvg-5
dcmtk
vtk-slicer
itk-slicer
; --- Libraries for Visualization VTK widgets and ITK core ---
hdf5-1.10
python
Expand All @@ -111,8 +121,8 @@
(home-page "github.com/commontk/CTK")
(synopsis "A set of common support code for medical imaging, surgical
navigation, and related purposes. ")
(description
"The goal of CTK is to support biomedical image computing. CTK
(description
"The goal of CTK is to support biomedical image computing. CTK
code is licensed under Apache 2.0. This means that users of CTK are allowed to
use the code for academic, commercial, or other purposes without paying license
fees or being restricted in their ability to redistribute their code or keep it
Expand All @@ -122,30 +132,30 @@ CTK works on topics that are not covered by existing toolkits that support the
mutual interest and needs of the CTK community. The main scope of current CTK
efforts includes the topics DICOM, DICOM Application Hosting, Widgets, and
Plugin Framework.")
(license license:asl2.0)))
(license license:asl2.0)))

(define-public ctkapplauncher
(package
(name "ctkapplauncher")
(version "0.1")
(source
(origin
(method url-fetch)
(uri
"https://github.com/commontk/AppLauncher/archive/8759e03985738b8a8f3eb74ab516ba4e8ef29988.tar.gz")
(sha256
(base32 "1lrrcg9s39n357z2dhfhv8ff99biivdnwwxaggwvnpv9knppaz83"))))
(build-system cmake-build-system)
(arguments
'(#:tests? #f
#:configure-flags (list "-DBUILD_TESTING=OFF"
"-DCTKAppLauncher_QT_VERSION=5"
"-DCTKAppLauncher_INSTALL_LauncherLibrary=ON"
)))
(inputs (list qtbase-5))
(home-page "http://www.commontk.org/")
(synopsis
"Simple and small program allowing to set the environment of any executable.")
(description
"Simple and small program allowing to set the environment of any executable.")
(license license:asl2.0)))
(name "ctkapplauncher")
(version "0.1")
(source
(origin
(method url-fetch)
(uri
"https://github.com/commontk/AppLauncher/archive/8759e03985738b8a8f3eb74ab516ba4e8ef29988.tar.gz")
(sha256
(base32 "1lrrcg9s39n357z2dhfhv8ff99biivdnwwxaggwvnpv9knppaz83"))))
(build-system cmake-build-system)
(arguments
'(#:tests? #f
#:configure-flags (list "-DBUILD_TESTING=OFF"
"-DCTKAppLauncher_QT_VERSION=5"
"-DCTKAppLauncher_INSTALL_LauncherLibrary=ON"
)))
(inputs (list qtbase-5))
(home-page "http://www.commontk.org/")
(synopsis
"Simple and small program allowing to set the environment of any executable.")
(description
"Simple and small program allowing to set the environment of any executable.")
(license license:asl2.0)))
3 changes: 1 addition & 2 deletions guix-systole/packages/itk.scm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"-DBUILD_EXAMPLES:BOOL=OFF"
"-DITK_WRAPPING:BOOL=OFF"
"-DITK_BUILD_DEFAULT_MODULES:BOOL=ON"
"-DITK_INSTALL_NO_DEVELOPMENT:BOOL=ON"
"-DITK_WRAP_PYTHON:BOOL=OFF"
"-DKWSYS_USE_MD5:BOOL=ON" ;Required by SlicerExecutionModel
"-DITK_USE_SYSTEM_DCMTK:BOOL=ON"
Expand All @@ -71,7 +70,7 @@
"-DITK_LEGACY_REMOVE:BOOL=OFF" ;<-- Allow LEGACY ITKv4 features for now.
"-DITK_LEGACY_SILENT:BOOL=OFF" ;<-- Use of legacy code will produce compiler warnings
"-DModule_ITKDeprecated:BOOL=ON" ;<-- Needed for ITKv5 now. (itkMultiThreader.h and MutexLock backwards compatibility.)

;; Optimization
"-DITK_CXX_OPTIMIZATION_FLAGS:STRING=" ;Force compiler-default instruction set to ensure compatibility with older CPUs
"-DITK_C_OPTIMIZATION_FLAGS:STRING=" ;Force compiler-default instruction set to ensure compatibility with older CPUs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 496cb3feca5b34185382f62a93539f7b810f15e9 Mon Sep 17 00:00:00 2001
From: Rafael Palomar <[email protected]>
Date: Sat, 10 May 2025 13:05:32 +0200
Subject: [PATCH] ENH: Allow passing DCMTK_DIR for system DCMTK

---
CMakeExternals/DCMTK.cmake | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/CMakeExternals/DCMTK.cmake b/CMakeExternals/DCMTK.cmake
index afd37880..32dfbb8c 100644
--- a/CMakeExternals/DCMTK.cmake
+++ b/CMakeExternals/DCMTK.cmake
@@ -6,13 +6,6 @@ set(proj DCMTK)

set(${proj}_DEPENDENCIES "")

-ExternalProject_Include_Dependencies(${proj}
- PROJECT_VAR proj
- DEPENDS_VAR ${proj}_DEPENDENCIES
- EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
- USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
- )
-
# Let the user to chose whether to use libs installed in the system
option(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} "Use installed ${proj} library in the system" OFF)
mark_as_advanced(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
@@ -20,6 +13,7 @@ mark_as_advanced(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
unset(DCMTK_DIR CACHE)
find_package(DCMTK REQUIRED)
+ message(FATAL_ERROR ${DCMTK_LIBRARIES})
endif()

# Sanity checks
@@ -27,6 +21,13 @@ if(DEFINED DCMTK_DIR AND NOT EXISTS ${DCMTK_DIR})
message(FATAL_ERROR "DCMTK_DIR variable is defined but corresponds to non-existing directory")
endif()

+ExternalProject_Include_Dependencies(${proj}
+ PROJECT_VAR proj
+ DEPENDS_VAR ${proj}_DEPENDENCIES
+ EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
+ USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
+ )
+
if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(revision_tag "11972eaa4ecdbf3aab0f46eff78f33d7e2b16bfe") # patched-DCMTK-3.6.6_20210115
if(${proj}_REVISION_TAG)
--
2.49.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From e7cf054817a8bbc1fbd5c17ef31af41a92d376ee Mon Sep 17 00:00:00 2001
From: Rafael Palomar <[email protected]>
Date: Sun, 11 May 2025 07:50:52 +0200
Subject: [PATCH] ENH: Fix locating DCMTK when using CTK

---
CMake/CTKConfig.cmake.in | 4 ++++
CMakeExternals/DCMTK.cmake | 14 +++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/CMake/CTKConfig.cmake.in b/CMake/CTKConfig.cmake.in
index dc3e5f8c..4e995317 100644
--- a/CMake/CTKConfig.cmake.in
+++ b/CMake/CTKConfig.cmake.in
@@ -124,3 +124,7 @@ SET(CTK_BUILD_TYPE @CTK_BUILD_TYPE_CONFIG@)

# CTK external projects variables
@CTK_SUPERBUILD_EP_VARS_CONFIG@
+
+set(DCMTK_DIR @DCMTK_DIR@)
+include(CMakeFindDependencyMacro)
+find_dependency(DCMTK)
diff --git a/CMakeExternals/DCMTK.cmake b/CMakeExternals/DCMTK.cmake
index afd37880..2009c487 100644
--- a/CMakeExternals/DCMTK.cmake
+++ b/CMakeExternals/DCMTK.cmake
@@ -6,13 +6,6 @@ set(proj DCMTK)

set(${proj}_DEPENDENCIES "")

-ExternalProject_Include_Dependencies(${proj}
- PROJECT_VAR proj
- DEPENDS_VAR ${proj}_DEPENDENCIES
- EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
- USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
- )
-
# Let the user to chose whether to use libs installed in the system
option(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} "Use installed ${proj} library in the system" OFF)
mark_as_advanced(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
@@ -27,6 +20,13 @@ if(DEFINED DCMTK_DIR AND NOT EXISTS ${DCMTK_DIR})
message(FATAL_ERROR "DCMTK_DIR variable is defined but corresponds to non-existing directory")
endif()

+ExternalProject_Include_Dependencies(${proj}
+ PROJECT_VAR proj
+ DEPENDS_VAR ${proj}_DEPENDENCIES
+ EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
+ USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
+ )
+
if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(revision_tag "11972eaa4ecdbf3aab0f46eff78f33d7e2b16bfe") # patched-DCMTK-3.6.6_20210115
if(${proj}_REVISION_TAG)
--
2.49.0

Loading