From 89db6d1ada0b330c9b7eb0ea969ed79c68440409 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Wed, 30 Sep 2026 15:30:54 -0500 Subject: [PATCH] COMP: Find PyBuffer templates in an installed ITK An installed ITK has no /../wrapping directory. With ITK_INSTALL_WRAPPING_DEVELOPMENT_FILES=ON it installs each module's SWIG templates under ${WRAP_ITK_CMAKE_DIR}/Modules//, so look there first and keep the source-tree path as the fallback. --- wrapping/itkPyBufferRTK.wrap | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wrapping/itkPyBufferRTK.wrap b/wrapping/itkPyBufferRTK.wrap index fcaac2bde..41df77786 100644 --- a/wrapping/itkPyBufferRTK.wrap +++ b/wrapping/itkPyBufferRTK.wrap @@ -1,6 +1,10 @@ # Find PyBuffer swig files from ITKBridgeNumPy sources -list(GET ITKBridgeNumPy_INCLUDE_DIRS 0 ITKBridgeNumPy_INCLUDE_DIR) -set(ITKBridgeNumpy_WRAP_DIR "${ITKBridgeNumPy_INCLUDE_DIR}/../wrapping") +# An installed ITK keeps the templates under its wrapping package directory. +set(ITKBridgeNumpy_WRAP_DIR "${WRAP_ITK_CMAKE_DIR}/Modules/ITKBridgeNumPy") +if(NOT EXISTS "${ITKBridgeNumpy_WRAP_DIR}/PyBuffer.i.init") + list(GET ITKBridgeNumPy_INCLUDE_DIRS 0 ITKBridgeNumPy_INCLUDE_DIR) + set(ITKBridgeNumpy_WRAP_DIR "${ITKBridgeNumPy_INCLUDE_DIR}/../wrapping") +endif() file(READ "${ITKBridgeNumpy_WRAP_DIR}/PyBuffer.i.init" PyBufferInit)