You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindThirdPartyFFTW3.cmake 2.5KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # ---------------------------------
  2. # Finds FFTW3
  3. #
  4. # Sets define if the lib is found, adds include paths, libs
  5. #
  6. # ---------
  7. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyFFTW3)
  8. # On windows, we take the itpp one.
  9. IF(WIN32)
  10. FIND_PATH(PATH_FFTW3 include/fftw3.h PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES itpp)
  11. IF(PATH_FFTW3)
  12. SET(FFTW3_FOUND TRUE)
  13. # Of course the name of the library is this or that, depending on the circumstances ...
  14. IF("${PLATFORM_TARGET}" STREQUAL "x64")
  15. FIND_LIBRARY(FFTW3_TMP NAMES libfftw3-3_win64 PATHS ${PATH_FFTW3}/lib NO_DEFAULT_PATH)
  16. IF(FFTW3_TMP)
  17. SET(FFTW3_LIBRARIES libfftw3-3_win64)
  18. ELSE(FFTW3_TMP)
  19. SET(FFTW3_LIBRARIES libfftw3-3)
  20. ENDIF(FFTW3_TMP)
  21. ELSE()
  22. FIND_LIBRARY(FFTW3_TMP NAMES libfftw3-3_win32 PATHS ${PATH_FFTW3}/lib NO_DEFAULT_PATH)
  23. IF(FFTW3_TMP)
  24. SET(FFTW3_LIBRARIES libfftw3-3_win32)
  25. ELSE(FFTW3_TMP)
  26. SET(FFTW3_LIBRARIES libfftw3-3)
  27. ENDIF(FFTW3_TMP)
  28. ENDIF()
  29. SET(FFTW3_INCLUDE_DIRS ${PATH_FFTW3}/include )
  30. SET(FFTW3_LIBRARY_DIRS ${PATH_FFTW3}/lib )
  31. ENDIF(PATH_FFTW3)
  32. ENDIF(WIN32)
  33. IF(UNIX)
  34. INCLUDE("FindThirdPartyPkgConfig")
  35. pkg_check_modules(FFTW3 fftw3)
  36. ENDIF(UNIX)
  37. IF(FFTW3_FOUND)
  38. SET(FFTW3_LOCATED_LIBS "")
  39. OV_PRINT(OV_PRINTED " Found fftw3 includes...")
  40. FOREACH(FFTW3_LIB ${FFTW3_LIBRARIES})
  41. SET(FFTW3_LIB1 "FFTW3_LIB1-NOTFOUND")
  42. # The list is 'fftw3 m' on Fedora 19. CMake gets confused unless the two following lines are used ...
  43. # 1) catch fftw3 if its under dependencies/lib/ (fedora19)
  44. FIND_LIBRARY(FFTW3_LIB1 NAMES ${FFTW3_LIB} PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES lib NO_DEFAULT_PATH)
  45. # 2) catch fftw3 from found paths, and libm from usual system paths, i.e. default path is allowed. (covers other systems + libm on fedora).
  46. FIND_LIBRARY(FFTW3_LIB1 NAMES ${FFTW3_LIB} PATHS ${FFTW3_LIBRARY_DIRS})
  47. IF(FFTW3_LIB1)
  48. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${FFTW3_LIB1}")
  49. LIST(APPEND FFTW3_LOCATED_LIBS ${FFTW3_LIB1})
  50. ELSE(FFTW3_LIB1)
  51. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${FFTW3_LIB}")
  52. SET(FFTW3_FOUND "-NOTFOUND")
  53. BREAK()
  54. ENDIF(FFTW3_LIB1)
  55. ENDFOREACH(FFTW3_LIB)
  56. ENDIF(FFTW3_FOUND)
  57. IF(FFTW3_FOUND)
  58. INCLUDE_DIRECTORIES(${FFTW3_INCLUDE_DIRS})
  59. ADD_DEFINITIONS(${FFTW3_CFLAGS})
  60. FOREACH(FFTW3_LIB ${FFTW3_LOCATED_LIBS})
  61. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${FFTW3_LIB})
  62. ENDFOREACH(FFTW3_LIB)
  63. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyFFTW3)
  64. ELSE(FFTW3_FOUND)
  65. OV_PRINT(OV_PRINTED " FAILED to find fftw3...")
  66. ENDIF(FFTW3_FOUND)
  67. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyFFTW3 "Yes")