forked from gnuradio/gnuradio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
129 lines (106 loc) · 4.67 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
# Copyright 2013,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
########################################################################
# Setup dependencies
########################################################################
include(GrBoost)
include(GrPython)
find_package(MPLIB)
########################################################################
# Setup compatibility checks and defines
########################################################################
include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
gr_check_linux_sched_avail()
########################################################################
# Find spdlog
########################################################################
find_package(spdlog CONFIG)
########################################################################
# Register component
########################################################################
include(GrComponent)
gr_register_component(
"gnuradio-runtime"
ENABLE_GNURADIO_RUNTIME
Boost_FOUND
PYTHONINTERP_FOUND
MPLIB_FOUND
spdlog_FOUND
Volk_FOUND)
get_filename_component(GNURADIO_RUNTIME_PYTHONPATH ${PROJECT_SOURCE_DIR}/python ABSOLUTE)
########################################################################
# Setup precompiled header pseudo-component
########################################################################
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
set(GR_CMAKE_HAS_PCH ${CMAKE_VERSION})
endif()
gr_register_component("common-precompiled-headers" ENABLE_COMMON_PCH
ENABLE_GNURADIO_RUNTIME GR_CMAKE_HAS_PCH)
if(ENABLE_COMMON_PCH)
add_library(common-precompiled-headers STATIC
${CMAKE_CURRENT_SOURCE_DIR}/lib/dummy.cc)
target_include_directories(
common-precompiled-headers
PUBLIC $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
if(MSVC)
target_compile_definitions(
common-precompiled-headers
PUBLIC # disables stupidity and enables std::min and std::max
-DNOMINMAX)
endif(MSVC)
target_precompile_headers(
common-precompiled-headers
PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/gnuradio/top_block.h>>
)
target_link_libraries(common-precompiled-headers PUBLIC spdlog::spdlog)
endif()
########################################################################
# Register controlport component
########################################################################
gr_register_component("gr-ctrlport" ENABLE_GR_CTRLPORT Boost_FOUND
ENABLE_GNURADIO_RUNTIME)
# find thrift quietly to determine whether it should be enabled by default
find_package(THRIFT ${GR_THRIFT_MIN_VERSION} QUIET)
option(ENABLE_CTRLPORT_THRIFT "Enable ControlPort Thrift support" ${THRIFT_FOUND})
if(ENABLE_CTRLPORT_THRIFT)
# ensure we have thrift, loudly, since it is enabled
find_package(THRIFT ${GR_THRIFT_MIN_VERSION} REQUIRED)
endif()
########################################################################
# Begin conditional configuration
########################################################################
if(ENABLE_GNURADIO_RUNTIME)
get_filename_component(GR_RUNTIME_PYTHONPATH ${CMAKE_CURRENT_SOURCE_DIR}/python
ABSOLUTE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-runtime.conf.in
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.conf @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.conf
DESTINATION ${GR_PREFSDIR})
set(PC_ADD_CFLAGS ${MPLIB_PC_ADD_CFLAGS})
########################################################################
# Add subdirectories
########################################################################
add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(apps)
if(ENABLE_PYTHON)
add_subdirectory(python)
if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif(ENABLE_EXAMPLES)
endif(ENABLE_PYTHON)
########################################################################
# Create Pkg Config File
########################################################################
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-runtime.pc.in
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.pc
DESTINATION ${GR_LIBRARY_DIR}/pkgconfig)
endif(ENABLE_GNURADIO_RUNTIME)