Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

FindFFTW3.cmake 2.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  1. #
  2. # $Id$
  3. #
  4. # Locate fftw3
  5. #
  6. # This module accepts the following environment variables:
  7. #
  8. # FFTW3_DIR or FFTW3_ROOT - Specify the location of FFTW3
  9. #
  10. # This module defines the following CMake variables:
  11. #
  12. # FFTW3_FOUND - True if libfftw3 is found
  13. # FFTW3F_LIBRARY - A variable pointing to the FFTW3 single precision library
  14. # FFTW3F_THREADS_LIBRARY - Threaded single precision library
  15. # FFTW3_INCLUDE_DIR - Where to find the headers
  16. if (DEFINED FFTW3_ROOT AND NOT FFTW3_ROOT)
  17. set (FFTW3F_LIBRARY "" CACHE INTERNAL "")
  18. set (FFTW3F_THREADS_LIBRARY "" CACHE INTERNAL "")
  19. set (FFTW3_INCLUDE_DIR "" CACHE INTERNAL "")
  20. return()
  21. endif()
  22. find_path (FFTW3_INCLUDE_DIR fftw3.h
  23. HINTS
  24. ${FFTW3_DIR}
  25. ${FFTW3_ROOT}
  26. $ENV{FFTW3_DIR}
  27. $ENV{FFTW3_ROOT}
  28. PATH_SUFFIXES include
  29. PATHS
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. /opt/csw # Blastwave
  33. /opt
  34. /usr/local
  35. )
  36. # single precision
  37. find_library (FFTW3F_LIBRARY
  38. NAMES fftw3f
  39. HINTS
  40. ${FFTW3_DIR}
  41. ${FFTW3_ROOT}
  42. $ENV{FFTW3_DIR}
  43. $ENV{FFTW3_ROOT}
  44. PATH_SUFFIXES lib
  45. PATHS
  46. /sw
  47. /opt/local
  48. /opt/csw
  49. /opt
  50. /usr/local
  51. )
  52. get_filename_component (_fftw3_libpath ${FFTW3F_LIBRARY} PATH)
  53. # threaded single precision
  54. find_library (FFTW3F_THREADS_LIBRARY
  55. NAMES fftw3f_threads
  56. HINTS ${_fftw3_libpath})
  57. if (FFTW3F_LIBRARY)
  58. # test if FFTW >= 3.3
  59. include (CMakePushCheckState)
  60. cmake_push_check_state() # save state of CMAKE_REQUIRED_*
  61. set (CMAKE_REQUIRED_INCLUDES ${FFTW3_INCLUDE_DIR})
  62. set (CMAKE_REQUIRED_LIBRARIES ${FFTW3F_LIBRARY})
  63. include (CheckSymbolExists)
  64. # this might fail with static FFTW3 library:
  65. check_symbol_exists (fftwf_import_wisdom_from_filename fftw3.h FFTW3F_VERSION_RECENT)
  66. cmake_pop_check_state() # restore state of CMAKE_REQUIRED_*
  67. # old version warning
  68. if (NOT FFTW3F_VERSION_RECENT)
  69. message (WARNING "FFTW library found, but it is either too old (<3.3) or statically-linked.")
  70. unset (FFTW3F_LIBRARY CACHE)
  71. unset (FFTW3F_THREADS_LIBRARY CACHE)
  72. unset (FFTW3_INCLUDE_DIR CACHE)
  73. unset (FFTW3F_VERSION_RECENT CACHE)
  74. return()
  75. endif (NOT FFTW3F_VERSION_RECENT)
  76. endif (FFTW3F_LIBRARY)
  77. include (FindPackageHandleStandardArgs)
  78. find_package_handle_standard_args (FFTW3 DEFAULT_MSG FFTW3F_LIBRARY FFTW3_INCLUDE_DIR FFTW3F_VERSION_RECENT)
  79. set (FFTW3F_LIBRARIES ${FFTW3F_LIBRARY})
  80. if (FFTW3F_THREADS_LIBRARY)
  81. list (APPEND FFTW3F_LIBRARIES ${FFTW3F_THREADS_LIBRARY})
  82. endif (FFTW3F_THREADS_LIBRARY)
  83. set (FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
  84. # vim: textwidth=78 noexpandtab tabstop=2 softtabstop=2 shiftwidth=2
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...