git-svn-id: svn://db.shs.com.ru/pip@400 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-04-18 20:49:45 +00:00
parent b1b23bf89c
commit 95c1f34b45
192 changed files with 291 additions and 187 deletions

View File

@@ -4,14 +4,56 @@ cmake_minimum_required(VERSION 2.6)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
include(CheckFunctionExists)
# Options
option(ICU "Unicode support" 1)
option(STD_IOSTREAM "Building with std iostream operators support" 0)
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)
# Basic
macro(gather_src DIR CPP H H_P)
set(CS)
set(HS)
set(PHS)
file(GLOB CS "${DIR}/*.cpp")
file(GLOB HS "${DIR}/*.h")
file(GLOB PHS "${DIR}/*_p.h")
list(REMOVE_ITEM HS "${PHS}")
list(APPEND ${CPP} ${CS})
list(APPEND ${H} ${HS})
list(APPEND ${H_P} ${PHS})
endmacro()
set(PIP_SRC_MAIN "src_main")
set(PIP_SRC_CRYPT "src_crypt")
set(PIP_SRC_USB "src_usb")
set(PIP_SRC_FFTW "src_fftw")
set(PIP_LIBS_TARGETS pip)
set(LIBS_MAIN)
set(LIBS_STATUS)
#if(LIB)
if(WIN32)
if(MINGW)
find_package(MinGW REQUIRED)
list(APPEND CMAKE_LIBRARY_PATH ${MINGW_LIB})
endif()
endif()
#endif()
# Version
file(READ "src/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 3)
file(READ "src/piversion.h" VERSION_MAJOR LIMIT 1 OFFSET ${VERSION_OFFSET})
file(READ "src/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 7)
file(READ "src/piversion.h" VERSION_MINOR LIMIT 1 OFFSET ${VERSION_OFFSET})
file(READ "src/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 11)
file(READ "src/piversion.h" VERSION_REVISION LIMIT 1 OFFSET ${VERSION_OFFSET})
file(STRINGS "src/piversion.h" VERSION_SUFFIX REGEX "\".*\"")
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 3)
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_MAJOR LIMIT 1 OFFSET ${VERSION_OFFSET})
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 7)
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_MINOR LIMIT 1 OFFSET ${VERSION_OFFSET})
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 11)
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_REVISION LIMIT 1 OFFSET ${VERSION_OFFSET})
file(STRINGS "${PIP_SRC_MAIN}/piversion.h" VERSION_SUFFIX REGEX "\".*\"")
string(REGEX MATCH "\".*\"" VERSION_SUFFIX ${VERSION_SUFFIX})
string(LENGTH ${VERSION_SUFFIX} SL)
math(EXPR SL '${SL}-2')
@@ -28,51 +70,28 @@ string(SUBSTRING ${VERSION_REVISION} 0 ${SL} VERSION_REVISION)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}")
set(SOVERSION ${VERSION})
message(STATUS "Building PIP version ${VERSION}${VERSION_SUFFIX}")
file(WRITE "src/pip_version_str.h" "// This file was generated by PIP CMake, don`t edit it!\n#define __PIP_VERSION_STR__ \"${VERSION}${VERSION_SUFFIX}\"\n")
file(WRITE "${PIP_SRC_MAIN}/pip_version_str.h" "// This file was generated by PIP CMake, don`t edit it!\n#define __PIP_VERSION_STR__ \"${VERSION}${VERSION_SUFFIX}\"\n")
#options
option(ICU "Unicode support" 1)
option(USB "USB support" 0)
option(STL "Building with STL containers" 0)
option(STD_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)
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)
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(STD_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
# Main lib
set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io" "console" "math" "code" "geo")
include_directories("src")
include_directories("${PIP_SRC_MAIN}")
foreach(F ${PIP_FOLDERS})
include_directories("src/${F}")
file(GLOB HS "src/${F}/*.h")
file(GLOB PHS "src/${F}/*_p.h")
file(GLOB CS "src/${F}/*.cpp")
list(APPEND HDRS ${HS})
list(APPEND PHDRS ${PHS})
list(APPEND CPPS ${CS})
include_directories("${PIP_SRC_MAIN}/${F}")
gather_src("${PIP_SRC_MAIN}/${F}" CPP_LIB_MAIN HDRS PHDRS)
endforeach(F)
list(REMOVE_ITEM HDRS ${PHDRS})
# Crypt lib
gather_src("${PIP_SRC_CRYPT}" CPP_LIB_CRYPT HDRS PHDRS)
# USB lib
gather_src("${PIP_SRC_USB}" CPP_LIB_USB HDRS PHDRS)
# FFTW lib
gather_src("${PIP_SRC_FFTW}" CPP_LIB_FFTW HDRS PHDRS)
# Check Bessel functions
set(CMAKE_REQUIRED_INCLUDES math.h)
@@ -102,34 +121,36 @@ if(PIP_MATH_YN)
add_definitions(-DPIP_MATH_YN)
endif()
set(LIBS)
if(WIN32)
list(APPEND CMAKE_LIBRARY_PATH ${MINGW_LIB})
endif()
# Check if RT timers exists
set(CMAKE_REQUIRED_INCLUDES time.h)
set(CMAKE_REQUIRED_LIBRARIES )
if(NOT DEFINED ENV{QNX_HOST} AND NOT APPLE AND NOT WIN32)
list(APPEND LIBS rt)
list(APPEND LIBS_MAIN rt)
set(CMAKE_REQUIRED_LIBRARIES rt)
endif()
CHECK_FUNCTION_EXISTS(timer_create PIP_TIMER_RT_0)
CHECK_FUNCTION_EXISTS(timer_settime PIP_TIMER_RT_1)
CHECK_FUNCTION_EXISTS(timer_delete PIP_TIMER_RT_2)
if(PIP_TIMER_RT_0 AND PIP_TIMER_RT_1 AND PIP_TIMER_RT_2)
add_definitions(-DPIP_TIMER_RT)
message(STATUS "Available timers: Thread, ThreadRT, Pool")
# Check if build debug version
if(DEBUG)
add_definitions(-DPIP_DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
message(STATUS "Building debug version")
else()
message(STATUS "Available timers: Thread, Pool")
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Building relaese version")
endif()
# Check if USB is on (to enable use "-DUSB=" argument of cmake)
if(USB)
message(STATUS "Building with USB support")
add_definitions(-DPIP_USB)
list(APPEND LIBS usb)
# Check if std::iostream operators support
if(STD_IOSTREAM)
add_definitions(-DPIP_STD_IOSTREAM)
message(STATUS "Building with std iostream operators support")
else()
message(STATUS "Building without USB support")
message(STATUS "Building without std iostream operators support")
endif()
@@ -146,65 +167,12 @@ endif()
if(ICU)
message(STATUS "Building with ICU")
add_definitions(-DPIP_ICU)
list(APPEND LIBS icuuc)
list(APPEND LIBS_MAIN icuuc)
else()
message(STATUS "Building without ICU, attention!")
endif()
# Check if PIP support cryptographic encryption/decryption by using sodium library
if(CRYPT)
message(STATUS "Building with crypt support")
add_definitions(-DPIP_CRYPT)
list(APPEND LIBS sodium)
else()
message(STATUS "Building without crypt support")
endif()
# Check if PIP support fftw3 for PIFFT using in math module
if(FFTW)
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)
foreach(FFTW_LIB_ ${FFTW_LIB_LIST_})
list(APPEND FFTW_LIB_LIST "${FFTW_LIB_}-3")
endforeach()
else()
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()
# Check if PIP should be built with containers introspection
if(INTROSPECTION_CONTAINERS)
message(STATUS "Building with containers introspection")
@@ -223,34 +191,40 @@ else()
endif()
# Add library
# Check if RT timers exists
if(PIP_TIMER_RT_0 AND PIP_TIMER_RT_1 AND PIP_TIMER_RT_2)
add_definitions(-DPIP_TIMER_RT)
message(STATUS "Building with timers: Thread, ThreadRT, Pool")
else()
message(STATUS "Building with timers: Thread, Pool")
endif()
# Add main library
if(APPLE)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
endif()
if(WIN32)
list(APPEND LIBS ws2_32 iphlpapi psapi)
list(APPEND LIBS_MAIN ws2_32 iphlpapi psapi)
else()
list(APPEND LIBS dl)
list(APPEND LIBS_MAIN dl)
if(DEFINED ENV{QNX_HOST})
list(APPEND LIBS socket)
list(APPEND LIBS_MAIN socket)
else()
list(APPEND LIBS pthread util)
list(APPEND LIBS_MAIN pthread util)
endif()
endif()
foreach(LIB_ ${LIBS})
find_library("${LIB_}_FOUND" ${LIB_})
message(STATUS "Check the ${LIB_} is installed: " ${${LIB_}_FOUND})
foreach(LIB_ ${LIBS_MAIN})
find_library(${LIB_}_FOUND ${LIB_})
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()
list(APPEND LIBS_STATUS ${LIBS_MAIN})
if(WIN32)
list(APPEND CPPS "pip_resource_win.rc")
list(APPEND CPP_LIB_MAIN "pip_resource_win.rc")
add_definitions(-DPSAPI_VERSION=1)
add_library(pip SHARED ${CPPS} ${HDRS} ${PHDRS})
add_library(pip SHARED ${CPP_LIB_MAIN} ${HDRS} ${PHDRS})
if(${CMAKE_C_COMPILER} STREQUAL "cl")
include(GenerateExportHeader)
generate_export_header(pip)
@@ -264,19 +238,97 @@ else()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
if(DEFINED ENV{QNX_HOST})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32")
add_library(pip STATIC ${CPPS})
add_library(pip STATIC ${CPP_LIB_MAIN})
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
add_library(pip SHARED ${CPPS})
add_library(pip SHARED ${CPP_LIB_MAIN})
endif()
endif()
target_link_libraries(pip ${LIBS})
target_link_libraries(pip ${LIBS_MAIN})
# Check if USB is supported
find_library(usb_FOUND usb SHARED)
if(usb_FOUND)
message(STATUS "Building with USB support")
add_definitions(-DPIP_USB)
add_library(pip_usb SHARED ${CPP_LIB_USB})
target_link_libraries(pip_usb pip usb)
list(APPEND LIBS_STATUS usb)
list(APPEND PIP_LIBS_TARGETS pip_usb)
else()
message(STATUS "Building without USB support")
endif()
# Check if PIP support cryptographic encryption/decryption using sodium library
find_library(sodium_FOUND sodium)
if(sodium_FOUND)
message(STATUS "Building with crypt support")
add_definitions(-DPIP_CRYPT)
add_library(pip_crypt SHARED ${CPP_LIB_CRYPT})
target_link_libraries(pip_crypt pip sodium)
list(APPEND LIBS_STATUS sodium)
list(APPEND PIP_LIBS_TARGETS pip_crypt)
else()
message(STATUS "Building without crypt support")
endif()
# Check if PIP support fftw3 for PIFFT using in math module
set(FFTW_LIB_NAME fftw3)
set(FFTW_LIB_SUFFIXES "" "f" "l" "q")
set(FFTW_LIB_SUFFIXES2 "" "-3")
set(FFTW_LIBS)
set(PIP_FFTW_FOUND)
set(CMAKE_REQUIRED_INCLUDES fftw3.h)
foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES)
set(FFTW_BREAK false)
foreach(FFTW_S2_ IN LISTS FFTW_LIB_SUFFIXES2)
if(NOT FFTW_BREAK)
set(FFTW_CLN "${FFTW_LIB_NAME}${FFTW_S_}${FFTW_S2_}")
set(FFTW_CLNT "${FFTW_LIB_NAME}${FFTW_S_}_threads${FFTW_S2_}")
find_library(${FFTW_CLN}_FOUND ${FFTW_CLN})
find_library(${FFTW_CLNT}_FOUND ${FFTW_CLNT})
if(${FFTW_CLN}_FOUND)
list(APPEND FFTW_LIBS "${FFTW_CLN}")
#message(STATUS "PIFFTW found ${FFTW_CLN} = ${${FFTW_CLN}_FOUND}")
set(${FFTW_CLN}_CTS "${FFTW_CLN}")
if(${FFTW_CLNT}_FOUND)
list(APPEND FFTW_LIBS "${FFTW_CLNT}")
list(APPEND ${FFTW_CLN}_CTS "${FFTW_CLNT}")
endif()
set(CMAKE_REQUIRED_LIBRARIES ${${FFTW_CLN}_CTS})
CHECK_FUNCTION_EXISTS(fftw${FFTW_S_}_make_planner_thread_safe ${FFTW_CLN}_TSFE)
add_definitions(-DPIP_FFTW${FFTW_S_})
set(PIP_FFTW_FOUND true)
if(${FFTW_CLN}_TSFE)
add_definitions(-DPIP_FFTW${FFTW_S_}_THREADSAFE)
else()
message(STATUS "Warning: PIFFTW${FFTW_S_}::preparePlan was not threadsafe")
endif()
#message(STATUS "${FFTW_CLN} -> ${${FFTW_CLN}_TSFE}")
endif()
endif()
endforeach()
endforeach()
if(FFTW_LIBS)
message(STATUS "Building with fftw3 support: ${FFTW_LIBS}")
add_library(pip_fftw SHARED ${CPP_LIB_FFTW})
target_link_libraries(pip_fftw pip ${FFTW_LIBS})
list(APPEND LIBS_STATUS ${FFTW_LIBS})
list(APPEND PIP_LIBS_TARGETS pip_fftw)
else()
message(STATUS "Building without fftw3 support")
endif()
# Test program
#find_package(Qt4 REQUIRED)
#include_directories(${QT_INCLUDES})
add_executable(pip_test "main.cpp" "ccm_kbd.cpp")
target_link_libraries(pip_test pip)# ${QT_QTCORE_LIBRARY})
target_link_libraries(pip_test pip pip_fftw)# ${QT_QTCORE_LIBRARY})
# Install
# Check if system or local install will be used (to system install use "-DLIB=" argument of cmake)
@@ -286,8 +338,8 @@ if(LIB)
find_package(MinGW REQUIRED)
set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip)
install(TARGETS pip DESTINATION ${MINGW_LIB})
install(TARGETS pip DESTINATION ${MINGW_BIN})
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${MINGW_LIB})
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${MINGW_BIN})
endif()
else()
if(APPLE)
@@ -296,7 +348,7 @@ if(LIB)
set(CMAKE_INSTALL_PREFIX /usr)
endif()
install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip)
install(TARGETS pip DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif()
message(STATUS "Install to system \"${CMAKE_INSTALL_PREFIX}\"")
# Precompiled header
@@ -305,17 +357,32 @@ if(LIB)
file(GLOB CMAKES "*.cmake")
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
else()
install(TARGETS pip DESTINATION bin)
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin)
message(STATUS "Install to local \"bin\"")
endif()
# Auxiliary
add_subdirectory("src/auxiliary/piterminal")
add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal")
# Utils
add_subdirectory("utils/system_test")
add_subdirectory("utils/remote_console")
add_subdirectory("utils/code_model_generator")
add_subdirectory("utils/system_daemon")
add_subdirectory("utils/udp_file_transfer")
add_subdirectory("utils/crypt_tool")
if(sodium_FOUND)
add_subdirectory("utils/system_daemon")
add_subdirectory("utils/crypt_tool")
endif()
# Libraries messages
message(STATUS "Building modules: ${PIP_LIBS_TARGETS}")
set(PIP_LIBS_TARGETS ${PIP_LIBS_TARGETS} PARENT_SCOPE)
foreach(LIB_ ${LIBS_STATUS})
message(STATUS "Library ${LIB_} -> " ${${LIB_}_FOUND})
if(NOT ${LIB_}_FOUND)
message(WARNING "Library ${LIB_} not found, please install it")
endif()
endforeach()

