BUG: Fix module ITK discovery as a remote built with Examples.#5
Conversation
6bf942a to
2a16cc3
Compare
|
I haven't tested yet the fix, but other extensions may have to be updated if this fix works: |
thewtex
left a comment
There was a problem hiding this comment.
Thanks for the updates, Jon!
I added more details inline.
| FIND_PACKAGE(ITK REQUIRED COMPONENTS PrincipalComponentsAnalysis) | ||
|
|
||
| include_directories( ${PrincipalComponentsAnalysis_SOURCE_DIR}/Source ) | ||
| IF (NOT ITK_SOURCE_DIR) |
There was a problem hiding this comment.
I think we only want (untested):
if(NOT ITK_SOURCE_DIR)
find_package(ITK REQUIRED COMPONENTS PrincipalComponentsAnalysis)
include(${ITK_USE_FILE}
else()
include_directories( ${PrincipalComponentsAnalysis_SOURCE_DIR}/Source )
endif()
This is an example -- in should not call itk_module_impl()
|
Just as a comment: I think, at least for some extensions, the 'example' directory was made to be built as a different project. Is is still the case? Or are the examples now build from the main directory? |
Yes, I think so. |
|
Not sure what to include in the else statement: |
|
@jhlegarreta : What is below is what I wanted to post yesterday but apparently I forgot to press a button... I have tested the branch that share the link with outside of ITK and it works, but inside ITK there are linking errors. It might be the problem you have also encountered. |
|
@jhlegarreta @thewtex : I have updated Jon's branch in my repo and I think it works both inside and outside of ITK now [1]. |
|
Then I'm puzzled. Mine also worked outside, but not inside, as in your previous comment. Well, indeed, leaving But note that in my first commit within this topic I removed any reference to |
Fix the Examples/CMakeLists.txt to avoid the module asking for ITK_DIR because it couldn't fint ITKConfig.cmake if built as a remote module and if the BUILD_EXAMPLES flag is set to ON. When building as an independent project, fix the BUILD_DOCUMENTATION and BUILD_EXAMPLES flags appearing also only with the linked ITK configuration counterpart flags have been set to ON. Also, simplify the flags' names when building as an independent project.
2a16cc3 to
e8c3caa
Compare
|
@fbudin69500 @thewtex I've push forced a new commit. @fbudin69500 as for the other remotes, thanks for bringing those issues to surface ! I'd propose to first fix this, and once we see that the behavior is as expected, we could tackle those two remote modules. I think the Cuberille module has also the same issue. @thewetex thanks for the suggestion. This last commit does not yet solve the linker library issues commented by François and me. However, I brought some fixes given that you would sooner or later find them when checking out/forking the branch. So the summary of this commit is this: Matt's comments, along with testing on another machine, uncovered a couple of other issues :-S I've realized that when building outside the ITK tree (i.e. as an independent project) the Thus, I've changed the root Also, and although this is may be a less important question, I guess we do not want the The code is may be redundant due to this. Suggestions are welcome. BTW, I think the cache issue mentioned yesterday is not/no longer an issue: unchecked ITK's BUILD_EXAMPLES and when building as a remote module, the module's flag is no longer present ! I updated the commit message. But as discussed earlier, the linking problem when built as a remote is yet unsolved. |
|
Moving forward :-) Should we merge this branch, then integrate @fbudin69500 's patch? |
|
I wouldn't merge it if we know that it indeed causes issues when built as a remote. If @fbudin69500 's patch works, I'd rather rebase his on top of this, and eventually merge his and close this. |
|
@jhlegarreta I just tested your last patch and it doesn't build outside of the source tree (building the test fails). Do you mind testing the branch I sent? |
|
@fbudin69500 You're right, my last patch set fails to compile outside, at least in the first build; but in a second run, voilà it compiles. Weird. I'd need to investigate why :-S Sorry. I've tested yours and it seems to have the same behavior; the first one fails as mine, due to a mistery PrincipalComponentsAnalysisHeaderTestClean project, which shows up in the solution. I haven't found any reference to it in the CMakeLists. And I don't recall having seen it until today. Weird. Well, kind of late here. I'll have a look at it tomorrow. |
|
The weird I've been struggling to get the list of linked ITK libraries automatically, and have re-read and have made several unsuccessful attempts. May be we should list the link dependencies for the example in the module's Now, I don't know which is the variable where the dependencies should be added, and whether that will effectively work. The compiler complains about vnl-related libraries, so may be adding them to the I tried to add them without success. Surely enough I did not do it the right way. When building externally, the following are the libs listed in And that said, the module's test project has way more than those, all those in The |
| find_package(ITK REQUIRED COMPONENTS PrincipalComponentsAnalysis) | ||
| include(${ITK_USE_FILE}) | ||
| else() | ||
| itk_module_impl() |
There was a problem hiding this comment.
Another idea:
Instead of
itk_module_impl()
itk_module_test()
set(ITK_LIBRARIES ${${PCA}-Test_LIBRARIES})
(untested)
|
That was nice ! Although it works, I've got a couple of concerns:
I'd propose adding an |
|
+1 for |
|
Should we worry about an |
|
I do think it is important to have the modules standalone. For testing the examples, it much easier to use the same project build then to need to set up a second example build. Like the Sphinx examples, maybe we should have |
|
I may have misunderstood something, so correct me if I'm wrong. Are we talking about integrating a remote module's example into the ITKExamples system? I'd be for having a separate project for a remote module example, as done right now. I guess that remotes are intended tot become part of the core at some point in time, as with the previous review system. Hence, the moment it is decided to integrate a remote into ITK would be the time to add the example to the Sphinx/ITKExamples system. So I'd vote for adding an But as said, I may have misunderstood something. It may be worthwhile discussing this with other developers at Kitware, and whenever you reach a consensus, we can go for the implementation. |
|
Jon,
What we are envisioning is to have a clean and simple example directory
that could be copied outside of the remote module folder and built
independently. This would allow users to start a new project based on the
example.
The example folder could still be build inside the remote module, both from
within ITK and outside of ITK. This will require a few updates in
ITKConfig.cmake for which I am going to create a patch.
Francois
…On Thu, May 11, 2017 at 5:58 PM, Jon Haitz Legarreta Gorroño < ***@***.***> wrote:
I may have misunderstood something, so correct me if I'm wrong.
Are we talking about integrating a remote module's example into the
ITKExamples system?
I'd be for having a separate project for a remote module example, as done
right now. I guess that remotes are intended tot become part of the core at
some point in time, as with the previous review system. Hence, the moment
it is decided to integrate a remote into ITK would be the time to add the
example to the Sphinx/ITKExamples system.
So I'd vote for adding an itk_module_example() macro to solve the current
situation. I wouldn't have the example file be listed in the same project
as the sources/includes either (if that would be achieved by setting the
itk_module_example() in the ITKPrincipalComponentsAnalysis/CMakeLists.txt
file).
But as said, I may have misunderstood something. It may be worthwhile
discussing this with other developers at Kitware, and whenever you reach a
consensus, we can go for the implementation.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAYZGNz6EV4ivbaZMwgWpf8qw9QsNe1Qks5r44RrgaJpZM4NV7IK>
.
|
|
Here is a branch to be tested for ITK: ITKPrincipalComponentsAnalysis.cmake.remote needs to be hacked to point to the correct WIP branch of ITKPrincipalComponentsAnalysis |
|
@jhlegarreta I finally merged the patch to easily add examples in remote modules: InsightSoftwareConsortium/ITK@3409d08 |
|
@jhlegarreta Is this PR still relevant? |
|
Sorry for lagging behind this. @hjmjohnson This stems from the fact that when requesting to build a remote module's documentation and/or examples, the were not being nested under the Now, we attempted at several times to get a solution working, but turned out not to be so easy. It was still in my ToDo list to come back to this when I found the necessary energy. |
|
@jhlegarreta Reminder. Perhaps we should close this pull request and make an issue to be addressed later. |
|
Closing the PR due to lack of time to work on na solution and opening #19 to keep track of this. |
Fix the Examples/CMakeLists.txt to avoid the module asking for ITK_DIR
because it couldn't fint ITKConfig.cmake if built as a remote module and
if the BUILD_EXAMPLES flag is set to ON.