git-svn-id: svn://db.shs.com.ru/pip@397 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -34,6 +34,7 @@ file(WRITE "src/pip_version_str.h" "// This file was generated by PIP CMake, don
|
||||
option(ICU "Unicode support" 1)
|
||||
option(USB "USB support" 0)
|
||||
option(STL "Building with STL containers" 0)
|
||||
option(STL_IOSTREAM "Building with std iostream operators support" 0)
|
||||
option(CRYPT "Crypt support" 0)
|
||||
option(FFTW "fftw3 support for PIFFT" 0)
|
||||
option(FFTW_THREADS "fftw3 support for threadsave" 1)
|
||||
@@ -41,11 +42,22 @@ option(INTROSPECTION_CONTAINERS "Build with containers introspection" 0)
|
||||
option(INTROSPECTION_THREADS "Build with threads introspection" 0)
|
||||
option(LIB "System install" 1)
|
||||
option(DEBUG "Build with -g3" 0)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
set(LIBS)
|
||||
|
||||
|
||||
if(DEBUG)
|
||||
add_definitions(-DPIP_DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
|
||||
message(STATUS "Build debug version")
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
message(STATUS "Build relaese version")
|
||||
endif()
|
||||
|
||||
if(STL_IOSTREAM)
|
||||
add_definitions(-DPIP_STD_IOSTREAM)
|
||||
message(STATUS "Building with std iostream operators support")
|
||||
else()
|
||||
message(STATUS "Building without std iostream operators support")
|
||||
endif()
|
||||
|
||||
# Sources
|
||||
@@ -90,6 +102,7 @@ if(PIP_MATH_YN)
|
||||
add_definitions(-DPIP_MATH_YN)
|
||||
endif()
|
||||
|
||||
set(LIBS)
|
||||
if(WIN32)
|
||||
list(APPEND CMAKE_LIBRARY_PATH ${MINGW_LIB})
|
||||
endif()
|
||||
@@ -151,21 +164,42 @@ endif()
|
||||
|
||||
# Check if PIP support fftw3 for PIFFT using in math module
|
||||
if(FFTW)
|
||||
message(STATUS "Building with fftw3 support")
|
||||
# find_library(${fftw3} ${LIB_})
|
||||
add_definitions(-DPIP_FFTW)
|
||||
set(FFTW_LIB_NAME fftw3)
|
||||
list(APPEND FFTW_LIB_LIST_ ${FFTW_LIB_NAME} ${FFTW_LIB_NAME}f ${FFTW_LIB_NAME}l ${FFTW_LIB_NAME}q)
|
||||
if(WIN32)
|
||||
add_definitions(-DPIP_FFTW_THREADSAFE)
|
||||
list(APPEND LIBS fftw3-3 fftw3f-3 fftw3l-3)
|
||||
foreach(FFTW_LIB_ ${FFTW_LIB_LIST_})
|
||||
list(APPEND FFTW_LIB_LIST "${FFTW_LIB_}-3")
|
||||
endforeach()
|
||||
else()
|
||||
list(APPEND LIBS fftw3 fftw3f)
|
||||
if(FFTW_THREADS)
|
||||
add_definitions(-DPIP_FFTW_THREADSAFE)
|
||||
list(APPEND LIBS fftw3_threads fftw3f_threads)
|
||||
else()
|
||||
message(STATUS "WARNING PIFFTW::preparePlan was not threadsafe")
|
||||
endif()
|
||||
set(FFTW_LIB_LIST ${FFTW_LIB_LIST_})
|
||||
endif()
|
||||
if(FFTW_THREADS)
|
||||
add_definitions(-DPIP_FFTW_THREADSAFE)
|
||||
foreach(FFTW_LIB_T ${FFTW_LIB_LIST})
|
||||
list(APPEND FFTW_LIB_LIST "${FFTW_LIB_T}_threads")
|
||||
endforeach()
|
||||
else()
|
||||
message(STATUS "WARNING PIFFTW::preparePlan was not threadsafe")
|
||||
endif()
|
||||
foreach(FFTW_LIB ${FFTW_LIB_LIST})
|
||||
find_library("${FFTW_LIB}_FOUND" ${FFTW_LIB})
|
||||
if(${FFTW_LIB}_FOUND)
|
||||
message(STATUS "Check ${FFTW_LIB} OK")
|
||||
list(APPEND LIBS ${FFTW_LIB})
|
||||
if("${FFTW_LIB}" MATCHES "${FFTW_LIB_NAME}f")
|
||||
add_definitions(-DPIP_FFTW_FLOAT)
|
||||
endif()
|
||||
if("${FFTW_LIB}" MATCHES "${FFTW_LIB_NAME}l")
|
||||
add_definitions(-DPIP_FFTW_LDOUBLE)
|
||||
endif()
|
||||
if("${FFTW_LIB}" MATCHES "${FFTW_LIB_NAME}q")
|
||||
add_definitions(-DPIP_FFTW_QDOUBLE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Check ${FFTW_LIB} missing")
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
message(STATUS "Building without fftw3 support")
|
||||
endif()
|
||||
@@ -206,11 +240,11 @@ endif()
|
||||
foreach(LIB_ ${LIBS})
|
||||
find_library("${LIB_}_FOUND" ${LIB_})
|
||||
message(STATUS "Check the ${LIB_} is installed: " ${${LIB_}_FOUND})
|
||||
if("${${LIB_}_FOUND}" STREQUAL "${LIB_}_FOUND-NOTFOUND")
|
||||
message(WARNING "library ${LIB_} not found, please install it")
|
||||
else()
|
||||
if(${LIB_}_FOUND)
|
||||
list(APPEND LIBS ${LIB_})
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIB_})
|
||||
else()
|
||||
message(WARNING "library ${LIB_} not found, please install it")
|
||||
endif()
|
||||
endforeach()
|
||||
if(WIN32)
|
||||
|
||||
@@ -23,8 +23,11 @@
|
||||
#include "pibase.h"
|
||||
#include "piflags.h"
|
||||
#include "pimonitor.h"
|
||||
#include <iosfwd>
|
||||
|
||||
#ifdef PIP_STD_IOSTREAM
|
||||
# include <iostream>
|
||||
#else
|
||||
# include <iosfwd>
|
||||
#endif
|
||||
|
||||
extern PIMonitor piMonitor;
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#ifdef PIP_FFTW_FLOAT
|
||||
template<> inline const PIVector<complex<float> > & PIFFTW<float>::calcFFT(const PIVector<complex<float> > & in) {return ((_PIFFTW_P_float_*)p)->calcFFT(in);}
|
||||
template<> inline const PIVector<complex<float> > & PIFFTW<float>::calcFFT(const PIVector<float> & in) {return ((_PIFFTW_P_float_*)p)->calcFFTR(in);}
|
||||
template<> inline const PIVector<complex<float> > & PIFFTW<float>::calcFFTinverse(const PIVector<complex<float> > & in) {return ((_PIFFTW_P_float_*)p)->calcFFTI(in);}
|
||||
@@ -169,6 +170,7 @@ template<> inline void PIFFTW<float>::newP(void *& _p) {_p = new _PIFFTW_P_float
|
||||
template<> inline void PIFFTW<float>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_float_*)_p; _p = 0;}
|
||||
|
||||
typedef PIFFTW<float> PIFFTWf;
|
||||
#endif // PIP_FFTW_FLOAT
|
||||
|
||||
|
||||
template<> inline const PIVector<complex<double> > & PIFFTW<double>::calcFFT(const PIVector<complex<double> > & in) {return ((_PIFFTW_P_double_*)p)->calcFFT(in);}
|
||||
@@ -181,7 +183,7 @@ template<> inline void PIFFTW<double>::deleteP(void *& _p) {if (_p) delete (_PIF
|
||||
typedef PIFFTW<double> PIFFTWd;
|
||||
|
||||
|
||||
#ifdef WINDOWS
|
||||
#ifdef PIP_FFTW_LDOUBLE
|
||||
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFT(const PIVector<complex<ldouble> > & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFT(in);}
|
||||
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFT(const PIVector<ldouble> & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFTR(in);}
|
||||
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFTinverse(const PIVector<complex<ldouble> > & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFTI(in);}
|
||||
@@ -190,6 +192,6 @@ template<> inline void PIFFTW<ldouble>::newP(void *& _p) {_p = new _PIFFTW_P_ldo
|
||||
template<> inline void PIFFTW<ldouble>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_ldouble_*)_p; _p = 0;}
|
||||
|
||||
typedef PIFFTW<ldouble> PIFFTWld;
|
||||
#endif // WINDOWS
|
||||
#endif // PIP_FFTW_LDOUBLE
|
||||
|
||||
#endif // PIFFT_H
|
||||
|
||||
@@ -136,6 +136,7 @@ public:
|
||||
|
||||
|
||||
#ifdef PIP_FFTW
|
||||
#ifdef PIP_FFTW_FLOAT
|
||||
template<> inline void PIFFTW_Private<float>::p_createPlan_c2c_1d(void *& plan, int size, const void * in, void * out, int dir, int flags) {
|
||||
plan = fftwf_plan_dft_1d(size, (fftwf_complex *)in, (fftwf_complex *)out, dir, flags);}
|
||||
template<> inline void PIFFTW_Private<float>::p_createPlan_r2c_1d(void *& plan, int size, const void * in, void * out, int flags) {
|
||||
@@ -147,6 +148,7 @@ template<> inline void PIFFTW_Private<float>::p_destroyPlan(void *& plan) {if (p
|
||||
#ifdef PIP_FFTW_THREADSAFE
|
||||
template<> inline void PIFFTW_Private<float>::p_makeThreadSafe() {fftwf_make_planner_thread_safe();}
|
||||
#endif
|
||||
#endif // PIP_FFTW_FLOAT
|
||||
|
||||
template<> inline void PIFFTW_Private<double>::p_createPlan_c2c_1d(void *& plan, int size, const void * in, void * out, int dir, int flags) {
|
||||
plan = fftw_plan_dft_1d(size, (fftw_complex *)in, (fftw_complex *)out, dir, flags);}
|
||||
@@ -160,7 +162,7 @@ template<> inline void PIFFTW_Private<double>::p_destroyPlan(void *& plan) {if (
|
||||
template<> inline void PIFFTW_Private<double>::p_makeThreadSafe() {fftw_make_planner_thread_safe();}
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
#ifdef PIP_FFTW_LDOUBLE
|
||||
template<> inline void PIFFTW_Private<ldouble>::p_createPlan_c2c_1d(void *& plan, int size, const void * in, void * out, int dir, int flags) {
|
||||
plan = fftwl_plan_dft_1d(size, (fftwl_complex *)in, (fftwl_complex *)out, dir, flags);}
|
||||
template<> inline void PIFFTW_Private<ldouble>::p_createPlan_r2c_1d(void *& plan, int size, const void * in, void * out, int flags) {
|
||||
@@ -172,7 +174,7 @@ template<> inline void PIFFTW_Private<ldouble>::p_destroyPlan(void *& plan) {if
|
||||
#ifdef PIP_FFTW_THREADSAFE
|
||||
template<> inline void PIFFTW_Private<ldouble>::p_makeThreadSafe() {fftwl_make_planner_thread_safe();}
|
||||
#endif
|
||||
#endif // WINDOWS
|
||||
#endif // PIP_FFTW_LDOUBLE
|
||||
|
||||
|
||||
#endif // PIP_FFTW
|
||||
|
||||
Reference in New Issue
Block a user