Giter Site home page Giter Site logo

Comments (17)

dzenanz avatar dzenanz commented on May 26, 2024 1

Update: we have a version of the involved software which compiles. I will follow up (this week or next) in respective repositories.

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

Initial and incremental builds seem to behave differently. The only idea I have is to rename ITKElastix from Elastix into something different (ElastixRM?) to reduce confusion and make debugging this easier.

from itkelastix.

thewtex avatar thewtex commented on May 26, 2024

Initial and incremental builds seem to behave differently. The only idea I have is to rename ITKElastix from Elastix into something different (ElastixRM?) to reduce confusion and make debugging this easier.

I am not following the issue. What is the issue, and how does the proposed change help?

CMake Error at C:/Dev/ITK-git-2015/_deps/elx-src/Core/CMakeLists.txt:184 (add_library):
Target "transformix_lib" links to itself.

We may be able to avoid this be specifying the ITK COMPONENTS required in these locations:

find_package(ITK REQUIRED)

https://github.com/SuperElastix/elastix/blob/90122eff6b37a17adc9f5bb3d7bc08608e9c14a6/CMakeLists.txt#L26

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

Now I see what is the problem: there is a true circular dependency. Elastix depends on ITK, and if ITK tries to depend on it via a remote module, the circle of dependence is complete. Just specifying components does not help, because ITKConfig.cmake contains set(ITK_MODULES_ENABLED "ITKDoubleConversion;...;Elastix;...;ITKWatersheds") and later itk_module_config(ITK ${ITK_MODULES_ENABLED}). The first time ITKElastix is enabled the in-source build can complete. But not subsequently.

One way to resolve this is for HASI to not be an ITK remote module, and just be an application which depends on ITK and Elastix (not good). Maybe another is for Elastix to have its own separate build of ITK (bad). The last is to merge ITKElastix into Elastix, so Elastix can behave as a remote module when being built as part of ITK (requires cooperation of Elastix maintainers).

from itkelastix.

thewtex avatar thewtex commented on May 26, 2024

set(ITK_MODULES_ENABLED "ITKDoubleConversion;...;Elastix;...;ITKWatersheds") and later

Right - if COMPONENTS is specified, Elastix will not be included per:

https://github.com/InsightSoftwareConsortium/ITK/blob/71c0bb375a3fcbc909e20e20c57bbfe6a672dd0b/CMake/ITKConfig.cmake.in#L81-L85

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

Specifying components indeed resolves circular dependency when building ITK.

But the link error LINK : fatal error LNK1104: cannot open file 'elastix_lib.lib' in HASI (log below) persists even with CMake export code. elastix_lib.lib does not exists, but C:\Dev\ITK-git-2015\lib\Debug\elastix-5.0.lib does. Maybe we need to do something different from this?

Build started...
1>------ Build started: Project: HASIHeaderTest1, Configuration: Debug x64 ------
2>------ Build started: Project: HASITestDriver, Configuration: Debug x64 ------
3>------ Build started: Project: ITKData, Configuration: Debug x64 ------
4>------ Build started: Project: ClangFormat, Configuration: Debug x64 ------
5>------ Build started: Project: HASIHeaderTestClean, Configuration: Debug x64 ------
6>------ Skipped Build: Project: Continuous, Configuration: Debug x64 ------
6>Project not selected to build for this solution configuration 
7>------ Skipped Build: Project: Experimental, Configuration: Debug x64 ------
7>Project not selected to build for this solution configuration 
8>------ Skipped Build: Project: Nightly, Configuration: Debug x64 ------
8>Project not selected to build for this solution configuration 
9>------ Skipped Build: Project: NightlyMemoryCheck, Configuration: Debug x64 ------
9>Project not selected to build for this solution configuration 
10>------ Skipped Build: Project: RUN_TESTS, Configuration: Debug x64 ------
10>Project not selected to build for this solution configuration 
11>------ Skipped Build: Project: ITKHeaderTests, Configuration: Debug x64 ------
11>Project not selected to build for this solution configuration 
1>LINK : fatal error LNK1104: cannot open file 'elastix_lib.lib'
1>Done building project "HASIHeaderTest1.vcxproj" -- FAILED.
2>LINK : fatal error LNK1104: cannot open file 'elastix_lib.lib'
2>Done building project "HASITestDriver.vcxproj" -- FAILED.
12>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
12>Project not selected to build for this solution configuration 
========== Build: 3 succeeded, 2 failed, 3 up-to-date, 7 skipped ==========

from itkelastix.

thewtex avatar thewtex commented on May 26, 2024

Great!

Does the ElastixTargets.cmake file have the elastix_lib.lib configuration, and does it set its path?

https://github.com/SuperElastix/elastix/blob/4b3ca0b27260e6ca4480a2edf074c6d32be1b8de/ElastixConfig.cmake.in#L15

Is ElastixTarget.cmake getting sourced in the configuration?

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

