From 925e83577b419ac619d856f3db5b31d517ae9eba Mon Sep 17 00:00:00 2001 From: Paul Sutton Date: Thu, 28 Apr 2016 15:42:12 +0100 Subject: [PATCH] Adding support for MKL fft --- cmake/modules/FindMKL.cmake | 27 +++++++++++++++++++++++++++ srslte/CMakeLists.txt | 17 ++++++++++++----- srslte/lib/CMakeLists.txt | 8 +++++++- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 cmake/modules/FindMKL.cmake diff --git a/cmake/modules/FindMKL.cmake b/cmake/modules/FindMKL.cmake new file mode 100644 index 000000000..2320cf065 --- /dev/null +++ b/cmake/modules/FindMKL.cmake @@ -0,0 +1,27 @@ +# - Try to find mkl - the Intel Math Kernel Library +# Once done this will define +# MKL_FOUND - System has mkl +# MKL_INCLUDE_DIRS - The mkl include directories +# MKL_LIBRARIES - The libraries needed to use mkl +# MKL_DEFINITIONS - Compiler switches required for using mkl + +find_path(MKL_INCLUDE_DIR + NAMES mkl.h + HINTS $ENV{MKL_DIR}/include + PATHS) + +find_library(MKL_LIBRARY + NAMES mkl_rt + HINTS $ENV{MKL_DIR}/lib/intel64 + PATHS) + +set(MKL_LIBRARIES ${MKL_LIBRARY} ) +set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(mkl DEFAULT_MSG + MKL_LIBRARY MKL_INCLUDE_DIR) + +mark_as_advanced(MKL_INCLUDE_DIR MKL_LIBRARY ) diff --git a/srslte/CMakeLists.txt b/srslte/CMakeLists.txt index 87779de46..0ecf9ddf6 100644 --- a/srslte/CMakeLists.txt +++ b/srslte/CMakeLists.txt @@ -42,11 +42,18 @@ add_custom_target (add_srslte_headers SOURCES ${HEADERS_ALL}) ######################################################################## # Find Dependencies ######################################################################## -find_package(FFTW3F REQUIRED) -if(FFTW3F_FOUND) - include_directories(${FFTW3F_INCLUDE_DIRS}) - link_directories(${FFTW3F_LIBRARY_DIRS}) -endif(FFTW3F_FOUND) + +find_package(MKL) +if(MKL_FOUND) + include_directories(${MKL_INCLUDE_DIRS}) + link_directories(${MKL_LIBRARY_DIRS}) +else(MKL_FOUND) + find_package(FFTW3F REQUIRED) + if(FFTW3F_FOUND) + include_directories(${FFTW3F_INCLUDE_DIRS}) + link_directories(${FFTW3F_LIBRARY_DIRS}) + endif(FFTW3F_FOUND) +endif(MKL_FOUND) find_package(UHD) if(UHD_FOUND) diff --git a/srslte/lib/CMakeLists.txt b/srslte/lib/CMakeLists.txt index d5c1e0feb..daa60ac5a 100644 --- a/srslte/lib/CMakeLists.txt +++ b/srslte/lib/CMakeLists.txt @@ -76,10 +76,16 @@ if(NOT DisableMEX) ) endif(NOT DisableMEX) -target_link_libraries(srslte pthread m ${FFTW3F_LIBRARIES}) +target_link_libraries(srslte pthread m) set_target_properties(srslte PROPERTIES VERSION ${SRSLTE_VERSION_MAJOR}.${SRSLTE_VERSION_MINOR}) +if(MKL_FOUND) + target_link_libraries(srslte ${MKL_LIBRARIES}) +else(MKL_FOUND) + target_link_libraries(srslte ${FFTW3F_LIBRARIES}) +endif(MKL_FOUND) + if(RF_FOUND) if(UHD_FOUND) target_link_libraries(srslte ${UHD_LIBRARIES})