-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
122 lines (91 loc) · 4.51 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
cmake_minimum_required(VERSION 3.7)
project(electrosense-sensor)
# Set version
SET (VERSION "1.3.6")
SET (DEBVERSION "1")
add_definitions( -DAPP_VERSION="${VERSION}-${DEBVERSION}")
string(TIMESTAMP TIME_COMPILATION "%Y-%m-%d %H:%M")
#SET (VERSION_COMPILATION "${VERSION} - ${TIME_COMPILATION}")
#message("${VERSION_COMPILATION}")
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -std=gnu++11 -O3 ")
# Add the local Find*.cmake scripts
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
FIND_PACKAGE( RTLSDR REQUIRED )
INCLUDE_DIRECTORIES("${RTLSDR_INCLUDE_DIR}")
FIND_PACKAGE( OpenSSL REQUIRED )
INCLUDE_DIRECTORIES("OPENSSL_INCLUDE_DIR}")
FIND_PACKAGE(libusb-1.0 REQUIRED)
FIND_PACKAGE (Liquid REQUIRED)
FIND_PACKAGE (JSON-C REQUIRED)
FIND_PACKAGE (crypto REQUIRED)
FIND_PACKAGE (Avro REQUIRED)
FIND_PACKAGE (ZLIB REQUIRED)
FIND_PACKAGE (LibLZMA REQUIRED)
configure_file( version_config.h.in generated/version_config.h )
#ADD_SUBDIRECTORY(drivers/rtlsdr/converter/)
set(SOURCE_FILES main.cpp drivers/Driver.h drivers/rtlsdr/rtlsdrDriver.cpp drivers/rtlsdr/rtlsdrDriver.h
drivers/rtlsdr/converter/converter.c drivers/rtlsdr/converter/converter.h
context/ElectrosenseContext.cpp context/ElectrosenseContext.h
drivers/common/SequentialHopping.cpp drivers/common/SequentialHopping.h
types/SpectrumSegment.cpp types/SpectrumSegment.h ProcessingBlocks/RemoveDC.cpp ProcessingBlocks/RemoveDC.h
ProcessingBlocks/RemoveDCRTL.cpp
ProcessingBlocks/Windowing.cpp ProcessingBlocks/Windowing.h ProcessingBlocks/FFT.cpp ProcessingBlocks/FFT.h
ProcessingBlocks/Averaging.cpp ProcessingBlocks/Averaging.h MiscBlocks/FileSink.cpp MiscBlocks/FileSink.h
MiscBlocks/AvroSerialization.cpp MiscBlocks/AvroSerialization.h MiscBlocks/Transmission.cpp MiscBlocks/Transmission.h
misc/TLS.cpp misc/TLS.h misc/TCP.cpp misc/TCP.h MiscBlocks/IQSink.cpp MiscBlocks/IQSink.h ProcessingBlocks/PSDFast.cpp
ProcessingBlocks/PSDFast.h MiscBlocks/IQStream.cpp MiscBlocks/IQStream.h
MiscBlocks/Filter/FIR/FIRDesign.cpp MiscBlocks/Filter/Resampler/Downsampler.cpp)
add_executable(es_sensor ${SOURCE_FILES})
target_link_libraries(es_sensor
pthread
dl
${RTLSDR_LIBRARY}
${LIBUSB_1_LIBRARIES}
${LIQUID_LIBRARIES}
${AVRO_LIBRARY}
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES}
${CRYPTO_LIBRARIES}
${JSON-C_LIBRARIES}
)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/es_sensor DESTINATION /usr/share/electrosense/bin/)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/schemas/rtl-spec.avsc DESTINATION /usr/share/electrosense/schemas/)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/schemas/iq-spec.avsc DESTINATION /usr/share/electrosense/schemas/)
# Determine current architecture
macro(dpkg_arch VAR_NAME)
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
if (DPKG_PROGRAM)
execute_process(
COMMAND ${DPKG_PROGRAM} --print-architecture
OUTPUT_VARIABLE ${VAR_NAME}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(DPKG_PROGRAM)
endmacro(dpkg_arch)
#set (CPACK_DEBIAN_PACKAGE_DEPENDS "libfftw3-3, zlib1g, liblzma5, libusb-1.0-0")
include (InstallRequiredSystemLibraries)
SET (CPACK_GENERATOR "DEB")
SET (CPACK_SOURCE_GENERATOR TGZ)
SET (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET (CPACK_SET_DESTDIR "on")
SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr/share/")
SET (PKG_VERSION ${VERSION}-${DEBVERSION})
# CPack version numbers for release tarball name.
SET (CPACK_PACKAGE_VERSION_MAJOR 0)
SET (CPACK_PACKAGE_VERSION_MINOR 0)
SET (CPACK_PACKAGE_VERSION_PATCH 2)
SET (CPACK_DEBIAN_PACKAGE_VERSION ${PKG_VERSION})
SET (CPACK_DEBIAN_PACKAGE_PRIORITY "extra")
SET (CPACK_DEBIAN_PACKAGE_SECTION "net")
dpkg_arch(CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/postinst"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/postrm")
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Electrosense is a software-defined radio for monitoring the spectrum electromagnetic.")
SET (CPACK_PACKAGE_DESCRIPTION "Electrosense is a software-defined radio for monitoring the spectrum electromagnetic.")
SET (CPACK_PACKAGE_CONTACT "Roberto Calvo-Palomino <roberto.calvo@imdea.org>")
SET (CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${PKG_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET (CPACK_DEBIAN_PACKAGE_PROVIDES electrosense-run)
SET (CPACK_COMPONENTS_ALL Libraries ApplicationData)
include (CPack Documentation)