Начало
This commit is contained in:
commit
c6a3fd0f2d
449
FindFFTW.cmake
Normal file
449
FindFFTW.cmake
Normal file
@ -0,0 +1,449 @@
|
|||||||
|
# - Find the FFTW library
|
||||||
|
#
|
||||||
|
# Original version of this file:
|
||||||
|
# Copyright (c) 2015, Wenzel Jakob
|
||||||
|
# https://github.com/wjakob/layerlab/blob/master/cmake/FindFFTW.cmake, commit 4d58bfdc28891b4f9373dfe46239dda5a0b561c6
|
||||||
|
# Modifications:
|
||||||
|
# Copyright (c) 2017, Patrick Bos
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# find_package(FFTW [version] [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] )
|
||||||
|
#
|
||||||
|
# It 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
|
||||||
|
# FFTW_VERSION ... fftw version found
|
||||||
|
#
|
||||||
|
# The following variables will be checked by the function
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
|
||||||
|
# TODO (maybe): extend with ExternalProject download + build option
|
||||||
|
# TODO: put on conda-forge
|
||||||
|
|
||||||
|
|
||||||
|
if( NOT FFTW_ROOT AND DEFINED ENV{FFTWDIR} )
|
||||||
|
set( FFTW_ROOT $ENV{FFTWDIR} )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check if we can use PkgConfig
|
||||||
|
find_package(PkgConfig)
|
||||||
|
|
||||||
|
#Determine from PKG
|
||||||
|
if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )
|
||||||
|
pkg_check_modules( PKG_FFTW QUIET "fftw3" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#Check whether to search static or dynamic libs
|
||||||
|
set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} )
|
||||||
|
|
||||||
|
if( ${FFTW_USE_STATIC_LIBS} )
|
||||||
|
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )
|
||||||
|
else()
|
||||||
|
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( FFTW_ROOT )
|
||||||
|
# find libs
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_LIB
|
||||||
|
NAMES "fftw3" libfftw3-3
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_THREADS_LIB
|
||||||
|
NAMES "fftw3_threads"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_OPENMP_LIB
|
||||||
|
NAMES "fftw3_omp"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_MPI_LIB
|
||||||
|
NAMES "fftw3_mpi"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_LIB
|
||||||
|
NAMES "fftw3f" libfftw3f-3
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_THREADS_LIB
|
||||||
|
NAMES "fftw3f_threads"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_OPENMP_LIB
|
||||||
|
NAMES "fftw3f_omp"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_MPI_LIB
|
||||||
|
NAMES "fftw3f_mpi"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_LONGDOUBLE_LIB
|
||||||
|
NAMES "fftw3l" libfftw3l-3
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_LONGDOUBLE_THREADS_LIB
|
||||||
|
NAMES "fftw3l_threads"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_LONGDOUBLE_OPENMP_LIB
|
||||||
|
NAMES "fftw3l_omp"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_LONGDOUBLE_MPI_LIB
|
||||||
|
NAMES "fftw3l_mpi"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "lib" "lib64"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
#find includes
|
||||||
|
find_path(FFTW_INCLUDE_DIRS
|
||||||
|
NAMES "fftw3.h"
|
||||||
|
PATHS ${FFTW_ROOT}
|
||||||
|
PATH_SUFFIXES "include"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_LIB
|
||||||
|
NAMES "fftw3"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_THREADS_LIB
|
||||||
|
NAMES "fftw3_threads"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_OPENMP_LIB
|
||||||
|
NAMES "fftw3_omp"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_DOUBLE_MPI_LIB
|
||||||
|
NAMES "fftw3_mpi"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_LIB
|
||||||
|
NAMES "fftw3f"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_THREADS_LIB
|
||||||
|
NAMES "fftw3f_threads"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_OPENMP_LIB
|
||||||
|
NAMES "fftw3f_omp"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_FLOAT_MPI_LIB
|
||||||
|
NAMES "fftw3f_mpi"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_LONGDOUBLE_LIB
|
||||||
|
NAMES "fftw3l"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
FFTW_LONGDOUBLE_THREADS_LIB
|
||||||
|
NAMES "fftw3l_threads"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FFTW_LONGDOUBLE_OPENMP_LIB
|
||||||
|
NAMES "fftw3l_omp"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FFTW_LONGDOUBLE_MPI_LIB
|
||||||
|
NAMES "fftw3l_mpi"
|
||||||
|
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(FFTW_INCLUDE_DIRS
|
||||||
|
NAMES "fftw3.h"
|
||||||
|
PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
endif( FFTW_ROOT )
|
||||||
|
|
||||||
|
#--------------------------------------- components
|
||||||
|
|
||||||
|
if (FFTW_DOUBLE_LIB)
|
||||||
|
set(FFTW_DOUBLE_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_LIB})
|
||||||
|
add_library(FFTW::Double INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::Double
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_DOUBLE_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_FLOAT_LIB)
|
||||||
|
set(FFTW_FLOAT_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_LIB})
|
||||||
|
add_library(FFTW::Float INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::Float
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_FLOAT_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_LONGDOUBLE_LIB)
|
||||||
|
set(FFTW_LONGDOUBLE_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_LIB})
|
||||||
|
add_library(FFTW::LongDouble INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::LongDouble
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_LONGDOUBLE_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_DOUBLE_THREADS_LIB)
|
||||||
|
set(FFTW_DOUBLE_THREADS_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_THREADS_LIB})
|
||||||
|
add_library(FFTW::DoubleThreads INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::DoubleThreads
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_THREADS_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_DOUBLE_THREADS_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_FLOAT_THREADS_LIB)
|
||||||
|
set(FFTW_FLOAT_THREADS_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_THREADS_LIB})
|
||||||
|
add_library(FFTW::FloatThreads INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::FloatThreads
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_THREADS_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_FLOAT_THREADS_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_LONGDOUBLE_THREADS_LIB)
|
||||||
|
set(FFTW_LONGDOUBLE_THREADS_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_THREADS_LIB})
|
||||||
|
add_library(FFTW::LongDoubleThreads INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::LongDoubleThreads
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_THREADS_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_LONGDOUBLE_THREADS_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_DOUBLE_OPENMP_LIB)
|
||||||
|
set(FFTW_DOUBLE_OPENMP_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_OPENMP_LIB})
|
||||||
|
add_library(FFTW::DoubleOpenMP INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::DoubleOpenMP
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_OPENMP_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_DOUBLE_OPENMP_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_FLOAT_OPENMP_LIB)
|
||||||
|
set(FFTW_FLOAT_OPENMP_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_OPENMP_LIB})
|
||||||
|
add_library(FFTW::FloatOpenMP INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::FloatOpenMP
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_OPENMP_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_FLOAT_OPENMP_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_LONGDOUBLE_OPENMP_LIB)
|
||||||
|
set(FFTW_LONGDOUBLE_OPENMP_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_OPENMP_LIB})
|
||||||
|
add_library(FFTW::LongDoubleOpenMP INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::LongDoubleOpenMP
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_OPENMP_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_LONGDOUBLE_OPENMP_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_DOUBLE_MPI_LIB)
|
||||||
|
set(FFTW_DOUBLE_MPI_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_MPI_LIB})
|
||||||
|
add_library(FFTW::DoubleMPI INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::DoubleMPI
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_MPI_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_DOUBLE_MPI_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_FLOAT_MPI_LIB)
|
||||||
|
set(FFTW_FLOAT_MPI_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_MPI_LIB})
|
||||||
|
add_library(FFTW::FloatMPI INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::FloatMPI
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_MPI_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_FLOAT_MPI_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFTW_LONGDOUBLE_MPI_LIB)
|
||||||
|
set(FFTW_LONGDOUBLE_MPI_LIB_FOUND TRUE)
|
||||||
|
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_MPI_LIB})
|
||||||
|
add_library(FFTW::LongDoubleMPI INTERFACE IMPORTED)
|
||||||
|
set_target_properties(FFTW::LongDoubleMPI
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_MPI_LIB}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(FFTW_LONGDOUBLE_MPI_LIB_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------- end components
|
||||||
|
|
||||||
|
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
|
||||||
|
|
||||||
|
# Deduce the version
|
||||||
|
execute_process(COMMAND fftw-wisdom-to-conf -V
|
||||||
|
RESULT_VARIABLE success
|
||||||
|
OUTPUT_VARIABLE stdout
|
||||||
|
ERROR_VARIABLE stderr)
|
||||||
|
if (success EQUAL 0)
|
||||||
|
string(REGEX MATCH "FFTW *version *([0-9]+([.][0-9]+([.][0-9]+)?)?)"
|
||||||
|
_version ${stdout}
|
||||||
|
)
|
||||||
|
string(REPLACE " " ";" _version_list ${_version})
|
||||||
|
list(GET _version_list -1 FFTW_VERSION)
|
||||||
|
set(_version_list)
|
||||||
|
set(_version)
|
||||||
|
else()
|
||||||
|
message("Error running fftw-wisdom-to-conf. Could not determine FFTW version
|
||||||
|
Output:
|
||||||
|
${stdout}
|
||||||
|
|
||||||
|
Error:
|
||||||
|
${stderr}
|
||||||
|
")
|
||||||
|
set(FFTW_VERSION)
|
||||||
|
endif()
|
||||||
|
set(stdout)
|
||||||
|
set(stderr)
|
||||||
|
set(success)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(FFTW
|
||||||
|
REQUIRED_VARS FFTW_INCLUDE_DIRS
|
||||||
|
VERSION_VAR FFTW_VERSION
|
||||||
|
HANDLE_COMPONENTS
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
FFTW_INCLUDE_DIRS
|
||||||
|
FFTW_LIBRARIES
|
||||||
|
FFTW_FLOAT_LIB
|
||||||
|
FFTW_DOUBLE_LIB
|
||||||
|
FFTW_LONGDOUBLE_LIB
|
||||||
|
FFTW_FLOAT_THREADS_LIB
|
||||||
|
FFTW_DOUBLE_THREADS_LIB
|
||||||
|
FFTW_LONGDOUBLE_THREADS_LIB
|
||||||
|
FFTW_FLOAT_OPENMP_LIB
|
||||||
|
FFTW_DOUBLE_OPENMP_LIB
|
||||||
|
FFTW_LONGDOUBLE_OPENMP_LIB
|
||||||
|
FFTW_FLOAT_MPI_LIB
|
||||||
|
FFTW_DOUBLE_MPI_LIB
|
||||||
|
FFTW_LONGDOUBLE_MPI_LIB
|
||||||
|
FFTW_VERSION
|
||||||
|
)
|
51
FindMathGL.cmake
Normal file
51
FindMathGL.cmake
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
set(MATHGL_PREFIX "" CACHE PATH "The path to the prefix of an MathGL installation")
|
||||||
|
|
||||||
|
find_path(MATHGL_INCLUDE_DIR NAMES mgl2/mgl.h
|
||||||
|
PATHS
|
||||||
|
${MATHGL_PREFIX}/include
|
||||||
|
/opt/local/include
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(MATHGL_LIBRARIES NAMES mgl mgl2
|
||||||
|
PATHS
|
||||||
|
${MATHGL_PREFIX}/lib
|
||||||
|
/opt/local/include
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(MATHGL_QT5_LIBRARIES NAMES mgl-qt5 mgl2-qt5
|
||||||
|
PATHS
|
||||||
|
${MATHGL_PREFIX}/lib
|
||||||
|
/opt/local/include
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MATHGL_INCLUDE_DIR AND MATHGL_LIBRARIES)
|
||||||
|
get_filename_component(MATHGL_LIBRARY_DIR ${MATHGL_LIBRARIES} PATH)
|
||||||
|
set(MATHGL_FOUND TRUE)
|
||||||
|
add_library(MathGL::Mgl INTERFACE IMPORTED)
|
||||||
|
set_target_properties(MathGL::Mgl PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${MATHGL_INCLUDE_DIR}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${MATHGL_LIBRARIES}"
|
||||||
|
)
|
||||||
|
add_library(MathGL::Qt5 INTERFACE IMPORTED)
|
||||||
|
set_target_properties(MathGL::Qt5 PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${MATHGL_INCLUDE_DIR}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${MATHGL_QT5_LIBRARIES}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MATHGL_FOUND)
|
||||||
|
if(NOT MATHGL_FIND_QUIETLY)
|
||||||
|
MESSAGE(STATUS "Found MathGL: ${MATHGL_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
set(HAVE_MATHGL 1)
|
||||||
|
elseif(MATHGL_FOUND)
|
||||||
|
if(MATHGL_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find MATHGL")
|
||||||
|
endif()
|
||||||
|
endif()
|
54
FindQuadmath.cmake
Normal file
54
FindQuadmath.cmake
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Module that checks whether the compiler supports the
|
||||||
|
# quadruple precision floating point math
|
||||||
|
#
|
||||||
|
# Sets the following variables:
|
||||||
|
# HAVE_QUAD
|
||||||
|
# QUADMATH_LIBRARIES
|
||||||
|
#
|
||||||
|
# perform tests
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
include(CMakePushCheckState)
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
|
if(NOT DEFINED USE_QUADMATH OR USE_QUADMATH)
|
||||||
|
if(NOT DEFINED HAVE_EXTENDED_NUMERIC_LITERALS)
|
||||||
|
check_cxx_compiler_flag("-Werror -fext-numeric-literals" HAVE_EXTENDED_NUMERIC_LITERALS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (HAVE_EXTENDED_NUMERIC_LITERALS)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
cmake_push_check_state(RESET)
|
||||||
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath")
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
|
#include <quadmath.h>
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
__float128 foo = sqrtq(123.456);
|
||||||
|
foo = FLT128_MIN;
|
||||||
|
}" QUADMATH_FOUND)
|
||||||
|
cmake_pop_check_state()
|
||||||
|
|
||||||
|
if (QUADMATH_FOUND)
|
||||||
|
set(QUADMATH_LIBRARIES "quadmath")
|
||||||
|
set(HAVE_QUAD "${QUADMATH_FOUND}")
|
||||||
|
add_library(QuadMath::QuadMath INTERFACE IMPORTED)
|
||||||
|
set_target_properties(QuadMath::QuadMath PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES quadmath
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS _GLIBCXX_USE_FLOAT128
|
||||||
|
INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-fext-numeric-literals>)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (USE_QUADMATH AND NOT QUADMATH_FOUND)
|
||||||
|
message(FATAL_ERROR "Quadruple precision math support was explicitly requested but is unavailable!")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Quadmath
|
||||||
|
DEFAULT_MSG
|
||||||
|
QUADMATH_LIBRARIES
|
||||||
|
QUADMATH_FOUND
|
||||||
|
)
|
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Модули поиска для CMake
|
||||||
|
|
||||||
|
Репозиторий модулей для поиска программ и библиотек.
|
||||||
|
Для использования необходимо поместить нужный модуль
|
||||||
|
в каталог, указанный в переменной `CMAKE_MODULES_PATH`.
|
||||||
|
|
||||||
|
В проектах, использующих библиотеку [`myx`](../myx),
|
||||||
|
для модулей поиска предназначен каталог `cmake/find`.
|
Loading…
Reference in New Issue
Block a user