Making UHD not required, but used by default if found

This commit is contained in:
Carles Fernandez 2014-11-14 21:42:22 +01:00
parent c9de15ccdb
commit 54eb5d65be
5 changed files with 52 additions and 24 deletions

View File

@ -325,27 +325,15 @@ if(NOT GNURADIO_RUNTIME_FOUND)
endif(OS_IS_MACOSX)
endif(NOT GNURADIO_RUNTIME_FOUND)
find_package(Volk)
find_package(UHD)
if(NOT GNURADIO_BLOCKS_FOUND)
message(FATAL_ERROR "*** gnuradio-blocks 3.7 or later is required to build gnss-sdr")
endif()
if(NOT UHD_FOUND)
message(FATAL_ERROR "*** UHD is required to build gnss-sdr. Please check http://code.ettus.com/redmine/ettus/projects/uhd/wiki")
endif()
if(NOT GNURADIO_UHD_FOUND)
message(FATAL_ERROR "*** gnuradio-uhd 3.7 or later is required to build gnss-sdr")
endif()
if(NOT GNURADIO_FILTER_FOUND)
message(FATAL_ERROR "*** gnuradio-filter 3.7 or later is required to build gnss-sdr")
endif()
if(NOT GNURADIO_FFT_FOUND)
message(FATAL_ERROR "*** gnuradio-fft 3.7 or later is required to build gnss-sdr")
endif()
if(NOT VOLK_FOUND)
message(FATAL_ERROR "*** VOLK is required to build gnss-sdr")
endif()
if(NOT GNURADIO_ANALOG_FOUND)
message(FATAL_ERROR "*** gnuradio-analog 3.7 or later is required to build gnss-sdr")
endif()
@ -356,6 +344,12 @@ if(NOT GNURADIO_TRELLIS_FOUND)
message(FATAL_ERROR "*** gnuradio-trellis 3.7 or later is required to build gnss-sdr")
endif()
find_package(Volk)
if(NOT VOLK_FOUND)
message(FATAL_ERROR "*** VOLK is required to build gnss-sdr")
endif()
################################################################################
# volk_gnsssdr module - GNSS-SDR's own VOLK library
@ -786,9 +780,25 @@ if(NOT OPENSSL_FOUND)
endif(NOT OPENSSL_FOUND)
################################################################################
# Universal Hardware Driver (UHD) (OPTIONAL, used if found)
################################################################################
find_package(UHD)
if(NOT UHD_FOUND)
set(ENABLE_UHD OFF)
message(STATUS "The Universal Hardware Driver (UHD) based signal source will not be built,")
message(STATUS "so all USRP-based front-ends will not be usable.")
message(STATUS "Please check http://code.ettus.com/redmine/ettus/projects/uhd/wiki")
else(NOT UHD_FOUND)
if(NOT GNURADIO_UHD_FOUND)
message(FATAL_ERROR "*** gnuradio-uhd 3.7 or later is required to build gnss-sdr")
endif(NOT GNURADIO_UHD_FOUND)
set(ENABLE_UHD ON)
endif(NOT UHD_FOUND)
################################################################################
# Doxygen - http://www.stack.nl/~dimitri/doxygen/index.html (OPTIONAL)
# Doxygen - http://www.stack.nl/~dimitri/doxygen/index.html (OPTIONAL, used if found)
################################################################################
find_package(Doxygen)
if(DOXYGEN_FOUND)

View File

@ -101,9 +101,15 @@ if(ENABLE_RTLSDR)
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${RTL_DRIVER_INCLUDE_DIRS})
endif(ENABLE_RTLSDR)
if(ENABLE_UHD)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${UHD_INCLUDE_DIRS})
endif(ENABLE_UHD)
set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc
gen_signal_source.cc
uhd_signal_source.cc
gen_signal_source.cc
nsr_file_signal_source.cc
${OPT_DRIVER_SOURCES}
)
@ -116,7 +122,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/gnuradio_blocks
${UHD_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
@ -135,9 +140,7 @@ source_group(Headers FILES ${SIGNAL_SOURCE_ADAPTER_HEADERS})
target_link_libraries(signal_source_adapters signal_source_gr_blocks
${Boost_LIBRARIES}
${GNURADIO_PMT_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${UHD_LIBRARIES}
${GNURADIO_UHD_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${OPT_LIBRARIES}
gnss_sp_libs
)

View File

@ -77,6 +77,10 @@ if(ENABLE_RTLSDR)
add_definitions(-DRTLSDR_DRIVER=1)
endif(ENABLE_RTLSDR)
if(ENABLE_UHD)
add_definitions(-DUHD_DRIVER=1)
endif(ENABLE_UHD)
#Enable OpenCL if found in the system
if(OPENCL_FOUND)
message(STATUS "Adding processing blocks implemented using OpenCL" )

View File

@ -48,7 +48,7 @@
#include "null_sink_output_filter.h"
#include "file_output_filter.h"
#include "channel.h"
#include "uhd_signal_source.h"
#include "signal_conditioner.h"
#include "array_signal_conditioner.h"
#include "ishort_to_complex.h"
@ -104,6 +104,11 @@
#include "rtlsdr_signal_source.h"
#endif
#if UHD_DRIVER
#include "uhd_signal_source.h"
#endif
using google::LogMessage;
@ -386,12 +391,14 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
exit(1);
}
}
#if UHD_DRIVER
else if (implementation.compare("UHD_Signal_Source") == 0)
{
std::unique_ptr<GNSSBlockInterface> block_(new UhdSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#endif
#if GN3S_DRIVER
else if (implementation.compare("GN3S_Signal_Source") == 0)
{

View File

@ -27,6 +27,11 @@ if(ENABLE_GPERFTOOLS)
endif(GPERFTOOLS_FOUND)
endif(ENABLE_GPERFTOOLS)
if(ENABLE_UHD)
set(GNSS_SDR_OPTIONAL_LIBS ${GNSS_SDR_OPTIONAL_LIBS} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES})
set(GNSS_SDR_OPTIONAL_HEADERS ${GNSS_SDR_OPTIONAL_HEADERS} ${UHD_INCLUDE_DIRS})
endif(ENABLE_UHD)
include_directories(
${CMAKE_SOURCE_DIR}/src/core/system_parameters
${CMAKE_SOURCE_DIR}/src/core/interfaces
@ -69,11 +74,10 @@ target_link_libraries(gnss-sdr ${MAC_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${ARMADILLO_LIBRARIES}
${UHD_LIBRARIES}
gnss_sp_libs
gnss_rx
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
${GNSS_SDR_OPTIONAL_LIBS}
gnss_sp_libs
gnss_rx
)
@ -105,7 +109,7 @@ find_program(GZIP
/sbin
)
if(NOT GZIP_NOTFOUND)
execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/cmake/Packaging/gnss-sdr-manpage
execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/gnss-sdr-manpage
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/gnss-sdr.1.gz")
install(FILES ${CMAKE_BINARY_DIR}/gnss-sdr.1.gz DESTINATION share/man/man1)