[Insight-users] build of cableswig - how to specify the SWIG Lib directory?

Darren Weber darren.weber.lists at gmail.com
Fri May 15 22:32:03 EDT 2009


Hi Luis,

Thanks for pointing out the tutorial, nice tip.  I do have a successful
build, but it seems that I need something more than a vanilla build and
install.  I apologize in advance for this long email, but there's no other
way than this to explain the situation.  I may need a patch to somehow
change how the cswig binary finds the SWIGLib directory.

I'm a registered MacPorts developer and my focus is on porting kitware tools
into the MacPorts system (see http://www.macports.org/).  I got involved in
this so that I can document the dependencies and the build configuration in
a functional system for OSX software distribution that will replicate a
given installation on any compatible OSX system, with MacPorts installed.

In order to use MacPorts, all the configuration details are saved in a
Portfile in the MacPorts svn, i.e.:
http://svn.macports.org/repository/macports/

The Portfiles are pseudo tcl scripts.  The content is fairly easy to read
too, even if you don't know tcl.  For example, this is the Portfile I've
been working on for vtk 5.4.0:
http://svn.macports.org/repository/macports/trunk/dports/graphics/vtk-devel/Portfile
Similarly, this is the Portfile for itk 3.12.0 (still a work in progress):
http://svn.macports.org/repository/macports/trunk/dports/graphics/InsightToolkit/Portfile
Also, here is a recent commit on a cableswig Portfile (a work in progress):
http://svn.macports.org/repository/macports/trunk/dports/devel/cableswig/Portfile

One thing to understand about MacPorts is that all the configuration and
builds occur in a *temporary* workspace and the 'make install' is directed
to a *temporary* DESTDIR within the workspace.  Once all the files are
installed in the DESTDIR, the MacPorts system scans and logs all the files,
then "installs" them to a software repository.  The final "activation" is
actually a process of hardlinks from the CMAKE_INSTALL_PATH to this software
repository.  A library or application can be "deactivated" by simply
removing the hard links and it can be immediately re-activated by creating
the hard links again.  It's a neat system that includes dependency
resolution and it's sweet when it all works well.

Note that the cmake variables have been updated to the following (which must
be defined using the command line cmake with -D options for variables;
${prefix} is '/opt/local'):

configure.args-append \
    -DBISON_YACC:FILEPATH=${prefix}/bin/bison \
    -DCMAKE_BUILD_TYPE:STRING=Release \
    -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
    -DCMAKE_OSX_SYSROOT=${universal_sysroot} \
    -DCMAKE_SKIP_RPATH:BOOL=OFF \
    -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
    -DCSWIG_USE_SYSTEM_GCCXML:BOOL=ON \
    -DSWIG_BUILD_EXAMPLES:BOOL=OFF \
    -DBUILD_TESTING:BOOL=OFF


Here's a summary of the build and installation to the DESTDIR (everything
works):

[... snip the build details ...]

Install the project...
/opt/local/bin/cmake -P cmake_install.cmake
-- Install configuration: "Release"
-- Installing:
/opt/local/var/macports/build/_Users_dweber_ports_devel_cableswig/work/destroot/opt/local/lib/CableSwig/CableSwigConfig.cmake
-- Installing:
/opt/local/var/macports/build/_Users_dweber_ports_devel_cableswig/work/destroot/opt/local/lib/CableSwig/SWIGLib/_std_deque.i
...[snip a few files]...


[ dweber at X ~/ports/devel/cableswig ]$ ll work/destroot/opt/local/bin/
total 1.8M
-rwxr-xr-x 1 root admin 445K 2009-05-15 18:42 cableidx*
-rwxr-xr-x 1 root admin 1.4M 2009-05-15 18:43 cswig*

[ dweber at X ~/ports/devel/cableswig ]$ ll
work/destroot/opt/local/lib/CableSwig/
total 4.0K
-rw-r--r--  1 root admin 314 2009-05-15 18:37 CableSwigConfig.cmake
drwxr-xr-x 21 root admin 714 2009-05-15 18:43 SWIGLib/
[ dweber at X ~/ports/devel/cableswig ]$ ll
work/destroot/opt/local/lib/CableSwig/SWIGLib/
total 96K
-rw-r--r--  1 root admin 4.1K 2003-04-09 10:34 _std_deque.i
-rw-r--r--  1 root admin  659 2004-02-18 06:45 allkw.swg
-rw-r--r--  1 root admin 2.9K 2004-02-18 06:45 carrays.i
-rw-r--r--  1 root admin 2.5K 2004-02-18 06:45 cdata.i
-rw-r--r--  1 root admin 2.2K 2004-02-18 06:45 cmalloc.i
-rw-r--r--  1 root admin 7.3K 2004-06-15 08:26 common.swg
-rw-r--r--  1 root admin 6.2K 2003-04-09 10:34 constraints.i
-rw-r--r--  1 root admin 3.6K 2004-02-18 06:45 cpointer.i
-rw-r--r--  1 root admin   78 2003-04-09 10:34 cstring.i
-rw-r--r--  1 root admin 8.6K 2004-02-18 06:45 exception.i
drwxr-xr-x 14 root admin  476 2009-05-15 18:43 java/
-rw-r--r--  1 root admin 2.0K 2004-02-18 06:45 math.i
-rw-r--r--  1 root admin  115 2003-04-09 10:34 pointer.i
drwxr-xr-x 33 root admin 1.1K 2009-05-15 18:43 python/
-rw-r--r--  1 root admin  118 2003-04-09 10:34 std_deque.i
-rw-r--r--  1 root admin  276 2004-02-18 06:45 stl.i
-rw-r--r--  1 root admin  13K 2004-02-18 06:45 swig.swg
-rw-r--r--  1 root admin   74 2004-02-18 06:45 swigrun.i
drwxr-xr-x 15 root admin  510 2009-05-15 18:43 tcl/





More information about the Insight-users mailing list