diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-02-20 17:14:03 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-04-02 15:38:56 -0700 |
commit | 1875c3381bc4e2d2468f9dfe44557cd2a94d5e1c (patch) | |
tree | a1bb1f3374735d59abf94fa877b8521d15613591 /cmake | |
parent | 61864555b687d918b1bd4772fa12c83a29e78abf (diff) |
controlport: Addes a FindThrift cmake module to find the Thrift headers, libraries, and Python files.
Also adds a ENABLE_CTRLPORT_THRIFT option to cmake so we can turn off Thrift even if it's found installed on the system. We will do this for any backend to provide maximum control over what is used and not used.
This changes how the RPC selector mechanism works; we now set the available RPCs in the config.h file instead of just by hand in the rpcserver_selector.h code.
Finally, cmake displays the backend as a submodule of gr-ctrlport when summarizing what is being built for GNU Radio so we know which backends are or are not being used.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindThrift.cmake | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cmake/Modules/FindThrift.cmake b/cmake/Modules/FindThrift.cmake new file mode 100644 index 0000000000..017e941eeb --- /dev/null +++ b/cmake/Modules/FindThrift.cmake @@ -0,0 +1,48 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(PC_THRIFT thrift>=0.9.2) + +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 +) + +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) + + +# Get the thrift binary to build our files during cmake +FIND_PROGRAM(THRIFT_BIN thrift) + +# 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) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(THRIFT DEFAULT_MSG + THRIFT_LIBRARIES THRIFT_INCLUDE_DIRS + THRIFT_BIN PYTHON_THRIFT_FOUND THRIFT_FOUND +) +MARK_AS_ADVANCED( + THRIFT_LIBRARIES THRIFT_INCLUDE_DIRS + THRIFT_BIN PYTHON_THRIFT_FOUND THRIFT_FOUND +) |