-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
112 lines (98 loc) · 3.9 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
########################################################################
# Setup library
########################################################################
include_directories(${GREXTRAS_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND GREXTRAS_SOURCES
add.cpp
add_const.cpp
add_const_v.cpp
multiply.cpp
multiply_const.cpp
multiply_const_v.cpp
subtract.cpp
divide.cpp
noise_source.cpp
signal_source.cpp
datagram_to_stream.cpp
stream_to_datagram.cpp
socket_message.cpp
tuntap.cpp
delay.cpp
stream_selector.cpp
uhd_status_port.cpp
uhd_control_port.cpp
)
########################################################################
# Setup PMC
########################################################################
include_directories(${PMC_INCLUDE_DIRS})
link_directories(${PMC_LIBRARY_DIRS})
list(APPEND GREXTRAS_LIBRARIES ${PMC_LIBRARIES})
########################################################################
# Setup GRAS
########################################################################
include_directories(${GRAS_INCLUDE_DIRS})
link_directories(${GRAS_LIBRARY_DIRS})
list(APPEND GREXTRAS_LIBRARIES ${GRAS_LIBRARIES})
########################################################################
# Setup Boost
########################################################################
find_package(Boost COMPONENTS thread) #add thread dependency
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
list(APPEND GREXTRAS_LIBRARIES ${Boost_LIBRARIES})
########################################################################
# Setup Volk
########################################################################
if(VOLK_FOUND)
include_directories(${VOLK_INCLUDE_DIRS})
link_directories(${VOLK_LIBRARY_DIRS})
list(APPEND GREXTRAS_LIBRARIES ${VOLK_LIBRARIES})
add_definitions(-DHAVE_VOLK)
endif()
########################################################################
# Setup GNU Radio Core
########################################################################
if(GNURADIO_CORE_FOUND)
include_directories(${GNURADIO_CORE_INCLUDE_DIRS})
link_directories(${GNURADIO_CORE_LIBRARY_DIRS})
list(APPEND GREXTRAS_LIBRARIES ${GNURADIO_CORE_LIBRARIES})
add_definitions(-DHAVE_GNURADIO_CORE)
endif()
########################################################################
# Optional UHD
########################################################################
if(UHD_FOUND)
include_directories(${UHD_INCLUDE_DIRS})
link_directories(${UHD_LIBRARY_DIRS})
list(APPEND GREXTRAS_LIBRARIES ${UHD_LIBRARIES})
add_definitions(-DHAVE_UHD)
endif()
########################################################################
# Build library
########################################################################
add_library(grextras SHARED ${GREXTRAS_SOURCES})
target_link_libraries(grextras ${GREXTRAS_LIBRARIES})
set_target_properties(grextras PROPERTIES VERSION ${GREXTRAS_VERSION})
set_target_properties(grextras PROPERTIES DEFINE_SYMBOL "GREXTRAS_DLL_EXPORTS")
########################################################################
# Install library
########################################################################
install(TARGETS grextras
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "extras_runtime" # .so file
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "extras_devel" # .lib file
RUNTIME DESTINATION bin COMPONENT "extras_runtime" # .dll file
)
########################################################################
# Build pkg config file
########################################################################
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/grextras.pc.in
${CMAKE_CURRENT_BINARY_DIR}/grextras.pc
@ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/grextras.pc
DESTINATION lib${LIB_SUFFIX}/pkgconfig
COMPONENT "extras_devel"
)