From 0246a8fd889c9f3d7d05dd7feb375a81904ba6de Mon Sep 17 00:00:00 2001 From: Xinyue Lu Date: Sat, 20 Jun 2020 23:52:26 -0400 Subject: [PATCH] Fix Linux --- CMakeLists.txt | 4 ++++ src/fftwlite.h | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a720465..5c56fdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,10 @@ if(ENABLE_PAR AND HAS_EXECUTION) endif() endif() +if (NOT WIN32) + target_link_libraries(neo-fft3d dl) +endif() + add_custom_command( TARGET neo-fft3d POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "../Release_${VERSION}/${_DIR}/$" diff --git a/src/fftwlite.h b/src/fftwlite.h index 6d7e4e8..1adca98 100644 --- a/src/fftwlite.h +++ b/src/fftwlite.h @@ -54,16 +54,16 @@ struct FFTFunctionPointers { if (library == NULL) library = LoadLibraryW(L"fftw3"); if (library == NULL) - #ifdef _WIN32 - throw("libfftw3f-3.dll or fftw3.dll not found. Please put in PATH or use LoadDll() plugin"); - #else - throw("libfftw3f_threads.so.3 not found. Please install libfftw3-single3 (deb) or fftw-devel (rpm) package"); - #endif + throw("libfftw3f-3.dll or fftw3.dll not found. Please put in PATH or use LoadDll() plugin"); } void fftw3_close() { FreeLibrary(library); } func_t fftw3_address(LPCSTR func) { return GetProcAddress(library, func); } #else - void fftw3_open() { library = dlopen("libfftw3f_threads.so.3", RTLD_NOW); } + void fftw3_open() { + library = dlopen("libfftw3f_threads.so.3", RTLD_NOW); + if (library == NULL) + throw("libfftw3f_threads.so.3 not found. Please install libfftw3-single3 (deb) or fftw-devel (rpm) package"); + } void fftw3_close() { dlclose(library); } func_t fftw3_address(const char * func) { return dlsym(library, func); } #endif