View File

@@ -1,18 +1,29 @@
#set(_PIP_MODULES pip pip_usb pip_crypt pip_fftw)
if(WIN32)
find_package(MinGW REQUIRED)
find_library(PIP_LIBRARY pip ${MINGW_LIB})
find_library(PIP_USB_LIBRARY pip_usb ${MINGW_LIB})
find_library(PIP_CRYPT_LIBRARY pip_crypt ${MINGW_LIB})
find_library(PIP_FFTW_LIBRARY pip_fftw ${MINGW_LIB})
set(PIP_INCLUDES ${MINGW_INCLUDE}/pip)
set(PIP_CMG ${MINGW_BIN}/pip_cmg.exe)
else()
find_library(PIP_LIBRARY pip /usr/lib/)
set(_DIR_ "/usr")
if(APPLE)
set(_DIR_ "/usr/local")
endif()
find_library(PIP_LIBRARY pip ${_DIR_}/lib/)
find_library(PIP_USB_LIBRARY pip_usb ${_DIR_}/lib/)
find_library(PIP_CRYPT_LIBRARY pip_crypt ${_DIR_}/lib/)
find_library(PIP_FFTW_LIBRARY pip_fftw ${_DIR_}/lib/)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
find_library(PTHREAD_LIBRARY pthread)
find_library(DL_LIBRARY dl)
find_library(UTIL_LIBRARY util)
list(APPEND PIP_LIBRARY ${PTHREAD_LIBRARY} ${DL_LIBRARY} ${UTIL_LIBRARY})
endif()
set(PIP_INCLUDES /usr/include/pip)
set(PIP_CMG /usr/bin/pip_cmg)
set(PIP_INCLUDES ${_DIR_}/include/pip)
set(PIP_CMG ${_DIR_}/bin/pip_cmg)
endif()
if(NOT PIP_VERSION)

