Giter Site home page Giter Site logo

findfftw's Introduction

CMake module for finding FFTW 3 using find_package

Usage

Once added to your project, this module allows you to find FFTW libraries and headers using the CMake find_package command:

find_package(FFTW [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] )

This module sets the following variables:

  • FFTW_FOUND ... true if fftw is found on the system
  • FFTW_[component]_LIB_FOUND ... true if the component is found on the system (see components below)
  • FFTW_LIBRARIES ... full paths to all found fftw libraries
  • FFTW_[component]_LIB ... full path to one of the components (see below)
  • FFTW_INCLUDE_DIRS ... fftw include directory paths

The following variables will be checked by the module:

  • FFTW_USE_STATIC_LIBS ... if true, only static libraries are found, otherwise both static and shared.
  • FFTW_ROOT ... if set, the libraries are exclusively searched under this path.

This package supports the following components:

  • FLOAT_LIB
  • DOUBLE_LIB
  • LONGDOUBLE_LIB
  • FLOAT_THREADS_LIB
  • DOUBLE_THREADS_LIB
  • LONGDOUBLE_THREADS_LIB
  • FLOAT_OPENMP_LIB
  • DOUBLE_OPENMP_LIB
  • LONGDOUBLE_OPENMP_LIB
  • FLOAT_MPI_LIB
  • DOUBLE_MPI_LIB
  • LONGDOUBLE_MPI_LIB

and the following linking targets

  • FFTW::Float
  • FFTW::Double
  • FFTW::LongDouble
  • FFTW::FloatThreads
  • FFTW::DoubleThreads
  • FFTW::LongDoubleThreads
  • FFTW::FloatOpenMP
  • FFTW::DoubleOpenMP
  • FFTW::LongDoubleOpenMP
  • FFTW::FloatMPI
  • FFTW::DoubleMPI
  • FFTW::LongDoubleMPI

Adding to your project

Automatic download from CMake project

Copy the following into the CMakeLists.txt file of the project you want to use FindFFTW in:

configure_file(downloadFindFFTW.cmake.in findFFTW-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
        RESULT_VARIABLE result
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findFFTW-download )
if(result)
    message(FATAL_ERROR "CMake step for findFFTW failed: ${result}")
    else()
    message("CMake step for findFFTW completed (${result}).")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
        RESULT_VARIABLE result
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findFFTW-download )
if(result)
    message(FATAL_ERROR "Build step for findFFTW failed: ${result}")
endif()

set(findFFTW_DIR ${CMAKE_CURRENT_BINARY_DIR}/findFFTW-src)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${findFFTW_DIR}")

And add a file called downloadFindFFTW.cmake.in to your project containing the following:

cmake_minimum_required(VERSION 2.8.2)

project(findFFTW-download NONE)

include(ExternalProject)

ExternalProject_Add(findFFTW_download
    GIT_REPOSITORY    "https://github.com/egpbos/findfftw.git"
    CONFIGURE_COMMAND ""
    BUILD_COMMAND     ""
    INSTALL_COMMAND   ""
    TEST_COMMAND      ""
    SOURCE_DIR        "${CMAKE_CURRENT_BINARY_DIR}/findFFTW-src"
    BINARY_DIR        ""
    INSTALL_DIR       ""
)

After this, find_package(FFTW) can be used in the CMakeLists.txt file.

Manual

Clone the repository into directory PREFIX/findFFTW:

git clone https://github.com/egpbos/findfftw.git PREFIX/findFFTW

Then add the following to your CMakeLists.txt to allow CMake to find the module:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "PREFIX/findFFTW")

findfftw's People

Contributors

egpbos avatar hello-adam avatar kprussing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

findfftw's Issues

Add test suite and CI

I want to add a test suite on which FFTW is installed/compiled with all the possible options and FindFFTW tries to find them from CMakeLists.txt files. This suite should then run on CI, I think GitHub Actions would be best.

As mentioned in #3 (comment), I think this will make adding new features like #3 a lot easier.

fftw not found when installed in non standard place

Hello,
i compiled and installed fftw3 in ~/LIBS/fftw-3.3.10. I'm using cmake as noted in your README, but i got the message:

cmake -DFFTW_ROOT=~/LIBS/fftw-3.3.10 .. 
...

-- Build files have been written to: /home/me/AMUbox/projets/modelisation-simujura/build/findFFTW-download
CMake step for findFFTW completed (0).
[ 11%] Performing update step for 'findFFTW_download'
Current branch master is up to date.
[ 22%] No configure step for 'findFFTW_download'
[ 33%] No build step for 'findFFTW_download'
[ 44%] No install step for 'findFFTW_download'
[ 55%] No test step for 'findFFTW_download'
[ 66%] Completed 'findFFTW_download'
[100%] Built target findFFTW_download
-- Could NOT find FFTW (missing: FLOAT_LIB FLOAT_OPENMP_LIB) 
FFTW not found


i notice that fftw3 comes with pkg-config file, is it possible to use it to find FFTW with cmake? it seems necessary to set PKG_CONFIG_PATH to dir given by FFTW_ROOT and the reult will be:

$ pkg-config --libs fftw3
-L/home/me/LIBS/fftw-3.3.10/lib -lfftw3

Thanks for help

Gérard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.