mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-06 07:20:34 +00:00
Added support for RTL devices. If the variable RTLSDR_DRIVER is set, CMake looks for libosmosdr and gnuradio-osmosdr libraries and compiles the corresponding signal source.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@298 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
7ebebd041e
commit
b52846e7fd
@ -213,7 +213,7 @@ endif($ENV{RTLSDR_DRIVER} )
|
||||
|
||||
|
||||
########################################################################
|
||||
# Setup the include and linker paths
|
||||
# Setup the include paths
|
||||
########################################################################
|
||||
include_directories(
|
||||
${Boost_INCLUDE_DIRS}
|
||||
@ -225,15 +225,6 @@ include_directories(
|
||||
${GPERFTOOLS_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${Boost_LIBRARY_DIRS}
|
||||
${GRUEL_LIBRARY_DIRS}
|
||||
${GNURADIO_CORE_LIBRARY_DIRS}
|
||||
${GLOG_LIBRARY_DIRS}
|
||||
${GFLAGS_LIBRARY_DIRS}
|
||||
${GPERFTOOLS_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
|
||||
########################################################################
|
||||
# Set compiler flags
|
||||
@ -279,7 +270,6 @@ add_subdirectory(src)
|
||||
|
||||
#add_subdirectory(drivers)
|
||||
#add_subdirectory(firmware)
|
||||
#add_subdirectory($OSMOSDR_ROOT/include/osmosdr)
|
||||
#add_subdirectory(${GTEST_DIR}/include)
|
||||
|
||||
|
||||
|
||||
|
51
cmake/Modules/FindGrOsmoSDR.cmake
Normal file
51
cmake/Modules/FindGrOsmoSDR.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
# Tries to find gr-osmosdr.
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(GrOsmoSDR)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# GrOsmoSDR_ROOT_DIR Set this variable to the root installation of
|
||||
# gr-osmosdr if the module has problems finding
|
||||
# the proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# GROSMOSDR_FOUND System has gr-osmosdr libs/headers
|
||||
# GROSMOSDR_LIBRARIES The gr-osmosdr libraries (gnuradio-osmosdr)
|
||||
# GROSMOSDR_INCLUDE_DIR The location of gr-osmosdr headers
|
||||
|
||||
|
||||
|
||||
FIND_PATH(GROSMOSDR_INCLUDE_DIR
|
||||
NAMES osmosdr/osmosdr_source_c.h
|
||||
osmosdr/osmosdr_api.h
|
||||
HINTS ${GrOsmoSDR_ROOT_DIR}/include
|
||||
PATHS /usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
|
||||
find_library(GROSMOSDR_LIBRARIES
|
||||
NAMES gnuradio-osmosdr
|
||||
HINTS ${GrOsmoSDR_ROOT_DIR}/lib
|
||||
PATHS /usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
GrOsmoSDR
|
||||
DEFAULT_MSG
|
||||
GROSMOSDR_LIBRARIES
|
||||
GROSMOSDR_INCLUDE_DIR
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
GrOsmoSDR_ROOT_DIR
|
||||
GROSMOSDR_LIBRARIES
|
||||
GROSMOSDR_INCLUDE_DIR
|
||||
)
|
27
cmake/Modules/FindLibOsmoSDR.cmake
Normal file
27
cmake/Modules/FindLibOsmoSDR.cmake
Normal file
@ -0,0 +1,27 @@
|
||||
if(NOT LIBOSMOSDR_FOUND)
|
||||
pkg_check_modules (LIBOSMOSDR_PKG libosmosdr)
|
||||
find_path(LIBOSMOSDR_INCLUDE_DIR NAMES osmosdr.h
|
||||
PATHS
|
||||
${LIBOSMOSDR_PKG_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr
|
||||
PATHS
|
||||
${LIBOSMOSDR_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES)
|
||||
set(LIBOSMOSDR_FOUND TRUE CACHE INTERNAL "libosmosdr found")
|
||||
message(STATUS "Found libosmosdr: ${LIBOSMOSDR_INCLUDE_DIR}, ${LIBOSMOSDR_LIBRARIES}")
|
||||
else(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES)
|
||||
set(LIBOSMOSDR_FOUND FALSE CACHE INTERNAL "libosmosdr found")
|
||||
message(STATUS "libosmosdr not found.")
|
||||
endif(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES)
|
||||
|
||||
mark_as_advanced(LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES)
|
||||
|
||||
endif(NOT LIBOSMOSDR_FOUND)
|
@ -16,25 +16,46 @@
|
||||
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
#set(OPT_DRIVER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters)
|
||||
|
||||
|
||||
# Optional drivers
|
||||
|
||||
IF($ENV{GN3S_DRIVER})
|
||||
if($ENV{GN3S_DRIVER})
|
||||
message(" GN3S ")
|
||||
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters)
|
||||
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} gn3s_signal_source.cc)
|
||||
ENDIF($ENV{GN3S_DRIVER})
|
||||
endif($ENV{GN3S_DRIVER})
|
||||
|
||||
IF($ENV{RTLSDR_DRIVER})
|
||||
message(" RTLSDR ")
|
||||
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters)
|
||||
if($ENV{RTLSDR_DRIVER})
|
||||
################################################################################
|
||||
# OsmoSDR - http://sdr.osmocom.org/trac/
|
||||
################################################################################
|
||||
find_package(LibOsmoSDR)
|
||||
if(NOT LIBOSMOSDR_FOUND)
|
||||
message(FATAL_ERROR "libosmosdr required to build gnss-sdr with the optional RTLSDR driver")
|
||||
endif(NOT LIBOSMOSDR_FOUND)
|
||||
find_package(GrOsmoSDR REQUIRED)
|
||||
if(NOT GROSMOSDR_FOUND)
|
||||
message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional RTLSDR driver")
|
||||
endif(NOT GROSMOSDR_FOUND)
|
||||
# set RTL include dirs
|
||||
set(RTL_DRIVER_INCLUDE_DIRS
|
||||
${OPT_DRIVER_INCLUDE_DIRS}
|
||||
${GROSMOSDR_INCLUDE_DIR}/osmosdr
|
||||
${LIBOSMOSDR_INCLUDE_DIR}
|
||||
)
|
||||
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} rtlsdr_signal_source.cc)
|
||||
ENDIF($ENV{RTLSDR_DRIVER})
|
||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBOSMOSDR_LIBRARIES} ${GROSMOSDR_LIBRARIES})
|
||||
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${RTL_DRIVER_INCLUDE_DIRS})
|
||||
endif($ENV{RTLSDR_DRIVER})
|
||||
|
||||
set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc uhd_signal_source.cc ${OPT_DRIVER_SOURCES})
|
||||
|
||||
include_directories(
|
||||
$(CMAKE_CURRENT_SOURCE_DIR)
|
||||
$(OPT_DRIVER_INCLUDE_DIRS)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${OPT_DRIVER_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/src/core/system_parameters
|
||||
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
||||
${CMAKE_SOURCE_DIR}/src/algorithms/libs
|
||||
@ -45,7 +66,5 @@ include_directories(
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
link_directories(${Boost_LIBRARY_DIR})
|
||||
|
||||
add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES})
|
||||
target_link_libraries(signal_source_adapters gnss_sp_libs ${Boost_LIBRARIES} uhd gnuradio-uhd)
|
||||
target_link_libraries(signal_source_adapters gnss_sp_libs ${Boost_LIBRARIES} uhd gnuradio-uhd ${OPT_LIBRARIES})
|
Loading…
Reference in New Issue
Block a user