[Insight-developers] FFT Image Filter Classes Committed: Question about configuration

Luis Ibanez luis . ibanez at kitware . com
Wed, 15 Oct 2003 09:55:05 -0400


Hi Kent,

The following CMake commands should be a good starting
point for adding this advanced option:

    OPTION(USE_FFTW "Use the FFTW library" OFF)
    MARK_AS_ADVANCED(USE_FFTW)
    IF( USE_FFTW )
      FIND_PATH(FFTW_INCLUDE fftw.h "/usr/local/include")
      FIND_LIBRARY(FFTW_LIBRARY fftw "/usr/local/lib")
    ENDIF( USE_FFTW )

Where the /usr/local...  directories can be a long list
of typical directories where you would expect to find
fftw headers and libraries both in Windows and Unix.

You may want to look at the CMakeLists.txt file in the top
level of the ITK source tree for similar examples.



A nicer approach for the long term will be to move these
commands to a CMake Module:

                    FindFFTW.cmake

to be added to CMake itself. In that case, the lines
to add in ITK will be something like

   OPTION(USE_FFTW "Use the FFTW library" OFF)
    MARK_AS_ADVANCED(USE_FFTW)
    IF( USE_FFTW )
       FIND_PACKAGE( FFTW )
    ENDIF( USE_FFTW )

The great advantage is that the complexity of finding the
libraries and headers will be factorized in the FindFFTW.cmake
module.


The CMakeLists.txt on the top directory of InsightApplication
is also a good source of inspiration. Look for example at
the setup for VTK.



Regards,


   Luis


---------------------
Kent Williams wrote:
> With some trepidation, I just checked in the classes that implement FFT 
> processing wrapped as ITK Image Filters.  Trepidation because I always seem 
> to break something when I do checkins. I've spent some time trying to verify 
> that the code is going to be Kosher on the platforms I have access to.
> 
> The baseline implementation uses the VNL library FFT routines. I also include 
> a class that uses the FFTW library, but does not include any FFTW code at 
> all.  The FFTW code only gets used in Testing/Code/Algorithms if the CMake 
> boolean USE_FFTW is defined. 
> 
> What I'd like to have happen is for USE_FTTW to be a top-level advanced CMake 
> variable. I'd also need FFTW_INCLUDE and FFT_LIBRARY to tell CMake where the 
> header and library is.  Could someone point me at an example of defining and 
> setting advanced variables in the CMakelist files?
> 
> Thanks!
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk . org
> http://www . itk . org/mailman/listinfo/insight-developers
>