# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 # $Id$ PortSystem 1.0 name InsightToolkit version 3.16.0 revision 3 set branch [join [lrange [split ${version} .] 0 1] .] # Online documentation on the 3.16 release: # http://www.kitware.com/news/home/browse/CMake?2009_09_16&ITK+3.16+Released # http://www.itk.org/Wiki/ITK_Release_3.16 categories graphics math science devel maintainers nomaintainer description Insight Segmentation and Registration Toolkit (ITK) long_description \ ITK is an open-source software toolkit for performing registration and segmentation. Segmentation is the process of identifying and classifying data found in a digitally sampled representation. Typically the sampled representation is an image acquired from such medical instrumentation as CT or MRI scanners. Registration is the task of aligning or developing correspondences between data. For example, in the medical environment, a CT scan may be aligned with a MRI scan in order to combine the information contained in both. homepage http://www.itk.org/ master_sites sourceforge:itk distname InsightToolkit-${branch} distfiles InsightToolkit-${version}.tar.gz \ CableSwig-ITK-${version}.tar.gz # Also update checksums for the documentation in the doc variant. checksums InsightToolkit-${version}.tar.gz \ md5 e532b419530645bd88da0efb1815d8f7 \ sha1 4131f12471366d0e5f3a6d13155c419be5fceba8 \ rmd160 eeb63df6bdb86aa82943375dbcfcf4da0bdac7a3 \ CableSwig-ITK-${version}.tar.gz \ md5 02161e59567bff4eaa7305c022bec230 \ sha1 be596fcff68c65ec45979166e56b2627e765988f \ rmd160 abf686dd34b6d9445340037f54ad9e27f82ffa76 extract.only InsightToolkit-${version}.tar.gz \ CableSwig-ITK-${version}.tar.gz patchfiles oom.patch platforms darwin depends_build port:gmake \ port:gawk \ port:cmake \ port:bison depends_lib port:ossp-uuid # Use gmake and build in a separate directory from the source build.type gnu build.dir ${workpath}/${distname}-build # The parallel build would be nice, but it's not reliable. use_parallel_build no # Global variables, used in variants, where a destroot prefix is appended, # when necessary. There are numerous default build assumptions in both cmake # and ITK that use the 'InsightToolkit' name, and many post-destroot hacks in # this port that assume this name also. If the port is renamed, say # InsightToolkit312, the post-destroot hacks must use ${itkName}. set itkName InsightToolkit set itkBuildBin ${build.dir}/bin set itkIncPath ${prefix}/include/${distname} set itkLibPath ${prefix}/lib/${distname} set itkSharePath ${prefix}/share/${distname} set itkDocFile DoxygenInsightToolkit-${version}.tar.gz set itkDocPath ${itkSharePath}/doc set itkDataPath ${itkSharePath}/data set itkExamplePath ${itkSharePath}/examples set itkTestingPath ${itkSharePath}/testing set itkExampleBin ${itkExamplePath}/bin set itkTestingBin ${itkTestingPath}/bin set itkExampleSrc ${worksrcpath}/Examples set itkTestingSrc ${worksrcpath}/Testing set itkWrapLibPath ${itkLibPath}/WrapITK/lib # Using this dummy stage to inspect MacPorts variables # (using 'port -d fetch InsightToolkit') #fetch { system "echo ${itkLibPath}" } post-extract { move ${workpath}/InsightToolkit-${version} ${worksrcpath} move ${workpath}/CableSwig-ITK-${version} ${worksrcpath}/Utilities/CableSwig ui_msg "***************************************************" ui_msg "InsightToolkit is a very long config/build process." ui_msg "It can take several hours, even on a fast system." ui_msg "Parallel builds are disabled, on purpose. It can" ui_msg "fail sometimes. First try to run the build several" ui_msg "times to see if it will complete. A fall-back " ui_msg "install is just the c++ libs (no tcl/java/py wrapping)," ui_msg "port install InsightToolkit -doc -python25 +shared" ui_msg "***************************************************" } configure { xinstall -d -m 0755 ${build.dir} system "cd ${build.dir} && cmake ${configure.args} ${worksrcpath}" } # To double-check all the cmake variable settings after the configure #cd ${build.dir} #sudo cmake -LAH ../itk-${branch} > ~/cmake_vars.txt # Similarly, for an interactive configuration with ccmake, try: #cd ${build.dir} #sudo ccmake ../itk-${branch} # Get the size of RAM in Gigabits set gigabits "" catch {set gigabits [expr [sysctl hw.memsize] / pow(1024,3)]} configure.args-append \ -DBUILD_DOXYGEN:BOOL=OFF \ -DBUILD_EXAMPLES:BOOL=OFF \ -DBUILD_TESTING:BOOL=OFF \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ -DCMAKE_INCLUDE_PATH:PATH=${prefix}/include \ -DCMAKE_LIBRARY_PATH:PATH=${prefix}/lib \ -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${distname} \ -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DITK_COMPUTER_MEMORY_SIZE:STRING=${gigabits} \ -DITK_USE_REVIEW:BOOL=ON \ -DITK_USE_OPTIMIZED_REGISTRATION_METHODS:BOOL=ON \ -DUUID_INCLUDE_DIR:PATH=${prefix}/include/uuid \ -DUUID_LIBRARY:FILEPATH=${prefix}/lib/libuuid.dylib post-destroot { # For some reason, cmake does not install into the CMAKE_INSTALL_NAME_DIR move ${destroot}${prefix}/lib/${itkName} ${destroot}${itkLibPath} move ${destroot}${prefix}/include/${itkName} ${destroot}${itkIncPath} # Create a symlink from the generic lib, include, and share for InsightToolkit to # this version; this should be done by InsightToolkitSelect ln -sf ${distname} ${destroot}${prefix}/lib/${itkName} ln -sf ${distname} ${destroot}${prefix}/include/${itkName} ln -sf ${distname} ${destroot}${prefix}/share/${itkName} # copy FindITK.cmake to a version specific file, which might persist even # when cmake is updated, deactivated, etc. set cmakePath [lrange [lsort [glob ${prefix}/share/cmake-*]] end end] set findITK [glob ${cmakePath}/Modules/FindITK.cmake] set findITKbranch [strsed ${findITK} #FindITK#FindITK-${branch}#] xinstall -d -m 0755 ${destroot}${cmakePath}/Modules copy ${findITK} ${destroot}${findITKbranch} # Change the content of $findITKbranch, to find this port installation, # then a generic ITK installation within MacPorts ${prefix}/lib, and # then other generic installation locations set stdlib /usr/local/lib/InsightToolkit set maclib ${prefix}/lib/InsightToolkit # First replace any generic MacPorts lib paths reinplace "\$!N;s|^.*${maclib}.*\\n||g" ${destroot}${findITKbranch} # Now insert all the additional library paths, with the right precedence reinplace "s|${stdlib}|${maclib}-${branch}\\\n ${maclib}\\\n ${stdlib}|g" ${destroot}${findITKbranch} # Change the content of ITKConfig.cmake reinplace "s|${itkName}|${distname}|g" ${destroot}${itkLibPath}/ITKConfig.cmake copy ${destroot}${itkLibPath}/ITKConfig.cmake ${destroot}${itkLibPath}/itk-${branch}-config.cmake # Move binaries to version specific binaries foreach f [list ImageCompare ImageCompareCommand ImageCopy itkTestDriver] { if [file isfile ${destroot}${prefix}/bin/$f] { move ${destroot}${prefix}/bin/$f ${destroot}${prefix}/bin/${f}-${branch} # This should be done by InsightToolkitSelect ln -sf ${f}-${branch} ${destroot}${prefix}/bin/$f } } } # ----------------------------------------------------------------------------- # VARIANTS # variant name [requires variant] [conflicts variant] [description description] default_variants \ +doc # Test the python26 variant ASAP. #if {![variant_isset python24] && ![variant_isset python25] && ![variant_isset python26]} { if {![variant_isset python24] && ![variant_isset python25]} { default_variants-append +python25 } # universal variant is failing, so let's disable it universal_variant no variant doc description "provide doxygen documentation in ${itkDocPath}" { distfiles-append ${itkDocFile} checksums-append ${itkDocFile} \ md5 d36591eeeb66d083b2e89aabec48e34a \ sha1 5175b3ed01d1875979d6f66d0b1d02f39e3f4b34 \ rmd160 3eaa6d0fae62b6ecf92be0cf61c8c86f9162623e post-destroot { set itkDocPathLink ${prefix}/share/doc/${distname} xinstall -d -o root -g admin -m 0755 ${destroot}${itkDocPath} xinstall -d -o root -g admin -m 0755 ${destroot}${itkDocPathLink} # Add the doxygen documentation system "tar --strip-components 1 -C ${destroot}${itkDocPath} -zxf ${distpath}/${itkDocFile}" # Add basic documentation file copy ${worksrcpath}/Copyright ${destroot}${itkDocPath}/ file copy ${worksrcpath}/Copyright.txt ${destroot}${itkDocPath}/ file copy ${worksrcpath}/README.html ${destroot}${itkDocPath}/ # Create a symlink to the $prefix path (not the destroot path); use the # system to do this because the $prefix path doesn't exist yet and the # tcl ln command fails, whereas this system command will allow it. system "ln -Fns ${itkDocPath} ${destroot}${itkDocPathLink}" } } # --- Data variants # Change this to the itkDataPath and use post-destroot to relocate all this data #-DITK_DATA_ROOT:PATH=${worksrcpath}/Testing/Data ##// Directory with data taken from http://public.kitware.com/pub/itk/Data/BrainWeb/ ##ITK_BRAINWEB_DATA_ROOT:PATH=ITK_BRAINWEB_DATA_ROOT-NOTFOUND variant brainweb description "provide ITK BrainWeb data in ${itkDataPath}" { master_sites-append \ http://public.kitware.com/pub/itk/Data/BrainWeb:brainweb distfiles-append \ BrainPart1.tgz:brainweb \ BrainPart1Rotated10Translated15.tgz:brainweb \ BrainPart1Rotated20Translated20.tgz:brainweb \ BrainPart2.tgz:brainweb \ BrainPart2Rotated10Translated15.tgz:brainweb \ BrainPart2Rotated20Translated20.tgz:brainweb \ BrainPart3.tgz:brainweb \ BrainPart3Rotated10Translated15.tgz:brainweb \ BrainPart3Rotated20Translated20.tgz:brainweb checksums-append \ BrainPart1.tgz \ md5 e722d697f9d0b51023652b3fe7348658 \ sha1 e91f5c4928c880b944e1559eee015170c1badc4b \ rmd160 b5cbb557df0b019afe3f411deea72ef464626ace \ BrainPart1Rotated10Translated15.tgz \ md5 9d052710929477b1ddb5095575a5d7f9 \ sha1 effc10374f1e70ded967fb55237cd600b6ef51ca \ rmd160 3e1f19dbe48b7912f46f255459330fde50f96b62 \ BrainPart1Rotated20Translated20.tgz \ md5 36af81caf9ea7ce9b72987ff6d08ddf3 \ sha1 4c10b5ab612282361f344d1432664067bc94c736 \ rmd160 d6d23117fbf8803b0488b4fd5bddb739576d983f \ BrainPart2.tgz \ md5 458b0903a2fb52a1cae616eddf817142 \ sha1 21659b5ee37a9ed0958c79a1943dd5ebafbe27ec \ rmd160 dc85b393c8dfbf04ba2aa0690237acfb185ada4e \ BrainPart2Rotated10Translated15.tgz \ md5 8c978a660e442e4ed06e77bc4f769af2 \ sha1 58c1b5a6d9e8a965f3e73febca012747b0246702 \ rmd160 3867b0d006fa8b5af084a78fa812aff69c2ad0c1 \ BrainPart2Rotated20Translated20.tgz \ md5 5f53d805ab4346b933ce52c7b34e67b2 \ sha1 f29740e4760ffc602e9a6b2aa2b96efabcff1aa6 \ rmd160 2441747f0c98e9f2fa24a1c7ca9294bed729dcc0 \ BrainPart3.tgz \ md5 c6f5edccbb2c0ba418e4666fe989eb15 \ sha1 20cdee786c710aed0df6943bcbaa9c62bb82e773 \ rmd160 3f730bf426a6509c73c58902220b64cb3324b136 \ BrainPart3Rotated10Translated15.tgz \ md5 61893ca3df13d24530275758de702fef \ sha1 4f6ba74d68a7e477fd43237213d4d4e4ce839503 \ rmd160 ba408d2ff6297af7f76af82ae24e9afe519bb80c \ BrainPart3Rotated20Translated20.tgz \ md5 db63c7567d1c021860d59812eb41dfa9 \ sha1 2e14b66beef00acc8cd17942d9bf0c155841a934 \ rmd160 42d403505116e8b9885d00964376cee909711bd0 configure.args-append \ -DITK_BRAINWEB_DATA_ROOT:PATH=${itkDataPath} post-destroot { xinstall -d -o root -g admin -m 0755 ${destroot}${itkDataPath} foreach tgz [exec find ${distpath} -name "BrainPart*.tgz"] { system "tar -C ${destroot}${itkDataPath} -zxf ${tgz}" } } } ##// Directory with data taken from http://public.kitware.com/pub/itk/Data/HealthyVolunteersMRIDatabase/ ##ITK_MRI_UNC_DATABASE_DATA_ROOT:PATH=ITK_MRI_UNC_DATABASE_DATA_ROOT-NOTFOUND #http://public.kitware.com/pub/itk/Data/HealthyVolunteersMRIDatabase/Brain_MRA_From_UNC_Collection.zip #http://public.kitware.com/pub/itk/Data/HealthyVolunteersMRIDatabase/LICENSE.txt # During install, use a message to echo the LICENSE.txt file ##// Directory with data taken from http://www.osirix-viewer.com/Downloads.html ##ITK_OSIRIX_DATA_ROOT:PATH=ITK_OSIRIX_DATA_ROOT-NOTFOUND # sourceforge downloads: #http://prdownloads.sourceforge.net/osirix/CardiacCT.zip?download #http://prdownloads.sourceforge.net/osirix/PET-CT.zip?download # More datasets available from: #http://pubimage.hcuge.ch:8080/ # Notes on RPATH settings for the shared dylib build and install: # # CMake book, Appendix A, p 234: "CMAKE_SKIP_BUILD_RPATH: Do not include RPATHs # in the build tree. Normally CMake uses the build tree for the RPATH when # building executables etc. on systems that use RPATH. When the software is # installed the executables etc. are relinked by CMake to have the install # RPATH. If this variable is set to true then the software is always built with # no RPATH." # # CMake book, Appendix B, p. 301: "... SKIP_BUILD_RPATH is a boolean specifying # whether to skip automatic generation of an rpath allowing the target to run # from the build tree. BUILD_WITH_INSTALL_RPATH is a boolean specifying whether # to link the target in the build tree with the INSTALL_RPATH. This takes # precedence over SKIP_BUILD_RPATH and avoids the need for relinking before # installation." # # Using CMAKE_SKIP_BUILD_RPATH:BOOL=OFF, we get all the executables and dylibs # built with the $build.dir in the rpath. For this to work, we must also have # CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF. After the build, at the destroot # phase, all the installation candidates (which excludes the examples and # testing binaries) have their rpath settings reset to the INSTALL_RPATH (which # should point to $prefix..., not the $destroot location). variant shared description "build shared libraries" { configure.args-delete \ -DBUILD_SHARED_LIBS:BOOL=OFF configure.args-append \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DCMAKE_SKIP_RPATH:BOOL=OFF \ -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF \ -DCMAKE_INSTALL_RPATH:STRING=${itkLibPath} } proc resetLibLinks { inputPath } { # The example and testing binaries are built, but they are not "installed". # All their rpath settings point to the build.dir, so they must be # reset using install_name_tool for the destroot install. global itkBuildBin itkLibPath foreach f [glob ${inputPath}/*] { if [string equal [file extension ${f}] ".app"] { set exeName [file rootname [lindex [file split ${f}] end]] set f [format "%s/Contents/MacOS/%s" ${f} ${exeName}] } if [expr [file isfile ${f}] && [file executable ${f}]] { foreach dep [exec otool -L ${f}] { if [string match -nocase "*/libitk*.dylib" ${dep}] { set newdep [strsed ${dep} #${itkBuildBin}#${itkLibPath}#] system "install_name_tool -change ${dep} ${newdep} ${f}" } } } } } variant examples description "provide ITK examples in ${itkExamplePath}" { configure.args-delete \ -DBUILD_EXAMPLES:BOOL=OFF configure.args-append \ -DBUILD_EXAMPLES:BOOL=ON post-destroot { xinstall -d -o root -g admin -m 0755 ${destroot}${itkExampleBin} foreach f [glob ${itkExampleSrc}/*] { file copy ${f} ${destroot}${itkExamplePath}/ } # Find all the example executables by parsing all the # CMakeLists.txt files within the src Examples path set exe {} foreach f [exec find ${itkExampleSrc} -name "CMakeLists.txt"] { catch {exec grep -e "ADD_EXECUTABLE" ${f}} results if [expr ![string match "*child process*" ${results}]] { # Remove the string "ADD_EXECUTABLE(", with or without whitespace regsub -all "\[ \t\]*ADD_EXECUTABLE\[(\]\[ \t\]*" ${results} "" results # Remove the string ".cxx)", with or without whitespace regsub -all ".cxx\[ \t\]*\[)\]" ${results} "" results set exe [concat ${exe} ${results}] } } set exe [lsort -unique ${exe}] # Installations for the example binaries are in ${itkBuildBin}. # Copy them into the destroot example bin. foreach f $exe { set f ${itkBuildBin}/${f} if [expr [file isfile ${f}] && [file executable ${f}]] { file copy ${f} ${destroot}${itkExampleBin} } } # Only do this if the shared variant is selected? resetLibLinks ${destroot}${itkExampleBin} } } variant testing description "provide ITK testing in ${itkTestingPath}" { configure.args-delete \ -DBUILD_TESTING:BOOL=OFF configure.args-append \ -DBUILD_TESTING:BOOL=ON post-destroot { xinstall -d -o root -g admin -m 0755 ${destroot}${itkTestingBin} foreach f [glob ${itkTestingSrc}/*] { file copy ${f} ${destroot}${itkTestingPath}/ } # Find all the testing executables by parsing all the # CMakeLists.txt files within the itkTestingSrc path set exe {} foreach f [exec find ${itkTestingSrc} -name "CMakeLists.txt"] { catch {exec grep -e "ADD_EXECUTABLE" ${f}} results if [expr ![string match "*child process*" ${results}]] { # Remove the string "ADD_EXECUTABLE(", with or without whitespace regsub -all "\[ \t\]*ADD_EXECUTABLE\[(\]\[ \t\]*" ${results} "" results # Remove the string ".cxx)", with or without whitespace regsub -all ".cxx\[ \t\]*\[)\]" ${results} "" results set exe [concat ${exe} ${results}] } } set exe [lsort -unique ${exe}] # Installations for the testing binaries are in ${itkBuildBin}. # Copy them into the destroot testing bin. foreach f $exe { set f ${itkBuildBin}/${f} if [expr [file isfile ${f}] && [file executable ${f}]] { file copy ${f} ${destroot}${itkTestingBin} } } # Only do this if the shared variant is selected? resetLibLinks ${destroot}${itkTestingBin} } } # --- external languages support # Some of the wrapper libs are built, but they are not "installed". # All their rpath settings point to the build.dir, so they must be # reset using install_name_tool after the destroot phase. proc resetWrapLibs { filepattern } { global itkBuildBin itkLibPath itkWrapLibPath foreach f [glob ${filepattern}] { foreach dep [exec otool -L ${f}] { if [string match -nocase "*libSwigRuntime*" ${dep}] { set newdep [strsed ${dep} #${itkBuildBin}#${itkWrapLibPath}#] system "install_name_tool -change ${dep} ${newdep} ${f}" } elseif [string match -nocase "${itkBuildBin}*" ${dep}] { set newdep [strsed ${dep} #${itkBuildBin}#${itkLibPath}#] system "install_name_tool -change ${dep} ${newdep} ${f}" } } } } variant wrap requires shared description "USE_WRAP_ITK for external language support (includes shared)" { depends_lib-append \ port:guile \ port:tk # The WrapITK install path assumes a prefix of ${prefix}, but without this # variable setting, it will default to "lib/${itkName}/WrapITK" without the # version specific ${distname} set itkWrapInstallPath /lib/${distname}/WrapITK configure.args-append \ -DUSE_WRAP_ITK:BOOL=ON \ -DWRAP_ITK_JAVA:BOOL=ON \ -DWRAP_ITK_TCL:BOOL=ON \ -DCMAKE_CXX_FLAGS:STRING=-fpermissive \ -DGUILE_EXECUTABLE:FILEPATH=${prefix}/bin/guile \ -DGUILE_LIBRARY:FILEPATH=${prefix}/lib/libguile.dylib \ -DGUILE_INCLUDE_PATH:PATH=${prefix}/include/guile \ -DTCL_TCLSH:FILEPATH=${prefix}/bin/tclsh \ -DTCL_INCLUDE_PATH:PATH=${prefix}/include \ -DTCL_LIBRARY:FILEPATH=${prefix}/lib/libtcl.dylib \ -DTK_INCLUDE_PATH:PATH=${prefix}/include \ -DTK_LIBRARY:FILEPATH=${prefix}/lib/libtk.dylib # The following config option seems more trouble than useful: #-DWRAP_ITK_INSTALL_PREFIX:PATH=${itkWrapInstallPath} \ # Could enable this if the example variant is selected: #-DSWIG_BUILD_EXAMPLES:BOOL=ON post-destroot { # Reset dynamic library dependency paths (see proc above) resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.dylib resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.jnilib # Fix executable permissions and move itkwish to version specific file set itkwishSh ${destroot}${prefix}/bin/itkwish-${branch} move ${destroot}${prefix}/bin/itkwish ${itkwishSh} file attributes ${itkwishSh} -permissions 0755 # This should be done by InsightToolkitSelect ln -s itkwish-${branch} ${destroot}${prefix}/bin/itkwish # Change the content of itkwish reinplace "s|${itkName}|${distname}|g" ${itkwishSh} reinplace "s|//|/|g" ${itkwishSh} # Reset dynamic library dependency paths for itkwish binary set itkwishBin ${destroot}${itkLibPath}/WrapITK/bin/itkwish foreach dep [exec otool -L ${itkwishBin}] { if [string match "*Tcl.dylib" ${dep}] { set newdep [strsed ${dep} #${itkLibPath}#${itkWrapLibPath}#] system "install_name_tool -change ${dep} ${newdep} ${itkwishBin}" } } } } # The following were possiblilities identified by ccmake #-DPERL_EXECUTABLE ${prefix}/bin/perl #-DPERL_INCLUDE_PATH PERL_INCLUDE_PATH-NOTFOUND #-DPERL_LIBRARY PERL_LIBRARY-NOTFOUND #-DPHP4_EXECUTABLE ${prefix}/bin/php #-DPHP4_FOUND_INCLUDE_PATH PHP4_FOUND_INCLUDE_PATH-NOTFOUND #-DPIKE_EXECUTABLE PIKE_EXECUTABLE-NOTFOUND #-DPIKE_INCLUDE_PATH PIKE_INCLUDE_PATH-NOTFOUND #-DRUBY_EXECUTABLE RUBY_EXECUTABLE-NOTFOUND #-DRUBY_INCLUDE_PATH /System/Library/Frameworks/Ruby.framework/Headers #-DRUBY_LIBRARY RUBY_LIBRARY-NOTFOUND # Note for Ruby include path: # exec ruby -r rbconfig -e {puts Config::CONFIG["archdir"]} # Some default WrapITK settings: #WRAP_BinaryMorphology ON #WRAP_Calculators ON #WRAP_Compose ON #WRAP_DeformableTransforms ON #WRAP_Denoising ON #WRAP_DistanceMap ON #WRAP_EdgesAndContours ON #WRAP_FFT ON #WRAP_FFTW OFF #WRAP_Filtering ON #WRAP_IO ON #WRAP_ITK_DIMS 2;3 #WRAP_ITK_INSTALL_PREFIX /lib/InsightToolkit/WrapITK #WRAP_ITK_JAVA ON #WRAP_ITK_PYTHON ON #WRAP_ITK_TCL ON #WRAP_IntensityFilters ON #WRAP_Interpolators ON #WRAP_Iterators OFF #WRAP_LevelSet ON #WRAP_Morphology ON #WRAP_PixelMath ON #WRAP_Registration ON #WRAP_Resize ON #WRAP_Review ON #WRAP_SegmentationAndThreshold ON #WRAP_SegmentationValidation ON #WRAP_SimpleFilters ON #WRAP_UnaryPixelMath ON #WRAP_complex_double OFF #WRAP_complex_float ON #WRAP_covariant_vector_double OFF #WRAP_covariant_vector_float ON #WRAP_double OFF #WRAP_float ON #WRAP_rgb_unsigned_char OFF #WRAP_rgb_unsigned_short ON #WRAP_rgba_unsigned_char OFF #WRAP_rgba_unsigned_short ON #WRAP_signed_char OFF #WRAP_signed_long OFF #WRAP_signed_short OFF #WRAP_unsigned_char OFF #WRAP_unsigned_long OFF #WRAP_unsigned_short ON #WRAP_vector_double OFF #WRAP_vector_float ON # ----------------------------------------------------------------------------- # The USE_WRAP_ITK will configure a default tcl and java wrapping. Only enable # and modify the variants below to provide version specific language # wrappers. Each of these variants should require the wrap variant. proc setPython { {major 2} {minor 6} } { global pyVer python pyPort pyBin pyLib pyInc pyFrame pySite set pyVer ${major}.${minor} set python python${pyVer} set pyPort python${major}${minor} set pyFrame Library/Frameworks/Python.framework/Versions/${pyVer} set pyLib ${pyFrame}/Python #set pyLib lib/${python} set pyBin bin/${python} set pyInc include/${python} set pySite lib/${python}/site-packages if [string match "2.6" ${pyVer}] { # python2.6 is a true framework installation; whereas installs for 2.4 # and 2.5 contain symlinks in the framework path to the prefix path; and # those symlinks can break the file_map stage of port activation. set pyBin ${pyFrame}/bin/${python} set pyInc ${pyFrame}/include/${python} set pySite ${pyFrame}/lib/${python}/site-packages } } setPython proc pyPostDestroot {} { # This procedure applies for python24 and python25 (maybe python26) global destroot prefix branch \ itkLibPath itkName distname pySite # Reset dynamic library dependency paths (see proc above) resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.so # Move WrapITK.pth to version specific file set wrapITKpth ${destroot}${prefix}/${pySite}/WrapITK-${branch}.pth move ${destroot}${prefix}/${pySite}/WrapITK.pth ${wrapITKpth} # This symlink should be done with InsightToolkitSelect ln -s WrapITK-${branch}.pth ${destroot}${prefix}/${pySite}/WrapITK.pth # Change the content of WrapITK.pth (for any python version) reinplace "s|${itkName}|${distname}|g" ${wrapITKpth} reinplace "s|//|/|g" ${wrapITKpth} # Change the content of FindWrapITK.cmake (for any python version) set findWrapITK [glob ${destroot}${prefix}/share/cmake-*/Modules/FindWrapITK.cmake] regsub FindWrapITK.cmake ${findWrapITK} FindWrapITK-${branch}.cmake findWrapITK-branch move ${findWrapITK} ${findWrapITK-branch} reinplace "s|${itkName}|${distname}|g" ${findWrapITK-branch} reinplace "s|//|/|g" ${findWrapITK-branch} # This symlink should be done with InsightToolkitSelect ln -s FindWrapITK-${branch}.cmake ${findWrapITK} } variant python24 requires wrap conflicts python25 description "python 2.4 wrapper (includes wrap)" { setPython 2 4 # Hereafter python24 and python25 are the same, but how to abstract this? Maybe # a general pyXY variant that is required by python24 and python25, but not clear on # how the require precedence works with regard to the setPython proc. depends_lib-append \ port:${pyPort} configure.args-append \ -DWRAP_ITK_PYTHON:BOOL=ON \ -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \ -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \ -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \ -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \ -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite} post-destroot { pyPostDestroot } } variant python25 requires wrap conflicts python24 description "python 2.5 wrapper (includes wrap)" { setPython 2 5 depends_lib-append \ port:${pyPort} configure.args-append \ -DWRAP_ITK_PYTHON:BOOL=ON \ -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \ -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \ -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \ -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \ -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite} post-destroot { pyPostDestroot } } # Regardless of the pyLib setting for python26, cmake or the wrap config sets # the string "-framework Python", but this "-framework Python" setting actually # gets resolved by the link process into the Apple system /Framework path rather # than macports! I'm not clear about how to control this, so the python26 variant # must be disabled for now. If it's enabled, add the python26 variant to the # conflicts of python24 and python25. #variant python26 requires wrap conflicts python24 python25 description "python 2.6 wrapper (includes wrap)" { # setPython 2 6 # depends_lib-append \ # port:${pyPort} # configure.args-append \ # -DWRAP_ITK_PYTHON:BOOL=ON \ # -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \ # -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \ # -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \ # -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \ # -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite} # post-destroot { # pyPostDestroot # } #} #variant java requires wrap description "provide java wrapper" { # configure.args-append \ # # The following variables are defined automatically by cmake: # #-DJAVACOMMAND /usr/bin/java # #-DJAVA_ARCHIVE /usr/bin/jar # #-DJAVA_AWT_INCLUDE_PATH /System/Library/Frameworks/JavaVM.framework/Headers # #-DJAVA_AWT_LIBRARY -framework # #-DJAVA_COMPILE /usr/bin/javac # #-DJAVA_INCLUDE_PATH /System/Library/Frameworks/JavaVM.framework/Headers # #-DJAVA_INCLUDE_PATH2 /System/Library/Frameworks/JavaVM.framework/Headers # #-DJAVA_JVM_LIBRARY -framework # #-DJAVA_RUNTIME /usr/bin/java #} #variant tcl requires wrap description "tcl wrapper (MacPorts tcl/tk)" { # depends_lib-append \ # port:tcl \ # port:tk # configure.args-append \ # -DTCL_TCLSH:FILEPATH=${prefix}/bin/tclsh \ # -DTCL_INCLUDE_PATH:PATH=${prefix}/include \ # -DTCL_LIBRARY:FILEPATH=${prefix}/lib/libtcl.dylib \ # -DTK_INCLUDE_PATH:PATH=${prefix}/include \ # -DTK_LIBRARY:FILEPATH=${prefix}/lib/libtk.dylib #} # ----------------------------------------------------------------------------- # Additional possibilities for variants, not yet evaluated. #ITK_USE_LIBXML2 #ITK_USE_MINC2 #VNL_CONFIG_* #VXL_UPDATE_CONFIGURATION #variant kwstyle description {provide Kitware Style checking} { # depends_lib-append \ # port:kwstyle # configure.args-append \ # -DITK_USE_KWSTYLE:BOOL=ON #} #// Use an outside build of GDCM. #ITK_USE_SYSTEM_GDCM:BOOL=OFF #// Use the system's libxml2 library. #ITK_USE_SYSTEM_LIBXML2:BOOL=OFF #// Use the system's png library. #ITK_USE_SYSTEM_PNG:BOOL=OFF #// Use the system's tiff library. #ITK_USE_SYSTEM_TIFF:BOOL=OFF #// Use an outside build of VXL. #ITK_USE_SYSTEM_VXL:BOOL=OFF #// Use the system's zlib library. #ITK_USE_SYSTEM_ZLIB:BOOL=OFF # ----------------------------------------------------------------------------- #livecheck.type sourceforge #livecheck.regex