Added build support for the GN3S dongle. If the variable GN3S_DRIVER is set, CMake automatically builds the gr-gn3s project, adds the gn3s_signal_source and links the corresponding library. There is no need to have gr-gn3s already installed.

Example:
$ cd build
$ export GN3S_DRIVER=1
$ cmake ../
$ make
$ make install

The gr-gn3s project can be build and installed independently, for instance for using it as a source block in gnuradio-companion.


git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@300 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-12-27 21:11:50 +00:00
parent 12598ea17f
commit 201b446c47
2 changed files with 45 additions and 24 deletions

View File

@ -96,26 +96,26 @@ find_package(Boost COMPONENTS date_time filesystem system thread REQUIRED)
################################################################################
# GLog - http://code.google.com/p/google-glog/
# glog - http://code.google.com/p/google-glog/
################################################################################
find_package(GLOG REQUIRED)
if ( NOT GLOG_FOUND )
message(FATAL_ERROR "GLOG library not found!")
else( NOT GLOG_FOUND )
message ( "GLOG library found at ${GLOG_LIBRARIES}" )
message(FATAL_ERROR "google-glog library not found! Please check http://code.google.com/p/google-glog/")
else( NOT GLOG_FOUND )
message ( "google-glog library found." )
endif( NOT GLOG_FOUND )
include_directories(${GLOG_INCLUDE_DIRS})
################################################################################
# GFlags - http://code.google.com/p/gflags/
# gflags - http://code.google.com/p/gflags/
################################################################################
find_package(GFlags REQUIRED)
if ( NOT GFlags_FOUND )
message(FATAL_ERROR "GFLAGS library not found!")
else()
message ( "GFLAGS library found" )
message(FATAL_ERROR "gflags library not found! Please check http://code.google.com/p/gflags/")
else( NOT GFlags_FOUND )
message ( "gflags library found." )
endif( NOT GFlags_FOUND )
include_directories(${GFlags_INCLUDE_DIRS})
@ -128,7 +128,7 @@ find_package(Gperftools)
if ( NOT GPERFTOOLS_FOUND )
message("The optional library GPerftools has not been found.")
else()
message ( "GPerftools library found" )
message ( "GPerftools library found." )
link_libraries(profiler tcmalloc)
endif( NOT GPERFTOOLS_FOUND )
list(APPEND CMAKE_CXX_FLAGS ${GCC_GPERFTOOLS_FLAGS})
@ -142,13 +142,12 @@ list(APPEND CMAKE_CXX_FLAGS ${GCC_GPERFTOOLS_FLAGS})
find_package(Doxygen)
if(DOXYGEN_FOUND)
message( "Doxygen found" )
configure_file(#${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_SOURCE_DIR}/Doxyfile @ONLY)
add_custom_target(doc
message( "Doxygen found. You can build the documentation with 'make doc'." )
configure_file(${CMAKE_SOURCE_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
COMMENT "Generating API documentation with Doxygen." VERBATIM
)
ENDIF(DOXYGEN_FOUND)
@ -192,7 +191,7 @@ endif()
find_package(Armadillo)
if(NOT ARMADILLO_FOUND)
message(FATAL_ERROR "Armadillo required to build gnss-sdr")
message(FATAL_ERROR "Armadillo required to build gnss-sdr. Please check http://arma.sourceforge.net/")
endif()
@ -200,13 +199,16 @@ endif()
# Setup of optional drivers
################################################################################
if( $ENV{GN3S_DRIVER} )
message( "GN3S_DRIVER variable found" )
message( "GN3S_DRIVER variable found." )
# copy firmware to install folder
# Build project gr-gn3s
else( $ENV{GN3S_DRIVER} )
message( "GN3S_DRIVER is not defined." )
message( "Define it with 'export GN3S_DRIVER=1' to add support for the GN3S dongle." )
endif($ENV{GN3S_DRIVER} )
if( $ENV{RTLSDR_DRIVER} )
message( "RTLSDR_DRIVER variable found" )
message( "RTLSDR_DRIVER variable found." )
# find libosmosdr
# find gr-osmosdr
endif($ENV{RTLSDR_DRIVER} )

View File

@ -16,18 +16,37 @@
# 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})
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)
##############################################
# GN3S (USB dongle)
##############################################
# find_package(GrGN3S)
# if not found, build it with ExternalPackage_Add
include(ExternalProject)
ExternalProject_Add(
gr-gn3s
SOURCE_DIR ${CMAKE_SOURCE_DIR}/drivers/gr-gn3s
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../../gr-gn3s
UPDATE_COMMAND ""
PATCH_COMMAND ""
INSTALL_COMMAND ""
)
# Set up variables
set(GRGN3S_INCLUDE_DIRS ${GRGN3S_DIR}/include ${GRGN3S_DIR} ${GRGN3S_DIR}/src)
set(GRGN3S_LIBRARIES
"${CMAKE_CURRENT_BINARY_DIR}/../../../../gr-gn3s/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gr-gn3s${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GRGN3S_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${GRGN3S_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} gn3s_signal_source.cc)
endif($ENV{GN3S_DRIVER})
if($ENV{RTLSDR_DRIVER})
################################################################################
# OsmoSDR - http://sdr.osmocom.org/trac/