[Insight-developers] ITK Module Questions / third party interdepencies

Williams, Norman K norman-k-williams at uiowa.edu
Thu May 31 14:43:05 EDT 2012


On 5/31/12 1:08 PM, "Brad King" <brad.king at kitware.com> wrote:

>On 05/31/2012 01:07 PM, Williams, Norman K wrote:
>> As a proof of concept
>
>Did you publish anything we can see anywhere or is this still
>in early development form locally?

http://review.source.kitware.com/#/c/5989/


>
>For now you can special case it with the same
>
>  add_dependencies(ITKIODCMTK dcmtk)

It it more consistent to have ITKIODCMTK depend on ITKDCMTK.  As I stated
in my last e-mail, I think I made that work by adding
        add_dependencies(ITKDCMTK-all dcmtk)
after the itk_module_impl() call.

The IMPORTED library thing is interesting;  I will read up on it.  Again,
I'm not sure how well it will solve the deployment issues; we'll want the
dcmtk libraries and headers to get installed alongside the regular ITK
libraries. There are other ThirdParty modules (e.g. VNL) who already
handle that; but since DCMTK will build externally, I'm not sure the same
solution applies.

As long as I'm getting all fancy, there's another thing I need to figure
out: There are other libraries that DCMTK depends on that I'm building as
external projects.

All of them besides ICONV are already getting built as ThirdParty Modules
(TIFF,JPEG, and ZLIB), so it seems like a good idea to build DCMTK against
them.  In that case, I'd have to make the DCMTK ExternalProject depend on
them, so they get built first before the DCMTK-config step gets run.


>Ideally we would create IMPORTED library targets for the
>libraries built by the external project and that themselves
>"depend" on the external project build target.  Even though
>CMake imported targets do not actually build, CMake does
>propagate their "dependencies" through to any other real
>targets that depend on the imported libraries.  Then you can
>simply list the imported library targets as the libraries
>provided by the module and dependencies will hook up nicely.
>
>The problem is that IMPORTED targets are visible only in the
>directory that defines them and below.  Therefore targets
>created in Modules/ThirdParty/DCMTK would not be visible to
>the other modules as imported targets.  CMake 2.8.8 has a
>new feature added here:
>
> http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca39c5cd
> http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9c1c622
>
>that could be used to avoid the problem if we could depend
>on it.  However, I think we can get away without it anyway.
>
>Here is a sketch of how the imported target might work:
>
>  # Modules/ThirdParty/DCMTK/itk-module-init.cmake
>  add_library(itkdcmtk STATIC IMPORTED)
>  set_property(TARGET itkdcmtk PROPERTY IMPORTED_LOCATION
>    ${somewhere_that_dcmtk_builds}/lib/libdcmtk.a)
>
>  # Modules/ThirdParty/DCMTK/CMakeLists.txt
>  set(ITKDCMTK_LIBRARIES itkdcmtk)
>  ExternalProject_Add(dcmtk_build ...)
>  add_dependencies(itkdcmtk dcmtk_build)
>
>By defining the imported target in itk-module-init.cmake it
>will be loaded by the top-level CMakeLists.txt and so will
>be visible everywhere even without CMake 2.8.8.  Once the
>dependency is added on dcmtk_build CMake will guarantee that
>any targets that link to itkdcmtk will depend on dcmtk_build.
>
>Note that the IMPORTED_LOCATION property of the imported
>target will need to be filled with platform-specific names
>computed by logic conditioned on the platform and build
>tools.  This is inevitable no matter the approach because
>CMake must process and configure ITK before the external
>project source even downloads.  The code will just have to
>know where the library files will be built.
>
>> 2. how would I get the list of DCMTK libraries to be installed once
>>DCMTK
>> is built? Right now, the include directories, library list, and the lib
>> directory get suck into the proper lists, but in the case of actually
>> installing ITK, none of them would get added to the installation.
>
>Let's see if you can get past the first part above before
>we worry about this.
>
>-Brad K



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list