From f48b1f3d66c39365ffb3752609b6b47a8192046f Mon Sep 17 00:00:00 2001 From: Paul Sutton Date: Fri, 23 Jun 2017 17:20:35 +0100 Subject: [PATCH] Adding ability to statically link FFTW --- cmake/modules/FindFFTW3F.cmake | 15 +++++++++++++-- lib/src/phy/CMakeLists.txt | 7 ++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cmake/modules/FindFFTW3F.cmake b/cmake/modules/FindFFTW3F.cmake index ebaa7c6df..ef7bc1397 100644 --- a/cmake/modules/FindFFTW3F.cmake +++ b/cmake/modules/FindFFTW3F.cmake @@ -15,6 +15,12 @@ find_path(FFTW3F_INCLUDE_DIR PATHS /usr/local/include /usr/include ) +find_library(FFTW3F_STATIC_LIBRARY + NAMES fftw3f.a libfftw3f.a libfftw3f-3.a + HINTS ${PC_FFTW3F_LIBDIR} ${PC_FFTW3F_LIBRARY_DIRS} $ENV{FFTW3_DIR}/lib + PATHS /usr/local/lib + /usr/lib) + find_library(FFTW3F_LIBRARY NAMES fftw3f libfftw3f libfftw3f-3 HINTS ${PC_FFTW3F_LIBDIR} ${PC_FFTW3F_LIBRARY_DIRS} $ENV{FFTW3_DIR}/lib @@ -22,12 +28,17 @@ find_library(FFTW3F_LIBRARY /usr/lib) set(FFTW3F_LIBRARIES ${FFTW3F_LIBRARY} ) +set(FFTW3F_STATIC_LIBRARIES ${FFTW3F_STATIC_LIBRARY} ) set(FFTW3F_INCLUDE_DIRS ${FFTW3F_INCLUDE_DIR} ) +message(STATUS "FFTW3F LIBRARIES: " ${FFTW3F_LIBRARIES}) +message(STATUS "FFTW3F STATIC LIBRARIES: " ${FFTW3F_STATIC_LIBRARIES}) +message(STATUS "FFTW3F INCLUDE DIRS: " ${FFTW3F_INCLUDE_DIRS}) + include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set FFTW3F_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args(fftw3f DEFAULT_MSG - FFTW3F_LIBRARY FFTW3F_INCLUDE_DIR) + FFTW3F_LIBRARY FFTW3F_STATIC_LIBRARY FFTW3F_INCLUDE_DIR) -mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_LIBRARY ) +mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_STATIC_LIBRARY FFTW3F_LIBRARY ) diff --git a/lib/src/phy/CMakeLists.txt b/lib/src/phy/CMakeLists.txt index 7f26f9836..bd5ae332d 100644 --- a/lib/src/phy/CMakeLists.txt +++ b/lib/src/phy/CMakeLists.txt @@ -65,7 +65,12 @@ if(MKL_FOUND) target_link_libraries(srslte_phy ${MKL_LIBRARIES}) endif(BUILD_STATIC) else(MKL_FOUND) - target_link_libraries(srslte_phy ${FFTW3F_LIBRARIES}) + if(BUILD_STATIC) + target_link_libraries(srslte_phy ${FFTW3F_STATIC_LIBRARIES}) + else(BUILD_STATIC) + target_link_libraries(srslte_phy ${FFTW3F_LIBRARIES}) + endif(BUILD_STATIC) + endif(MKL_FOUND)