ElastixTargets.cmake does have elastix_lib target and sets its path as so:

# Import target "elastix_lib" for configuration "Debug"
set_property(TARGET elastix_lib APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(elastix_lib PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
  IMPORTED_LOCATION_DEBUG "C:/Dev/ITK-git-2015/lib/Debug/elastix-5.0.lib"
  )

ElastixConfig.cmake has this line: set( ELASTIX_CONFIG_TARGETS_FILE "${Elastix_DIR}/ElastixTargets.cmake" ). Is ElastixTargets.cmake supposed to be referenced by ITK? C:\Dev\ITK-git-2015\lib\cmake\ITK-5.2\Modules\Elastix.cmake has this content:

set(Elastix_LOADED 1)
set(Elastix_ENABLE_SHARED "0")
set(Elastix_DEPENDS "ITKCommon;ITKIOImageBase;ITKImageGrid;ITKImageSources;ITKSmoothing")
set(Elastix_PUBLIC_DEPENDS "ITKCommon;ITKIOImageBase;ITKImageGrid;ITKSmoothing")
set(Elastix_TRANSITIVE_DEPENDS "ITKCommon;ITKIOImageBase;ITKImageGrid;ITKImageSources;ITKSmoothing")
set(Elastix_PRIVATE_DEPENDS "")
set(Elastix_LIBRARIES "elastix_lib;transformix_lib")
set(Elastix_INCLUDE_DIRS "")
set(Elastix_LIBRARY_DIRS "")
set(Elastix_RUNTIME_LIBRARY_DIRS "C:/Dev/ITK-git-2015/bin")
set(Elastix_TARGETS_FILE "")
set(Elastix_FACTORY_NAMES "")

set(Elastix_DIR "C:/Dev/ITK-git-2015/_deps/elx-build")
find_package(Elastix REQUIRED)

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

If I manually change set(Elastix_TARGETS_FILE "") to set(Elastix_TARGETS_FILE "C:/Dev/ITK-git-2015/_deps/elx-build/ElastixTargets.cmake") the build of HASI succeeds.

from itkelastix.

thewtex avatar thewtex commented on May 26, 2024

Is ElastixTargets.cmake supposed to be referenced by ITK?

Yes

The route should be:

  1. ITK module configuration
  2. C:\Dev\ITK-git-2015\lib\cmake\ITK-5.2\Modules\Elastix.cmake
  3. find_package(Elastix REQUIRED)
  4. ElastixConfig.cmake
  5. ElastixTargets.cmake

If I manually change set(Elastix_TARGETS_FILE "") to set(Elastix_TARGETS_FILE "C:/Dev/ITK-git-2015/_deps/elx-build/ElastixTargets.cmake") the build of HASI succeeds.

Can we patch elastix/ElastixConfig.cmake.in to address this?

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

My attempt dzenanz@9f21804 does not work. How would modifying elastix/ElastixConfig.cmake.in affect C:\Dev\ITK-git-2015\lib\cmake\ITK-5.2\Modules\Elastix.cmake?

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

Uncommenting

#include(${ELASTIX_USE_FILE})
causes CMake error in ITK:

...
Enabled ITKZLIB, requested by ITK_BUILD_DEFAULT_MODULES.
CMake Error at C:/Dev/ITK-git-2015/_deps/elx-build/UseElastix.cmake:22 (include):
  The file

    C:/Dev/ITK-git-2015/_deps/elx-build/ElastixTargets.cmake

  was generated by the export() command.  It may not be used as the argument
  to the include() command.  Use ALIAS targets instead to refer to targets by
  alternative names.

Call Stack (most recent call first):
  Modules/Remote/Elastix/CMakeLists.txt:64 (include)


Checking for InitOnceExecuteOnce:
...

from itkelastix.

thewtex avatar thewtex commented on May 26, 2024

My attempt dzenanz/ITKElastix@9f21804 does not work. How would modifying elastix/ElastixConfig.cmake.in affect C:\Dev\ITK-git-2015\lib\cmake\ITK-5.2\Modules\Elastix.cmake?

The change needs to be made in upstream elastix.

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

CMake Error at C:/Dev/ITK-git-2015/_deps/elx-build/ElastixConfig.cmake:19 (include):
The file

C:/Dev/ITK-git-2015/_deps/elx-build/ElastixTargets.cmake

was generated by the export() command. It may not be used as the argument
to the include() command. Use ALIAS targets instead to refer to targets by
alternative names.

Call Stack (most recent call first):
Modules/Remote/Elastix/CMakeLists.txt:61 (find_package)

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

https://stackoverflow.com/questions/37204734/correctly-set-cmake-variables-when-adding-yaml-cpp-to-existing-project

from itkelastix.

thewtex avatar thewtex commented on May 26, 2024

Has this been addressed?

from itkelastix.

dzenanz avatar dzenanz commented on May 26, 2024

Partly addressed, partly abandoned.

from itkelastix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.