-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
141 lines (114 loc) · 4.03 KB
/
CMakeLists.txt
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
134
135
136
137
138
139
140
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.4 )
# allow more human readable "if then else" constructs
#SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
# Add the local Find*.cmake scripts
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
PROJECT( CellSearch )
ENABLE_TESTING()
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -Wall")
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Werror -ggdb -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
# Set default build type
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE "release" )
ENDIF()
# Find needed packages.
IF (USE_OPENCL MATCHES NOTFOUND)
set(USE_OPENCL 1)
ENDIF (USE_OPENCL MATCHES NOTFOUND)
IF (USE_RTLSDR MATCHES NOTFOUND)
set(USE_RTLSDR 0)
ENDIF (USE_RTLSDR MATCHES NOTFOUND)
IF (USE_HACKRF MATCHES NOTFOUND)
set(USE_HACKRF 0)
ENDIF (USE_HACKRF MATCHES NOTFOUND)
IF (USE_BLADERF MATCHES NOTFOUND)
set(USE_BLADERF 0)
ENDIF (USE_BLADERF MATCHES NOTFOUND)
IF (USE_OPENCL MATCHES 0)
MESSAGE(STATUS "Avoid OPENCL")
SET(OPENCL_FOUND "NO")
SET( USE_OPENCL "NO_OPENCL")
ELSE (USE_OPENCL MATCHES 0)
MESSAGE(STATUS "Try to find OPENCL LIB")
FIND_PACKAGE( OPENCL )
IF ( OPENCL_FOUND )
MESSAGE(STATUS "Found OpenCL LIB: ${OPENCL_LIBRARIES}")
INCLUDE_DIRECTORIES("${OPENCL_INCLUDE_DIR}")
SET( USE_OPENCL "USE_OPENCL")
ELSE ( OPENCL_FOUND )
MESSAGE(STATUS "OpenCL LIB not found")
SET( USE_OPENCL "NO_OPENCL")
ENDIF ( OPENCL_FOUND )
ENDIF (USE_OPENCL MATCHES 0)
FIND_PACKAGE( OpenMP )
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
FIND_PACKAGE( Boost COMPONENTS thread system REQUIRED )
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
FIND_PACKAGE( ITPP REQUIRED )
INCLUDE_DIRECTORIES("${ITPP_INCLUDE_DIR}")
FIND_PACKAGE( BLAS REQUIRED )
FIND_PACKAGE( LAPACK REQUIRED )
FIND_PACKAGE( FFTW REQUIRED )
INCLUDE_DIRECTORIES("${FFTW_INCLUDE_DIR}")
SET( HAVE_BLADERF "NO_BLADERF")
SET( HAVE_HACKRF "NO_HACKRF")
SET( HAVE_RTLSDR "NO_RTLSDR")
IF (USE_BLADERF MATCHES 1)
MESSAGE(STATUS "Try to find BLADERF LIB")
find_package(BLADERF REQUIRED)
IF ( BLADERF_FOUND )
MESSAGE(STATUS "Found BLADERF LIB: ${BLADERF_LIBRARIES}")
include_directories(${BLADERF_INCLUDE_DIR})
SET( HAVE_BLADERF "HAVE_BLADERF")
ELSE ( BLADERF_FOUND )
MESSAGE(STATUS "BLADERF LIB not found")
ENDIF ( BLADERF_FOUND )
ELSE (USE_BLADERF MATCHES 1)
IF (USE_HACKRF MATCHES 1)
MESSAGE(STATUS "Try to find HACKRF LIB")
FIND_PACKAGE( HACKRF REQUIRED)
IF ( HACKRF_FOUND )
MESSAGE(STATUS "Found HACKRF LIB: ${HACKRF_LIBRARIES}")
INCLUDE_DIRECTORIES("${HACKRF_INCLUDE_DIR}")
SET( HAVE_HACKRF "HAVE_HACKRF")
ELSE ( HACKRF_FOUND )
MESSAGE(STATUS "HACKRF LIB not found")
ENDIF ( HACKRF_FOUND )
ELSE (USE_HACKRF MATCHES 1)
MESSAGE(STATUS "Try to find RTLSDR LIB")
FIND_PACKAGE( RTLSDR REQUIRED)
IF ( RTLSDR_FOUND )
MESSAGE(STATUS "Found RTLSDR LIB: ${RTLSDR_LIBRARIES}")
INCLUDE_DIRECTORIES("${RTLSDR_INCLUDE_DIR}")
SET( HAVE_RTLSDR "HAVE_RTLSDR")
ELSE ( RTLSDR_FOUND )
MESSAGE(STATUS "RTLSDR LIB not found")
ENDIF ( RTLSDR_FOUND )
ENDIF (USE_HACKRF MATCHES 1)
ENDIF (USE_BLADERF MATCHES 1)
FIND_PACKAGE( Curses REQUIRED )
INCLUDE_DIRECTORIES("${CURSES_INCLUDE_DIR}")
# Add version information to build
SET( ${PROJECT_NAME}_MAJOR_VERSION 1 )
SET( ${PROJECT_NAME}_MINOR_VERSION 1 )
SET( ${PROJECT_NAME}_PATCH_LEVEL 0 )
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/include/common.h.in"
"${PROJECT_BINARY_DIR}/include/common.h"
)
# Where .h files are located
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include")
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}/include")
# Descend into subdirectories
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)
# Uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake)