[Insight-users] switching debug and release build of itk build

Xavier Mellado Esteban xavier.mellado at upf.edu
Wed Mar 28 10:35:13 EST 2007


   Dear Felix:

   I am sorry, but for me, it is difficult to figure out what happens 
with this information. The way you include ITK in your project, it is 
not the usual one. Let me explain how I would do this.

1) Building

   Uncompress ITK in any folder, for example: 
/home/felix/InsightToolkit-3-2-0

   cd /home/felix/InsightToolkit-3-2-0
   mkdir bin
   cd bin
   mkdir release
   mkdir debug

   (so you have /home/felix/InsightToolkit-3-2-0/bin/release and 
/home/felix/InsightToolkit-3-2-0/bin/debug)

   cd release
   ccmake ../..

   Set CMAKE_BUILD_TYPE to Release

   Configure, generate and compile.

   You can do the same with debug, go to 
/home/felix/InsightToolkit-3-2-0/bin/debug folder and set 
CMAKE_BUILD_TYPE to Debug. Configure, generate and compile.

   If you want to install it, I suggest you to install at "/opt" . If 
you go to the release folder "make install" will create 
/opt/InsightToolkit-3-2-0, rename it to 
/opt/InsightToolkit-3-2-0-Release and do the same with debug, in order 
to create /opt/InsightToolkit-3-2-0-Debug. If you want to be more 
elegant, you can also create soft links with:

   ln -s InsightToolkit-3-2-0-Release ITK
   ln -s InsightToolkit-3-2-0-Debug ITK-Debug

   This will create /opt/ITK (release mode) and /opt/ITK-Debug (debug 
mode), so you will be able to change ITK version only installing a new 
version and changing the soft link, other users will not notice that...

   Now ITK is compiled and installed.

2) Including ITK

   Go to your project CMakeLists.txt and add the following lines.

   FIND_PACKAGE(ITK)
   IF(ITK_FOUND)
      INCLUDE(${ITK_USE_FILE})
   ELSE(ITK_FOUND)
      MESSAGE(FATAL_ERROR "Please set ITK_DIR.")
   ENDIF(ITK_FOUND)

   This code, usually, will give you an error at project configuration, 
asking for ITK folder. Set ITK_DIR to /opt/ITK/lib/InsightToolkit

   If you only include UseITK.cmake you are missing ITKConfig.cmake that 
is the one that sets most of the settings needed for build something 
against ITK.

                            I hope this helps you:
                                                                    Xavi



Felix Bollenbeck escribió:
> Xavier,
> yes, when i moved the Debug build and changed CMakelists.txt
>
> INCLUDE(/home/felix/Desktop/InsightDebug/UseITK.cmake)
>
> I cant link too:
>
> ...
> /home/felix/lad/main.cpp:45:22: error: itkImage.h: No such file or 
> directory
> ...
>
> Did i miss some vital points about using cmake?
>
> Thanks,
>
> Felix.
>
>
>
>
> Xavier Mellado Esteban schrieb:
>>
>>   Dear Felix:
>>
>>   Did you build debug at the same folder than the older release?
>>
>>   If so, all libs have been overwrote (you will need to compile again 
>> in release, I suggest you to build release and debug libs in 
>> separated folders).
>>
>>   If not, it's very strange, try to move the debug folder to another 
>> place and use the release folder, in order to know if there is 
>> "something" that mess your compilations (if something under release 
>> folder points to debug folder, you have move it, and when you try to 
>> configure or build it will crash), and let us know...
>>
>>                    I hope this helps you:
>>                                                        Xavi
>>
>> Felix Bollenbeck escribió:
>>> Hi ITKers,
>>>
>>> I build ITK for debug after building a release type. debugging my 
>>> tries with kdevelop works fine. now I would like to test my code 
>>> with the release build.
>>>
>>> I tried naive setting the Include directive in CMakelists.txt to
>>>
>>> InsightReleaseBuild/UseITK.cmake
>>>
>>> which didnt work. How can I link the (older) release build?
>>>
>>> Regards,
>>>
>>>    felix.
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>


-- 
___________________________________

Xavier Mellado Esteban
Computational Imaging Lab
Department of Technology - D. 328
Pompeu Fabra University
Pg. Circumval·lació 8
08003 Barcelona - Spain

Phone: +34 93 542 1323
E-mail: xavier.mellado at upf.edu
Skype: xavier.mellado



More information about the Insight-users mailing list