summaryrefslogtreecommitdiff
path: root/gnuradio-runtime
diff options
context:
space:
mode:
authorRyan Volz <ryan.volz@gmail.com>2021-05-15 16:46:07 -0400
committermormj <34754695+mormj@users.noreply.github.com>2021-06-01 07:43:04 -0400
commitf23985d1e2633d7e2862eb08b21a9bfe9baeb9d1 (patch)
treea62b50590e6d390ae5ce177efb3bf4a2c61dcbcf /gnuradio-runtime
parente324474c5e8bb772deb5115f09ea6e27dbb0920c (diff)
runtime: ctrlport: cmake: Fix thrift dependency for OOTs.
First, this moves find_package(THRIFT) up to the gnuradio-runtime CMakeLists.txt so that cache variables no longer have to be used to mark the found components. This fixes an issue where the thrift-specific headers were not installed even when thrift was enabled, because on first run the detection was occurring AFTER the runtime include CMakeLists.txt was evaluated. See further discussion in #2734, which solved one issue related to this setup. Further, even with thrift enabled, the thrift headers are not required for OOTs to build against gnuradio-runtime. OOTs would need to take special action to use those headers, in which case they should detect/enable thrift on their own. Thus, this makes the change to not add thrift as an extra dependency for OOTs and switches linking of Thrift::thrift from PUBLIC to PRIVATE. Signed-off-by: Ryan Volz <ryan.volz@gmail.com>
Diffstat (limited to 'gnuradio-runtime')
-rw-r--r--gnuradio-runtime/CMakeLists.txt9
-rw-r--r--gnuradio-runtime/include/gnuradio/CMakeLists.txt16
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt20
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt4
4 files changed, 22 insertions, 27 deletions
diff --git a/gnuradio-runtime/CMakeLists.txt b/gnuradio-runtime/CMakeLists.txt
index bf27d50c29..1332b9b341 100644
--- a/gnuradio-runtime/CMakeLists.txt
+++ b/gnuradio-runtime/CMakeLists.txt
@@ -44,6 +44,15 @@ GR_REGISTER_COMPONENT("gr-ctrlport" ENABLE_GR_CTRLPORT
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
########################################################################
diff --git a/gnuradio-runtime/include/gnuradio/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/CMakeLists.txt
index 1d4ade0c1d..6e584b3d87 100644
--- a/gnuradio-runtime/include/gnuradio/CMakeLists.txt
+++ b/gnuradio-runtime/include/gnuradio/CMakeLists.txt
@@ -72,11 +72,11 @@ install(FILES
DESTINATION ${GR_INCLUDE_DIR}/gnuradio
)
-if(THRIFT_FOUND)
-install(FILES
- rpcserver_booter_thrift.h
- thrift_application_base.h
- thrift_server_template.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
-)
-endif(THRIFT_FOUND)
+if(ENABLE_CTRLPORT_THRIFT)
+ install(FILES
+ rpcserver_booter_thrift.h
+ thrift_application_base.h
+ thrift_server_template.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ )
+endif(ENABLE_CTRLPORT_THRIFT)
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 1256f62761..2e1ba2ea2d 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -176,18 +176,11 @@ target_sources(gnuradio-runtime PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/controlport/rpcserver_selector.cc
)
-OPTION(ENABLE_CTRLPORT_THRIFT "Enable ControlPort Thrift support" ON)
-
if(ENABLE_CTRLPORT_THRIFT)
-# Look if Thrift is installed and use it as a ControlPort backend.
-FIND_PACKAGE(THRIFT ${GR_THRIFT_MIN_VERSION})
-
-if(THRIFT_FOUND)
-list(APPEND EXTRA_DEPS "THRIFT")
MATH(EXPR CTRLPORT_BACKENDS "${CTRLPORT_BACKENDS} + 1")
# Indicate thrift as an installed backend in the cmake summary.
-message(STATUS "Found and enabling Thrift backend to ControlPort")
+message(STATUS "Enabling Thrift backend to ControlPort")
GR_APPEND_SUBCOMPONENT("thrift")
# Run Thrift To compile C++ and Python files
@@ -215,7 +208,7 @@ target_sources(gnuradio-runtime PRIVATE
# add files built by compiling gnuradio.thrift
${gnuradio_thrift_generated_sources}
)
-target_link_libraries(gnuradio-runtime PUBLIC
+target_link_libraries(gnuradio-runtime PRIVATE
Thrift::thrift
)
@@ -228,7 +221,6 @@ install(
DESTINATION ${GR_PKG_DOC_DIR}/config
)
-endif(THRIFT_FOUND)
endif(ENABLE_CTRLPORT_THRIFT)
# Save the number of backends for testing against later
@@ -321,13 +313,7 @@ if(TRY_SHM_VMCIRCBUF)
target_compile_definitions(gnuradio-runtime PRIVATE -DTRY_SHM_VMCIRCBUF )
endif(TRY_SHM_VMCIRCBUF)
-set(EXTRA_DEPS "")
-if(ENABLE_CTRLPORT_THRIFT)
- if(THRIFT_FOUND)
- list(APPEND EXTRA_DEPS THRIFT)
- endif()
-endif()
-gr_library_foo(gnuradio-runtime ${EXTRA_DEPS})
+gr_library_foo(gnuradio-runtime)
########################################################################
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
index 0f4a86dc99..5c2773ceda 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
@@ -33,7 +33,7 @@ GR_PYTHON_INSTALL(
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
-if(THRIFT_FOUND)
+if(ENABLE_CTRLPORT_THRIFT)
list(APPEND thrift_targets
${CMAKE_CURRENT_BINARY_DIR}/GNURadio/__init__.py
@@ -67,4 +67,4 @@ if(THRIFT_FOUND)
DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio
)
-endif(THRIFT_FOUND)
+endif(ENABLE_CTRLPORT_THRIFT)