[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 25/50: controlport: fixing up some issues;
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 25/50: controlport: fixing up some issues; generate thrift sources into thrift subdir. |
Date: |
Wed, 15 Apr 2015 21:07:54 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit d99c0b44b1883708edee13bfbaaecae7ebfd7be5
Author: Tom Rondeau <address@hidden>
Date: Tue Mar 3 12:21:19 2015 -0500
controlport: fixing up some issues; generate thrift sources into thrift
subdir.
Fixed FindThrift cmake module to do a better job of handling version info.
---
cmake/Modules/FindThrift.cmake | 75 ++++++++++++++--------
.../include/gnuradio/rpcpmtconverters_thrift.h | 2 +-
.../include/gnuradio/rpcserver_booter_thrift.h | 2 +-
.../include/gnuradio/rpcserver_thrift.h | 4 +-
.../include/gnuradio/thrift_server_template.h | 2 +-
gnuradio-runtime/lib/controlport/CMakeLists.txt | 10 +--
.../controlport/thrift/rpcpmtconverters_thrift.cc | 2 +-
.../lib/controlport/thrift/rpcserver_thrift.cc | 2 +-
8 files changed, 62 insertions(+), 37 deletions(-)
diff --git a/cmake/Modules/FindThrift.cmake b/cmake/Modules/FindThrift.cmake
index 017e941..170ea48 100644
--- a/cmake/Modules/FindThrift.cmake
+++ b/cmake/Modules/FindThrift.cmake
@@ -1,41 +1,66 @@
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PC_THRIFT thrift>=0.9.2)
+PKG_CHECK_MODULES(PC_THRIFT thrift)
-FIND_PATH(THRIFT_INCLUDE_DIRS
- NAMES thrift/Thrift.h
- HINTS ${PC_THRIFT_INCLUDE_DIR}
- ${CMAKE_INSTALL_PREFIX}/include
- PATHS
- /usr/local/include
- /usr/include
-)
+set(THRIFT_REQ_VERSION "0.9.0")
-FIND_LIBRARY(THRIFT_LIBRARIES
- NAMES thrift
- HINTS ${PC_THRIFT_LIBDIR}
- ${CMAKE_INSTALL_PREFIX}/lib
- ${CMAKE_INSTALL_PREFIX}/lib64
- PATHS
- ${THRIFT_INCLUDE_DIRS}/../lib
- /usr/local/lib
- /usr/lib
-)
+# If pkg-config found Thrift and it doesn't meet our version
+# requirement, warn and exit -- does not cause an error; just doesn't
+# enable Thrift.
+if(PC_THRIFT_FOUND AND PC_THRIFT_VERSION VERSION_LESS ${THRIFT_REQ_VERSION})
+ message(STATUS "Could not find appropriate version of Thrift:
${PC_THRIFT_VERSION} < ${THRIFT_REQ_VERSION}")
+ return()
+endif(PC_THRIFT_FOUND AND PC_THRIFT_VERSION VERSION_LESS ${THRIFT_REQ_VERSION})
-if(THRIFT_INCLUDE_DIRS AND THRIFT_LIBRARIES)
- set(THRIFT_FOUND TRUE CACHE BOOL "If Thift has been found")
-endif(THRIFT_INCLUDE_DIRS AND THRIFT_LIBRARIES)
+# Else, look for it ourselves
+
+FIND_PATH(THRIFT_INCLUDE_DIRS
+ NAMES thrift/Thrift.h
+ HINTS ${PC_THRIFT_INCLUDE_DIR}
+ ${CMAKE_INSTALL_PREFIX}/include
+ PATHS
+ /usr/local/include
+ /usr/include
+ )
+
+FIND_LIBRARY(THRIFT_LIBRARIES
+ NAMES thrift
+ HINTS ${PC_THRIFT_LIBDIR}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ ${CMAKE_INSTALL_PREFIX}/lib64
+ PATHS
+ ${THRIFT_INCLUDE_DIRS}/../lib
+ /usr/local/lib
+ /usr/lib
+ )
# Get the thrift binary to build our files during cmake
FIND_PROGRAM(THRIFT_BIN thrift)
+# Use binary to get version string and test against THRIFT_REQ_VERSION
+EXECUTE_PROCESS(
+ COMMAND ${THRIFT_BIN} --version
+ OUTPUT_VARIABLE THRIFT_VERSION
+ ERROR_VARIABLE THRIFT_VERSION_ERROR
+ )
+STRING(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+"
+ THRIFT_VERSION ${THRIFT_VERSION})
+
+if(THRIFT_VERSION VERSION_LESS THRIFT_REQ_VERSION)
+ message(STATUS "Could not find appropriate version of Thrift:
${THRIFT_VERSION} < ${THRIFT_REQ_VERSION}")
+ return()
+endif(THRIFT_VERSION VERSION_LESS THRIFT_REQ_VERSION)
+
+
# Check that Thrift for Python is available
include(GrPython)
GR_PYTHON_CHECK_MODULE("Thrift" thrift "1" PYTHON_THRIFT_FOUND)
-if(NOT PYTHON_THRIFT_FOUND)
- unset(THRIFT_FOUND)
-endif(NOT PYTHON_THRIFT_FOUND)
+# Set to found if we've made it this far
+if(THRIFT_INCLUDE_DIRS AND THRIFT_LIBRARIES AND PYTHON_THRIFT_FOUND)
+ set(THRIFT_FOUND TRUE CACHE BOOL "If Thift has been found")
+endif(THRIFT_INCLUDE_DIRS AND THRIFT_LIBRARIES AND PYTHON_THRIFT_FOUND)
+
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(THRIFT DEFAULT_MSG
diff --git a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
index eeb5b35..6523165 100644
--- a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
+++ b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
@@ -25,7 +25,7 @@
#include <pmt/pmt.h>
#include <boost/noncopyable.hpp>
#include <boost/ptr_container/ptr_map.hpp>
-#include "gnuradio_types.h"
+#include "thrift/gnuradio_types.h"
namespace rpcpmtconverter
diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h
b/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h
index 836d431..28900a4 100644
--- a/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h
+++ b/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h
@@ -25,7 +25,7 @@
#include <gnuradio/rpcserver_booter_base.h>
#include <gnuradio/thrift_server_template.h>
-#include <ControlPort.h>
+#include "thrift/ControlPort.h"
class rpcserver_base;
class rpcserver_thrift;
diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h
b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h
index c09b0a1..027a9ea 100644
--- a/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h
+++ b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h
@@ -29,8 +29,8 @@
#include <iostream>
#include <sstream>
#include <map>
-#include "ControlPort.h"
-#include "gnuradio_types.h"
+#include "thrift/ControlPort.h"
+#include "thrift/gnuradio_types.h"
#include <boost/format.hpp>
#define S(x) #x
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index 5b97b0a..5a81886 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -35,7 +35,7 @@
#include <thrift/concurrency/PlatformThreadFactory.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
-#include <ControlPort.h>
+#include "thrift/ControlPort.h"
using namespace apache;
diff --git a/gnuradio-runtime/lib/controlport/CMakeLists.txt
b/gnuradio-runtime/lib/controlport/CMakeLists.txt
index 30b0671..4998aeb 100644
--- a/gnuradio-runtime/lib/controlport/CMakeLists.txt
+++ b/gnuradio-runtime/lib/controlport/CMakeLists.txt
@@ -47,13 +47,13 @@ GR_APPEND_SUBCOMPONENT("thrift")
# Run Thrrift To compile C++ and Python files
message(STATUS "Running thrift to build C++ bindings")
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thrift/)
EXECUTE_PROCESS(
- COMMAND ${THRIFT_BIN} --gen cpp -out ${CMAKE_CURRENT_BINARY_DIR}/
${CMAKE_CURRENT_SOURCE_DIR}/thrift/gnuradio.thrift
+ COMMAND ${THRIFT_BIN} --gen cpp -out ${CMAKE_CURRENT_BINARY_DIR}/thrift/
${CMAKE_CURRENT_SOURCE_DIR}/thrift/gnuradio.thrift
OUTPUT_VARIABLE THRIFT_CPP_OUTPUT
ERROR_VARIABLE THRIFT_CPP_ERROR
)
-
list(APPEND gnuradio_ctrlport_sources
${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcserver_thrift.cc
${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcpmtconverters_thrift.cc
@@ -63,9 +63,9 @@ list(APPEND gnuradio_ctrlport_sources
# add files built by compiling gnuradio.thrift
list(APPEND gnuradio_ctrlport_sources
- ${CMAKE_CURRENT_BINARY_DIR}/gnuradio_types.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/gnuradio_constants.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/ControlPort.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/gnuradio_types.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/gnuradio_constants.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/ControlPort.cpp
)
# Add required libraries here
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
index 7962032..19da05f 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
@@ -21,8 +21,8 @@
#include <boost/assign/ptr_map_inserter.hpp>
#include <gnuradio/rpcpmtconverters_thrift.h>
-#include "gnuradio_types.h"
#include <gnuradio/gr_complex.h>
+#include "thrift/gnuradio_types.h"
#include <iostream>
GNURadio::Knob
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
index bc878a8..a4119f7 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
@@ -29,7 +29,7 @@
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TTransportUtils.h>
#include <boost/xpressive/xpressive.hpp>
-#include "ControlPort.h"
+#include "thrift/ControlPort.h"
#define DEBUG 0
- [Commit-gnuradio] [gnuradio] 29/50: controlport: changing the default port number on the Thrift interface to zero., (continued)
- [Commit-gnuradio] [gnuradio] 29/50: controlport: changing the default port number on the Thrift interface to zero., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 21/50: controlport: Adds ability to configure Thrift through a config file, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 30/50: controlport: ephemeral / unused port number selection by OS working., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 13/50: controlport: using threaded server for multiple connections., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 39/50: controlport: documentation cleanup, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 35/50: controlport: cleanup, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 33/50: controlport: more cleanup and conveniences, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 11/50: controlport: more work on the translation layer; properties and setting parameters in gr-ctrlport-monitor now working., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 45/50: controlport: ensure proper ctrlport shutdown., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 08/50: controlport: adding abstraction layer for the controlport backends; support thrift currently., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 25/50: controlport: fixing up some issues; generate thrift sources into thrift subdir.,
git <=
- [Commit-gnuradio] [gnuradio] 16/50: controlport: switching rpcpmtconverter::to_pmt() to To_PMT singleton, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 40/50: controlport: documentation cleanup, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 10/50: controlport: more cleanup of python code to help generalize the interface, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 38/50: controlport: cleanup, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 41/50: controlport: cmake fixes to FindThrift for when thrift is not installed., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 43/50: controlport: more documentation and linking info., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 37/50: controlport: Some documentation, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 32/50: controlport: moving the generation of the Thrift endpoint string to the application_started() function., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 42/50: controlport: QA needs to get host and port out of the endpoint., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 27/50: controlport: cleaning up; trying to handle shutdown better., git, 2015/04/16