Page MenuHomePhabricator

[Conan] Build MatchPoint with ITK 5.1.0 recipe
Open, NormalPublic

Description

Using the work that has been done here {T27214} and the migration that has been done here T28446: Migrate MatchPoint to ITK v5.1, we could actually start using the conan-center provided ITK 5.1.0 recipe from here.

Related Objects

Event Timeline

kalali triaged this task as Normal priority.Apr 23 2021, 10:20 AM
kalali created this task.

I started looking into this and some changes need to be made in order to get some errors out of the way:

  • Conan-center recipes are built without CMake find / config files, as mentioned here: In short: Conan creates own find / config files so they are removed from the original package.

    So I need to use a Conan-CMake generator to create these files for me. The consequences are that Conan creates an ITKConfig.cmake file inside the package-directory which points to the required libraries / paths. It is necessary to change the Conan MatchPoint recipe to be aware of the automatically generated files. This is done by removing cmake.definitions["CMAKE_PREFIX_PATH"] = itk_libpath from the MatchPoint recipe. This set the CMAKE_PREFIX_PATH to a directory inside the ITK package where the find / config files would be found. However, these find / config files (mentioned ITKConfig.cmake above) is now located inside the MatchPoint package directory itself.
  • The automatically generated ITKConfig.cmake file does not know anything about the variable ITK_USE_FILE or the UseITK.cmake file. There was an error in the ITK 5.1.0 recipe which I reported, so that the ITK recipe now does not remove the UseITK.cmake file from the package but instead add a module path to the recipe to point to this file: https://github.com/conan-io/conan-center-index/pull/4807

    By defining the self.cpp_info.build_modules variable inside the ITK 5.1.0 recipe and pointing to the UseITK.cmake file, a CONAN_BUILD_MODULES_PATHS is defined inside the conanbuildinfo.cmake, which points to lib/cmake/ITK-5.1/UseITK.cmake inside the ITK package directory to find the UseITK.cmake file. This conanbuildinfo.cmake file is automatically consumed by the MatchPoint recipe.

    This requires a change inside the MatchPoint recipe such that the new variable CONAN_BUILD_MODULES_PATHS is set for the ITK_USE_FILE CMake variable. One could also hardcode the path (e.g. itk_modulepath = os.path.join(itk_libpath, "UseITK.cmake"), but that is not something we want to bother with here. In order to define the ITK_USE_FILE variable we write cmake.definitions["ITK_USE_FILE"] = itk_modulepath.

    The problem with this is: We changed the Litmus CMakeLists.txt file here to get the correct value for CMAKE_PREFIX_PATH (issue was mentioned here). However, in Litmus we need to have the variable ${ITK_USE_FILE} be defined. This is was formerly done by the original ITKConfig.cmake file to which the CMAKE_PREFIX_PATH was pointing to. Now we somehow need to inject the ${ITK_USE_FILE} variable into Litmus CMake configuration, because - as written above - the automatically generated ITKConfig.cmake files does not define / know anything about UseITK.cmake.
kalali moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Apr 23 2021, 12:07 PM
kalali moved this task from Backlog to Doing on the MatchPoint board.

I was trying to test if I can forward the ITK_USE_FILE variable inside the ExternalProject call to Litmus, as we did in the change for the CMAKE_PREFIX_PATH. I realized that neither the CMAKE_PREFIX_PATH nor the ITK_USE_FILE is correctly forwarded and accessible inside Litmus CMake configuration.

One long term solution would also be to create an own Litmus Conan recipe and use this external Litmus package inside MatchPoint.

kalali removed kalali as the assignee of this task.EditedApr 23 2021, 2:50 PM

I will put this up for grabs as it does not make sense to start a new project now. Personally I will investigate further after the Conan evaluation report has been written.

kalali moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Apr 23 2021, 2:50 PM
kalali moved this task from Doing to Backlog on the MatchPoint board.