gnu: insight-toolkit: Build and install Python bindings.

* gnu/packages/image-processing.scm (insight-toolkit)[outputs]: Add "python"
output.
[arguments]: Add configure flags to build Python bindings; add phase
'ignore-warnings.
[native-inputs]: Add castxml, swig, and which.
(insight-toolkit-4)[outputs]: Override.
[native-inputs]: Override.

Change-Id: I4177d0c0239027290678a43f2ea26cb8e1e74918
This commit is contained in:
Ricardo Wurmus 2024-03-27 08:49:04 +01:00
parent d5a5d50932
commit 232796ce60
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 John Darrington <jmd@gnu.org> ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
;;; Copyright © 2017, 2019, 2022 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017, 2019, 2022, 2024 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2014, 2021-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014, 2021-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
@ -52,6 +52,7 @@ (define-module (gnu packages image-processing)
#:use-module (guix build-system python) #:use-module (guix build-system python)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages algebra) #:use-module (gnu packages algebra)
#:use-module (gnu packages base)
#:use-module (gnu packages bison) #:use-module (gnu packages bison)
#:use-module (gnu packages boost) #:use-module (gnu packages boost)
#:use-module (gnu packages check) #:use-module (gnu packages check)
@ -97,6 +98,7 @@ (define-module (gnu packages image-processing)
#:use-module (gnu packages serialization) #:use-module (gnu packages serialization)
#:use-module (gnu packages sphinx) #:use-module (gnu packages sphinx)
#:use-module (gnu packages sqlite) #:use-module (gnu packages sqlite)
#:use-module (gnu packages swig)
#:use-module (gnu packages tbb) #:use-module (gnu packages tbb)
#:use-module (gnu packages textutils) #:use-module (gnu packages textutils)
#:use-module (gnu packages tls) #:use-module (gnu packages tls)
@ -1317,12 +1319,26 @@ (define-public insight-toolkit
(sha256 (sha256
(base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi")))) (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
(build-system cmake-build-system) (build-system cmake-build-system)
(outputs '("out" "python"))
(arguments (arguments
(list #:tests? #f ; tests require network access and external data (list #:tests? #f ; tests require network access and external data
#:configure-flags #~'("-DITK_USE_GPU=ON" #:configure-flags
#~(list "-DITK_USE_GPU=ON"
"-DITK_USE_SYSTEM_LIBRARIES=ON" "-DITK_USE_SYSTEM_LIBRARIES=ON"
"-DITK_USE_SYSTEM_GOOGLETEST=ON" "-DITK_USE_SYSTEM_GOOGLETEST=ON"
"-DITK_USE_SYSTEM_CASTXML=ON"
"-DITK_BUILD_SHARED=ON" "-DITK_BUILD_SHARED=ON"
"-DITK_WRAPPING=ON"
"-DITK_WRAP_PYTHON=ON"
"-DITK_DYNAMIC_LOADING=ON"
(let* ((python-version
#$(version-major+minor
(package-version (this-package-input "python"))))
(python-lib-path
(string-append #$output:python
"/lib/python" python-version
"/site-packages")))
(string-append "-DPY_SITE_PACKAGES_PATH=" python-lib-path))
;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
;; variable in the installed CMake files. This is necessary as other ;; variable in the installed CMake files. This is necessary as other
;; packages using insight-toolkit could not be configured otherwise. ;; packages using insight-toolkit could not be configured otherwise.
@ -1334,7 +1350,11 @@ (define-public insight-toolkit
(lambda _ (lambda _
(substitute* "CMake/ITKSetStandardCompilerFlags.cmake" (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
(("-mtune=native") (("-mtune=native")
""))))))) ""))))
(add-after 'unpack 'ignore-warnings
(lambda _
(substitute* "Wrapping/Generators/Python/CMakeLists.txt"
(("-Werror") "")))))))
(inputs (inputs
(list eigen (list eigen
expat expat
@ -1351,7 +1371,7 @@ (define-public insight-toolkit
vxl-1 vxl-1
zlib)) zlib))
(native-inputs (native-inputs
(list googletest pkg-config)) (list castxml googletest pkg-config swig which))
;; The 'CMake/ITKSetStandardCompilerFlags.cmake' file normally sets ;; The 'CMake/ITKSetStandardCompilerFlags.cmake' file normally sets
;; '-mtune=native -march=corei7', suggesting there's something to be ;; '-mtune=native -march=corei7', suggesting there's something to be
@ -1381,13 +1401,16 @@ (define-public insight-toolkit-4
version ".tar.xz")) version ".tar.xz"))
(sha256 (sha256
(base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns")))) (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
(outputs '("out"))
(arguments (arguments
(list #:tests? #f ; tests require network access and external data (list #:tests? #f ; tests require network access and external data
#:configure-flags #~'("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap #:configure-flags #~'("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
"-DITK_USE_GPU=ON" "-DITK_USE_GPU=ON"
"-DITK_USE_SYSTEM_LIBRARIES=ON" "-DITK_USE_SYSTEM_LIBRARIES=ON"
"-DITK_USE_SYSTEM_GOOGLETEST=ON" "-DITK_USE_SYSTEM_GOOGLETEST=ON"
"-DITK_USE_SYSTEM_VXL=ON"))))) "-DITK_USE_SYSTEM_VXL=ON")))
(native-inputs
(list googletest pkg-config))))
(define-public insight-toolkit-4.12 (define-public insight-toolkit-4.12
(package (inherit insight-toolkit-4) (package (inherit insight-toolkit-4)