gnu: insight-toolkit: Exclude gtest target.

Fixes: guix/guix#776

This new phase makes it possible to configure projects that use
insight-toolkit.  I think this is what the configure flag '-DGTEST_ROOT=gtest'
was intended to do, but it does not.  In addition, the configure flag
'-DITK_USE_SYSTEM_GOOGLETEST=ON' and native input googletest are no longer
required to placate the configure phase.

* gnu/packages/image-processing (insight-toolkit) [arguments]
<#:configure-flags>: Remove -DITK_USE_SYSTEM_GOOGLETEST=ON and
-DGTEST_ROOT=gtest.
<#:phases>: Add phase 'exclude-gtest-target.
[native-inputs]: Remove googletest.

Change-Id: I9c2e051ac9cfc3439ea53e1a4f3207fbb2f3337b
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Jake Forster 2025-06-24 22:14:18 +09:30 committed by Ludovic Courtès
parent a13acf7985
commit d6b106b5b4
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1254,7 +1254,6 @@ libraries designed for computer vision research and implementation.")
#:configure-flags #:configure-flags
#~(list "-DITK_USE_GPU=ON" #~(list "-DITK_USE_GPU=ON"
"-DITK_USE_SYSTEM_LIBRARIES=ON" "-DITK_USE_SYSTEM_LIBRARIES=ON"
"-DITK_USE_SYSTEM_GOOGLETEST=ON"
"-DITK_USE_SYSTEM_CASTXML=ON" "-DITK_USE_SYSTEM_CASTXML=ON"
"-DITK_BUILD_SHARED=ON" "-DITK_BUILD_SHARED=ON"
"-DITK_WRAPPING=ON" "-DITK_WRAPPING=ON"
@ -1268,10 +1267,6 @@ libraries designed for computer vision research and implementation.")
"/lib/python" python-version "/lib/python" python-version
"/site-packages"))) "/site-packages")))
(string-append "-DPY_SITE_PACKAGES_PATH=" python-lib-path)) (string-append "-DPY_SITE_PACKAGES_PATH=" python-lib-path))
;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
;; variable in the installed CMake files. This is necessary as other
;; packages using insight-toolkit could not be configured otherwise.
"-DGTEST_ROOT=gtest"
"-DCMAKE_CXX_STANDARD=17") "-DCMAKE_CXX_STANDARD=17")
#:phases #~(modify-phases %standard-phases #:phases #~(modify-phases %standard-phases
@ -1283,7 +1278,20 @@ libraries designed for computer vision research and implementation.")
(add-after 'unpack 'ignore-warnings (add-after 'unpack 'ignore-warnings
(lambda _ (lambda _
(substitute* "Wrapping/Generators/Python/CMakeLists.txt" (substitute* "Wrapping/Generators/Python/CMakeLists.txt"
(("-Werror") ""))))))) (("-Werror") ""))))
(add-after 'unpack 'exclude-gtest-target
(lambda _
;; Prevent ITKGoogleTest from being added to
;; ITK_MODULES_ENABLED in the installed
;; ITKConfig.cmake, which in turn prevents
;; 'GTest::GTest' from being added to the
;; ITK_LIBRARIES variable. This is necessary
;; because projects that use ITK fail to configure
;; otherwise. Fixes
;; <https://codeberg.org/guix/guix/issues/776>.
;; <https://github.com/microsoft/vcpkg/pull/27187>
(substitute* "Modules/ThirdParty/GoogleTest/itk-module.cmake"
(("DEPENDS") "DEPENDS\n EXCLUDE_FROM_DEFAULT")))))))
(inputs (inputs
(list eigen (list eigen
expat expat
@ -1300,7 +1308,7 @@ libraries designed for computer vision research and implementation.")
vxl-1 vxl-1
zlib)) zlib))
(native-inputs (native-inputs
(list castxml googletest pkg-config swig which)) (list castxml 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