Skip to content

Address bug building remote modules against an ITK build directory#5842

Draft
blowekamp wants to merge 6 commits intoInsightSoftwareConsortium:mainfrom
blowekamp:fix_wrap_external
Draft

Address bug building remote modules against an ITK build directory#5842
blowekamp wants to merge 6 commits intoInsightSoftwareConsortium:mainfrom
blowekamp:fix_wrap_external

Conversation

@blowekamp
Copy link
Member

@blowekamp blowekamp commented Feb 26, 2026

Use generator expression to convert target property into properly formatted string for include file. Change to file with GENERATE option to support generator expressions.

There were redundant calls to configure the inc file for each wrapping file. An additional prefix is added to the inc file to create multiple.

This addresses a bug where remote modules could not be wrapped against a build ITK due to missing include paths and definitions.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

@blowekamp
Copy link
Member Author

Sorry for short message, issue mostly redundant include with ITK_INCLUDE_DIRS, and target's transitive properties. Needed to keep ITK_INCLUDE_DIRS because of itkMeshRegion.h in Core/Common.

The extra inc files are redundant.

@blowekamp blowekamp requested a review from thewtex February 26, 2026 22:06
@github-actions github-actions bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Python wrapping Python bindings for a class area:Core Issues affecting the Core module area:IO Issues affecting the IO module labels Feb 27, 2026
@@ -1,3 +1,4 @@
set(ITK_MODULE_ITKCommon_WRAPPING_DEPENDS ITK::ITKMeshModule)
Copy link
Member Author

@blowekamp blowekamp Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thewtex There needs to be a way to express that the wrapping for common depends on the Mesh module, or the mesh code needs to be moved to a better place. This follows the convention of (internal?) variable used in ModuleMacro... I wasn't sure if other models had un-described dependencies for wrapping, but it appears not. I am still pondering better ways to specify this for wrapping; I am open to suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I don't recall the history or the reason for this. Maybe we can ask an agent to try to simplify the dependencies?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have asked my local agent many questions regarding the wrapping code it figure things out. I ended up just hard coding the dep in the TypedefMacros.cmake file. Perhaps this can be revisited after this is merged and remotes are working again for wrapping.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, it has been there since pre-modularization before 2011, and it was trivial to relocate.

Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a glance.

Use generator expression to convert target property into properly
formatted string for include file. Change to file with GENERATE option
to support generator expressions.

There were redundant calls to configure the inc file for each wrapping
file. An additional prefix is added to the inc file to create multiple.
But link publicly to Python to keep include paths for pyImageFilter.

Use a forward declaration of PyObject, to move the inclusion of the
Python.h header to the cxx file.
Specifically compile definitions and include directories are not long
obtained from the directory.
@github-actions github-actions bot removed the area:Python wrapping Python bindings for a class label Feb 27, 2026
set(
CONFIG_CASTXML_INC_CONTENTS
"${CONFIG_CASTXML_INC_CONTENTS}$<LIST:JOIN,$<LIST:TRANSFORM,$<TARGET_PROPERTY:${_depend},INTERFACE_COMPILE_DEFINITIONS>,REPLACE,^(.+)$,\"-D\\1\">,\n>\n"
)
Copy link
Member Author

@blowekamp blowekamp Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zivy @bradking @thewtex This is some pretty cool code going on with CMake here.

@thewtex
Copy link
Member

thewtex commented Feb 27, 2026

Cool! 😎

I recall that we had code to remove redundant include directories -- hopefully this helps with that, too.

@github-actions github-actions bot added the area:Python wrapping Python bindings for a class label Feb 27, 2026
@github-actions github-actions bot added the area:Bridge Issues affecting the Bridge module label Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Bridge Issues affecting the Bridge module area:Core Issues affecting the Core module area:IO Issues affecting the IO module area:Python wrapping Python bindings for a class type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants