summaryrefslogtreecommitdiffstats
path: root/common/cmake/FindFFTW3.cmake
blob: 252fcd9962cf222f50e54d92a0d57eebe7b9340f (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# 
# Try to find FFTW3  library  
# (see www.fftw.org)
# Once run this will define: 
# 
# FFTW3_FOUND
# FFTW3_INCLUDE_DIR 
# FFTW3_LIBRARIES
# FFTW3_LINK_DIRECTORIES
#
# You may set one of these options before including this file:
#  FFTW3_USE_SSE2
#
#  TODO: _F_ versions.
#
# Jan Woetzel 05/2004
# www.mip.informatik.uni-kiel.de
# --------------------------------

 FIND_PATH(FFTW3_INCLUDE_DIR fftw3.h
   ${FFTW3_DIR}/include
   ${FFTW3_HOME}/include
   ${FFTW3_DIR}
   ${FFTW3_HOME}
   $ENV{FFTW3_DIR}/include
   $ENV{FFTW3_HOME}/include
   $ENV{FFTW3_DIR}
   $ENV{FFTW3_HOME}
   /usr/include
   /usr/local/include
   $ENV{SOURCE_DIR}/fftw3
   $ENV{SOURCE_DIR}/fftw3/include
   $ENV{SOURCE_DIR}/fftw
   $ENV{SOURCE_DIR}/fftw/include
 )
#MESSAGE("DBG FFTW3_INCLUDE_DIR=${FFTW3_INCLUDE_DIR}")  


SET(FFTW3_POSSIBLE_LIBRARY_PATH
  ${FFTW3_DIR}/lib
  ${FFTW3_HOME}/lib
  ${FFTW3_DIR}
  ${FFTW3_HOME}  
  $ENV{FFTW3_DIR}/lib
  $ENV{FFTW3_HOME}/lib
  $ENV{FFTW3_DIR}
  $ENV{FFTW3_HOME}  
  /usr/lib
  /usr/local/lib
  $ENV{SOURCE_DIR}/fftw3
  $ENV{SOURCE_DIR}/fftw3/lib
  $ENV{SOURCE_DIR}/fftw
  $ENV{SOURCE_DIR}/fftw/lib
)

  
# the lib prefix is containe din filename onf W32, unfortuantely. JW
# teh "general" lib: 
FIND_LIBRARY(FFTW3_FFTW_LIBRARY
  NAMES fftw3 libfftw libfftw3 libfftw3-3
  PATHS 
  ${FFTW3_POSSIBLE_LIBRARY_PATH}
  )
#MESSAGE("DBG FFTW3_FFTW_LIBRARY=${FFTW3_FFTW_LIBRARY}")

FIND_LIBRARY(FFTW3_FFTWF_LIBRARY
  NAMES fftwf3 fftw3f fftwf libfftwf libfftwf3 libfftw3f libfftw3f-3
  PATHS 
  ${FFTW3_POSSIBLE_LIBRARY_PATH}
  )
#MESSAGE("DBG FFTW3_FFTWF_LIBRARY=${FFTW3_FFTWF_LIBRARY}")

FIND_LIBRARY(FFTW3_FFTWL_LIBRARY
  NAMES fftwl3 fftw3l fftwl libfftwl libfftwl3 libfftw3l libfftw3l-3
  PATHS 
  ${FFTW3_POSSIBLE_LIBRARY_PATH}
  )
#MESSAGE("DBG FFTW3_FFTWF_LIBRARY=${FFTW3_FFTWL_LIBRARY}")


FIND_LIBRARY(FFTW3_FFTW_SSE2_LIBRARY
  NAMES fftw_sse2 fftw3_sse2 libfftw_sse2 libfftw3_sse2
  PATHS 
  ${FFTW3_POSSIBLE_LIBRARY_PATH}
  )
#MESSAGE("DBG FFTW3_FFTW_SSE2_LIBRARY=${FFTW3_FFTW_SSE2_LIBRARY}")

FIND_LIBRARY(FFTW3_FFTWF_SSE_LIBRARY
  NAMES fftwf_sse fftwf3_sse fftw3f_sse libfftwf_sse libfftwf3_sse libfftw3f_sse
  PATHS 
  ${FFTW3_POSSIBLE_LIBRARY_PATH}
  )
#MESSAGE("DBG FFTW3_FFTWF_SSE_LIBRARY=${FFTW3_FFTWF_SSE_LIBRARY}")


# --------------------------------
# select one of the above
# default: 
IF (FFTW3_FFTW_LIBRARY)
  SET(FFTW3_LIBRARIES ${FFTW3_FFTW_LIBRARY})
ENDIF (FFTW3_FFTW_LIBRARY)
# specialized: 
IF (FFTW3_USE_SSE2 AND FFTW3_FFTW_SSE2_LIBRARY)
  SET(FFTW3_LIBRARIES ${FFTW3_FFTW_SSE2_LIBRARY})
ENDIF (FFTW3_USE_SSE2 AND FFTW3_FFTW_SSE2_LIBRARY)

# --------------------------------

IF(FFTW3_LIBRARIES)
  IF (FFTW3_INCLUDE_DIR)

    # OK, found all we need
    SET(FFTW3_FOUND TRUE)
    GET_FILENAME_COMPONENT(FFTW3_LINK_DIRECTORIES ${FFTW3_LIBRARIES} PATH)
    
  ELSE (FFTW3_INCLUDE_DIR)
    MESSAGE("FFTW3 include dir not found. Set FFTW3_DIR to find it.")
  ENDIF(FFTW3_INCLUDE_DIR)
ELSE(FFTW3_LIBRARIES)
  MESSAGE("FFTW3 lib not found. Set FFTW3_DIR to find it.")
ENDIF(FFTW3_LIBRARIES)


MARK_AS_ADVANCED(
  FFTW3_INCLUDE_DIR
  FFTW3_LIBRARIES
  FFTW3_FFTW_LIBRARY
  FFTW3_FFTW_SSE2_LIBRARY
  FFTW3_FFTWF_LIBRARY
  FFTW3_FFTWF_SSE_LIBRARY
  FFTW3_FFTWL_LIBRARY
  FFTW3_LINK_DIRECTORIES
)