View File

@@ -3,8 +3,8 @@
#else
# include <winver.h>
#endif
#include <src/piversion.h>
#include <src/pip_version_str.h>
#include <src_main/piversion.h>
#include <src_main/pip_version_str.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION PIP_VERSION_MAJOR,PIP_VERSION_MINOR,PIP_VERSION_REVISION,0

34
src_fftw/pifft.cpp Normal file
View File

@@ -0,0 +1,34 @@
/*
PIP - Platform Independent Primitives
Class for FFT, IFFT and Hilbert transformations
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pifft.h"
#include "pifft_p.h"
#define _PIFFTW_CPP(type) \
_PIFFTW_P_##type##_::_PIFFTW_P_##type##_() {impl = new PIFFTW_Private<type>();;} \
_PIFFTW_P_##type##_::~_PIFFTW_P_##type##_() {delete (PIFFTW_Private<type>*)impl;} \
const PIVector<complex<type> > & _PIFFTW_P_##type##_::calcFFT(const PIVector<complex<type> > & in) {return ((PIFFTW_Private<type>*)impl)->calcFFT(in);} \
const PIVector<complex<type> > & _PIFFTW_P_##type##_::calcFFTR(const PIVector<type> & in) {return ((PIFFTW_Private<type>*)impl)->calcFFT(in);} \
const PIVector<complex<type> > & _PIFFTW_P_##type##_::calcFFTI(const PIVector<complex<type> > & in) {return ((PIFFTW_Private<type>*)impl)->calcFFTinverse(in);} \
void _PIFFTW_P_##type##_::preparePlan(int size, int op) {return ((PIFFTW_Private<type>*)impl)->preparePlan(size, op);}
_PIFFTW_CPP(float)
_PIFFTW_CPP(double)
_PIFFTW_CPP(ldouble)

View File

@@ -26,7 +26,7 @@
#include "pivector.h"
#include "pimutex.h"
#include "picout.h"
#ifdef PIP_FFTW
#if defined(PIP_FFTW) || defined(PIP_FFTWf) || defined(PIP_FFTWl) || defined(PIP_FFTWq)
# include "fftw3.h"
#else
# define FFTW_FORWARD 0
@@ -42,9 +42,9 @@ class PIFFTW_Private
public:
explicit PIFFTW_Private() {
plan = 0;
#ifndef PIP_FFTW
piCout << "[PIFFTW]" << "Warning: PIFFTW is disabled, to enable install libfftw3-dev library and build pip with -DFFTW=1";
#endif
//#ifndef PIP_FFTW
// piCout << "[PIFFTW]" << "Warning: PIFFTW is disabled, to enable install libfftw3-dev library and build pip with -DFFTW=1";
//#endif
p_makeThreadSafe();
}
~PIFFTW_Private() {p_destroyPlan(plan);}
@@ -135,8 +135,7 @@ public:
};
#ifdef PIP_FFTW
#ifdef PIP_FFTW_FLOAT
#ifdef PIP_FFTWf
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) {
@@ -145,11 +144,12 @@ template<> inline void PIFFTW_Private<float>::p_executePlan(void * plan) {fftwf_
template<> inline void PIFFTW_Private<float>::p_executePlan_c2c(void * plan, const void * in, void * out) {fftwf_execute_dft((fftwf_plan)plan, (fftwf_complex *)in, (fftwf_complex *)out);}
template<> inline void PIFFTW_Private<float>::p_executePlan_r2c(void * plan, const void * in, void * out) {fftwf_execute_dft_r2c((fftwf_plan)plan, (float *)in, (fftwf_complex *)out);}
template<> inline void PIFFTW_Private<float>::p_destroyPlan(void *& plan) {if (plan) fftwf_destroy_plan((fftwf_plan)plan); plan = 0;}
#ifdef PIP_FFTW_THREADSAFE
# ifdef PIP_FFTWf_THREADSAFE
template<> inline void PIFFTW_Private<float>::p_makeThreadSafe() {fftwf_make_planner_thread_safe();}
#endif
#endif // PIP_FFTW_FLOAT
# endif
#endif // PIP_FFTWf
#ifdef PIP_FFTW
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);}
template<> inline void PIFFTW_Private<double>::p_createPlan_r2c_1d(void *& plan, int size, const void * in, void * out, int flags) {
@@ -158,11 +158,12 @@ template<> inline void PIFFTW_Private<double>::p_executePlan(void * plan) {fftw_
template<> inline void PIFFTW_Private<double>::p_executePlan_c2c(void * plan, const void * in, void * out) {fftw_execute_dft((fftw_plan)plan, (fftw_complex *)in, (fftw_complex *)out);}
template<> inline void PIFFTW_Private<double>::p_executePlan_r2c(void * plan, const void * in, void * out) {fftw_execute_dft_r2c((fftw_plan)plan, (double *)in, (fftw_complex *)out);}
template<> inline void PIFFTW_Private<double>::p_destroyPlan(void *& plan) {if (plan) fftw_destroy_plan((fftw_plan)plan); plan = 0;}
#ifdef PIP_FFTW_THREADSAFE
# ifdef PIP_FFTW_THREADSAFE
template<> inline void PIFFTW_Private<double>::p_makeThreadSafe() {fftw_make_planner_thread_safe();}
#endif
# endif
#endif // PIP_FFTW
#ifdef PIP_FFTW_LDOUBLE
#ifdef PIP_FFTWl
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) {
@@ -171,13 +172,10 @@ template<> inline void PIFFTW_Private<ldouble>::p_executePlan(void * plan) {fftw
template<> inline void PIFFTW_Private<ldouble>::p_executePlan_c2c(void * plan, const void * in, void * out) {fftwl_execute_dft((fftwl_plan)plan, (fftwl_complex *)in, (fftwl_complex *)out);}
template<> inline void PIFFTW_Private<ldouble>::p_executePlan_r2c(void * plan, const void * in, void * out) {fftwl_execute_dft_r2c((fftwl_plan)plan, (ldouble *)in, (fftwl_complex *)out);}
template<> inline void PIFFTW_Private<ldouble>::p_destroyPlan(void *& plan) {if (plan) fftwl_destroy_plan((fftwl_plan)plan); plan = 0;}
#ifdef PIP_FFTW_THREADSAFE
# ifdef PIP_FFTWl_THREADSAFE
template<> inline void PIFFTW_Private<ldouble>::p_makeThreadSafe() {fftwl_make_planner_thread_safe();}
#endif
#endif // PIP_FFTW_LDOUBLE
#endif // PIP_FFTW
# endif
#endif // PIP_FFTWl
#endif // PIFFT_H

View File

@@ -33,7 +33,11 @@
#ifndef assert
# define assert(x)
#endif
#include <malloc.h>
#ifdef MAC_OS
# include <stdlib.h>
#else
# include <malloc.h>
#endif
#include <string.h>
#include <new>
#ifndef PIP_MEMALIGN_BYTES

Some files were not shown because too many files have changed in this diff Show More