[Insight-developers] Using VXL and ITK in a single executable
Miller, James V (Research)
millerjv@crd.ge.com
Mon, 16 Dec 2002 13:50:55 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C2A534.1073DCCB
Content-Type: text/plain;
charset="iso-8859-1"
For those interested in mixing ITK ( www.itk.org <http://www.itk.org> ) with VXL (
http://vxl.sourceforge.net/ <http://vxl.sourceforge.net/> <http://www.vxl.org> ), I have built
executables
that uses both ITK and VXL algorithms. Since both systems use CMake, this is fairly straightforward.
CMake
does not come with a FindVXL.cmake module so my executable's source tree has its own. This project
builds
outside of the ITK and VXL source trees, i.e. it treats ITK and VXL as third party libraries.
The trick to mixing the toolkits is that both ITK and VXL use VCL and VNL. Of course, both are
included in
their respective source trees. Furthermore, ITK uses an old drop of VCL and VNL. However, if the VXL
include
and library paths are set BEFORE the ITK include and library paths then the project will compile.
Set them
up the other way around and hundreds of compile errors result.
To mix these toolkits properly, we should set up ITK's CMakeLists.txt files so that they can use
VXL's version
of VCL and VNL in place of its own copy. This would make sure that all of ITK is built with the
proper version
of VCL and VNL as opposed to just my executable. I would expect the way I am doing this currently, I
could
have hit upon a problem with duplicate and incompatible symbols.
But the set of classes that I was mixing for my executable, the following seems to work.
# ./foo/CMakeLists.txt
PROJECT(foo)
CMAKE_MINIMUM_REQUIRED(VERSION 1.4)
# Get VXL settings
#
INCLUDE( ${foo_SOURCE_DIR}/Modules/FindVXL.cmake )
IF (VXL_BINARY_PATH)
INCLUDE( ${VXL_BINARY_PATH}/UseVXL.cmake )
ENDIF (VXL_BINARY_PATH)
# Put VXL includes before ITK settings to ensure the VXL's versions
# of VCL and VNL are used
INCLUDE_DIRECTORIES( ${VXLCORE_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( ${MUL_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( ${RPL_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( ${GEL_INCLUDE_DIR} )
# Get ITK settings
#
INCLUDE( ${CMAKE_ROOT}/Modules/FindITK.cmake )
IF (USE_ITK_FILE)
INCLUDE( ${USE_ITK_FILE} )
ENDIF (USE_ITK_FILE)
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Jim Miller
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301
millerjv@research.ge.com <mailto:millerjv@research.ge.com>
james.miller@research.ge.com
(518) 387-4005, Dial Comm: 8*833-4005,
Cell: (518) 505-7065, Fax: (518) 387-6981
------_=_NextPart_001_01C2A534.1073DCCB
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2715.400" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=335083418-16122002><FONT size=2>For those interested in mixing
ITK (<A href="http://www.itk.org">www.itk.org</A>) with VXL (<A
href="http://vxl.sourceforge.net/">http://vxl.sourceforge.net/</A><A
href="http://www.vxl.org"></A>), I have built executables</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>that uses both ITK and VXL
algorithms. Since both systems use CMake, this is fairly straightforward.
CMake</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>does not come with a
FindVXL.cmake module so my executable's source tree has its own. This
project builds</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>outside of the ITK and VXL
source trees, i.e. it treats ITK and VXL as third party
libraries.</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>The trick to mixing the
toolkits is that both ITK and VXL use VCL and VNL. Of course, both are
included in </FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>their respective source
trees. Furthermore, ITK uses an old drop of VCL and VNL. However, if the
VXL include</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>and library paths are set
BEFORE the ITK include and library paths then the project will compile.
Set them </FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>up the other way around and
hundreds of compile errors result.</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>To mix these toolkits properly,
we should set up ITK's CMakeLists.txt files so that they can use VXL's
version</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>of VCL and VNL in place of its
own copy. This would make sure that all of ITK is built with the proper
version</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>of VCL and VNL as opposed to
just my executable. I would expect the way I am doing this currently, I
could</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>have hit upon a problem with
duplicate and incompatible symbols.</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2>But the set of classes that I
was mixing for my executable, the following seems to work.</FONT></SPAN></DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=335083418-16122002><FONT size=2></FONT></SPAN> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>#
./foo/CMakeLists.txt<BR>PROJECT(foo)<BR>CMAKE_MINIMUM_REQUIRED(VERSION
1.4)</FONT></DIV>
<DIV> </DIV><FONT size=2>
<DIV><BR># Get VXL settings<BR>#<BR>INCLUDE(
${foo_SOURCE_DIR}/Modules/FindVXL.cmake )<BR>IF (VXL_BINARY_PATH)<BR>
INCLUDE( ${VXL_BINARY_PATH}/UseVXL.cmake )<BR>ENDIF (VXL_BINARY_PATH)</DIV>
<DIV> </DIV>
<DIV># Put VXL includes before ITK settings to ensure the VXL's versions<BR># of
VCL and VNL are used<BR>INCLUDE_DIRECTORIES( ${VXLCORE_INCLUDE_DIR}
)<BR>INCLUDE_DIRECTORIES( ${MUL_INCLUDE_DIR} )<BR>INCLUDE_DIRECTORIES(
${RPL_INCLUDE_DIR} )<BR>INCLUDE_DIRECTORIES( ${GEL_INCLUDE_DIR} )</DIV>
<DIV> </DIV>
<DIV><BR># Get ITK settings<BR>#<BR>INCLUDE( ${CMAKE_ROOT}/Modules/FindITK.cmake
)<BR>IF (USE_ITK_FILE)<BR> INCLUDE( ${USE_ITK_FILE} )<BR>ENDIF
(USE_ITK_FILE)<BR></FONT></DIV>
<DIV class=Section1>
<P class=MsoNormal> <?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
<P style="MARGIN: 0in 0in 0pt"><B><SPAN
style="COLOR: navy; FONT-FAMILY: 'Comic Sans MS'">Jim Miller</SPAN></B>
<BR><B><I><SPAN
style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial">_____________________________________</SPAN></I></B><BR><EM><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Visualization &
Computer Vision</SPAN></EM><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial"><BR><EM>GE
Research</EM><BR><EM>Bldg. KW, Room C218B</EM><BR><EM>P.O. Box 8, Schenectady NY
12301</EM><BR><BR></SPAN></I><EM><U><SPAN
style="FONT-SIZE: 7.5pt; COLOR: blue"><A
href="mailto:millerjv@research.ge.com">millerjv@research.ge.com</A></SPAN></U></EM></P>
<P style="MARGIN: 0in 0in 0pt"><EM><U><SPAN
style="FONT-SIZE: 7.5pt; COLOR: blue">james.miller@research.ge.com</SPAN></U></EM><BR><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">(518) 387-4005, Dial
Comm: 8*833-4005, </SPAN></I><BR><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Cell: (518) 505-7065,
Fax: (518) 387-6981</SPAN></I> </P>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV> </DIV></BODY></HTML>
------_=_NextPart_001_01C2A534.1073DCCB--