Skip to content

ENH: Use target based includes#1426

Merged
N-Dekker merged 1 commit into
SuperElastix:mainfrom
blowekamp:target_based_includes
Apr 10, 2026
Merged

ENH: Use target based includes#1426
N-Dekker merged 1 commit into
SuperElastix:mainfrom
blowekamp:target_based_includes

Conversation

@blowekamp
Copy link
Copy Markdown
Contributor

Replace directly level includes, with target based includes. This allows for setting include properties on targets which allows for propagation to users of the libraries. Additionally, private and public scope can be applied.

@blowekamp
Copy link
Copy Markdown
Contributor Author

@N-Dekker Please review.

@blowekamp blowekamp marked this pull request as ready for review April 8, 2026 13:03

include_directories(../MovingGenericPyramid)

if(USE_OpenCLMovingdGenericPyramid)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is a typo here! A letter d in the middle of USE_OpenCLMovingdGenericPyramid! Obviously not your fault, @blowekamp! It was introduced with 2ce0a0a, more than 11 years ago. But as a consequence, the target_include_directories that you added is never executed here!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@dpshamonin Hi Denis! Do you remember this code? I guess we should just remove the letter d from the middle of USE_OpenCLMovingdGenericPyramid, right?

Copy link
Copy Markdown
Member

@N-Dekker N-Dekker left a comment

Choose a reason for hiding this comment

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

Very interesting, thanks @blowekamp
It does not yet work when OpenCL support is enabled, so it still needs to be adjusted a little bit 🤷

@N-Dekker
Copy link
Copy Markdown
Member

N-Dekker commented Apr 9, 2026

@blowekamp Can you please add the word CMake or CMakeLists to your commit subject line?

For example:

ENH: Use target based includes in CMakeLists


target_include_directories(elxOpenCL PUBLIC ${OPENCL_INCLUDE_DIRS})
target_compile_definitions(elxOpenCL PUBLIC ELASTIX_USE_OPENCL)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm getting compile errors saying:

elastix\Common\OpenCL\ITKimprovements\itkOpenCLContext.cxx(19,10): error C1083: Cannot open include file: 'itkOpenCLKernels.h': No such file or directory

To fix these, maybe add the following line:

target_include_directories(elxOpenCL PRIVATE ${OPENCL_KERNELS_DEBUG_PATH})

("itkOpenCLKernels.h.in" is configured to ${OPENCL_KERNELS_DEBUG_PATH}/itkOpenCLKernels.h)

Copy link
Copy Markdown
Contributor Author

@blowekamp blowekamp Apr 9, 2026

Choose a reason for hiding this comment

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

I just tried and FindOpenCL didn't find the headers on my linux or osx systems, and requires further investigations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@blowekamp I have a few fixes that should be applied before your PR:

Note that the USE_OpenCLMovingdGenericPyramid typo fix might have a git merge conflict with your proposed change in "Components/MovingImagePyramids/OpenCLMovingGenericPyramid/CMakeLists.txt", but it's really very simple: just remove the letter d from the middle!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@blowekamp Can you please rebase your PR onto the latest SuperElastix/elastix main branch? (Including the USE_OpenCLMovingdGenericPyramid typo fix.)

Replace directly level includes, with target based includes. This
allows for setting include properties on targets which allows for
propagation to users of the libraries. Additionally, private and
public scope can be applied.
@blowekamp blowekamp force-pushed the target_based_includes branch 2 times, most recently from 9127270 to 94e0f97 Compare April 9, 2026 18:49
@N-Dekker
Copy link
Copy Markdown
Member

@blowekamp Can you please add the word CMake or CMakeLists to your commit subject line?

Thanks for your attempt to address my suggestion! I say "attempt", because it appeared in the wrong branch! target_Based_includes is not the branch of this pull request! It is target_based_includes !!! Please check your blowekamp/elastix/branches!

@blowekamp blowekamp force-pushed the target_based_includes branch from 94e0f97 to cbda205 Compare April 10, 2026 11:13
@blowekamp
Copy link
Copy Markdown
Contributor Author

OK, things look correct now.

Copy link
Copy Markdown
Member

@N-Dekker N-Dekker left a comment

Choose a reason for hiding this comment

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

Thank you very much, @blowekamp !

@N-Dekker N-Dekker merged commit af47e22 into SuperElastix:main Apr 10, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants