mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-26 00:46:59 +00:00
Improving detection of GNU Radio
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@460 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
c89ca38ba4
commit
173cc13f76
@ -60,9 +60,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
else(ARCH_64BITS)
|
||||
set(ARCH_ "(32 bits)")
|
||||
endif(ARCH_64BITS)
|
||||
if(EXISTS "/etc/fedora-release")
|
||||
set(LINUX_DISTRIBUTION "Fedora")
|
||||
elseif(EXISTS "/etc/lsb-release")
|
||||
if(EXISTS "/etc/lsb-release")
|
||||
execute_process(COMMAND cat /etc/lsb-release
|
||||
COMMAND grep DISTRIB_ID
|
||||
COMMAND awk -F= "{ print $2 }"
|
||||
@ -79,11 +77,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
OUTPUT_VARIABLE LINUX_VER
|
||||
RESULT_VARIABLE LINUX_VER_RESULT
|
||||
)
|
||||
endif(EXISTS "/etc/fedora-release")
|
||||
endif(EXISTS "/etc/lsb-release")
|
||||
if(NOT LINUX_DISTRIBUTION)
|
||||
if(EXISTS "/etc/os-release")
|
||||
execute_process(COMMAND cat /etc/os-release
|
||||
COMMAND grep NAME
|
||||
execute_process(COMMAND cat /etc/os-release
|
||||
COMMAND grep -m1 NAME
|
||||
COMMAND awk -F= "{ print $2 }"
|
||||
COMMAND tr "\n" " "
|
||||
COMMAND sed "s/ //"
|
||||
@ -106,9 +104,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
file (READ /etc/redhat-release LINUX_VER)
|
||||
endif(EXISTS "/etc/redhat-release")
|
||||
if(EXISTS "/etc/linuxmint/info")
|
||||
set(LINUX_DISTRIBUTION "Mint")
|
||||
execute_process(COMMAND cat /etc/linuxmint/info
|
||||
COMMAND grep RELEASE
|
||||
set(LINUX_DISTRIBUTION "LinuxMint")
|
||||
execute_process(COMMAND cat /etc/linuxmint/info
|
||||
COMMAND grep -m1 RELEASE
|
||||
COMMAND awk -F= "{ print $2 }"
|
||||
COMMAND tr "\n" " "
|
||||
COMMAND sed "s/ //"
|
||||
@ -208,11 +206,7 @@ endif(NOT Boost_FOUND)
|
||||
# GNU Radio - http://gnuradio.org/redmine/projects/gnuradio/wiki
|
||||
################################################################################
|
||||
|
||||
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS UHD ANALOG FILTER FFT VOLK FEC TRELLIS)
|
||||
|
||||
find_package(Gnuradio "3.7.0")
|
||||
find_package(Volk)
|
||||
find_package(UHD)
|
||||
find_package(Gnuradio)
|
||||
|
||||
if(NOT GNURADIO_RUNTIME_FOUND)
|
||||
message(STATUS "cmake cannot find GNU Radio >= 3.7")
|
||||
@ -229,11 +223,14 @@ 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")
|
||||
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")
|
||||
@ -478,7 +475,7 @@ if(OS_IS_LINUX)
|
||||
/usr/lib/gcc/x86_64-linux-gnu
|
||||
/usr/lib/gcc/i686-linux-gnu
|
||||
/usr/lib/gcc/i386-linux-gnu
|
||||
/usr/lib/gcc/x86_64-linux-gnu/4.6
|
||||
/usr/lib/gcc/x86_64-linux-gnu/4.6 # Ubuntu 12.04
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6
|
||||
/usr/lib/gcc/x86_64-linux-gnu/4.7
|
||||
/usr/lib/gcc/i686-linux-gnu/4.7
|
||||
@ -488,12 +485,16 @@ if(OS_IS_LINUX)
|
||||
/usr/lib/gcc/i686-redhat-linux/4.7.2
|
||||
/usr/lib/gcc/x86_64-redhat-linux/4.8.1 # Fedora 19
|
||||
/usr/lib/gcc/i686-redhat-linux/4.8.1
|
||||
/usr/lib/gcc/x86_64-redhat-linux/4.4.4 # CentOS 6
|
||||
/usr/lib/gcc/i686-redhat-linux/4.4.4
|
||||
/usr/lib/gcc/x86_64-redhat-linux/4.8.2
|
||||
/usr/lib/gcc/i686-redhat-linux/4.8.2
|
||||
)
|
||||
if(NOT GFORTRAN)
|
||||
message(" The gfortran library has not been found.")
|
||||
message(" You can try to install it by typing:")
|
||||
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
|
||||
message(" sudo yum install libgfortran")
|
||||
message(" sudo yum install gcc-fortran")
|
||||
else(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
|
||||
message(" sudo apt-get install gfortran")
|
||||
endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
|
||||
|
145
cmake/Modules/FindGnuradio.cmake
Normal file
145
cmake/Modules/FindGnuradio.cmake
Normal file
@ -0,0 +1,145 @@
|
||||
# Copyright 2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Radio is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
INCLUDE(FindPkgConfig)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
# if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list
|
||||
if(NOT GR_REQUIRED_COMPONENTS)
|
||||
set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT FEC TRELLIS UHD)
|
||||
endif()
|
||||
|
||||
|
||||
# Allows us to use all .cmake files in this directory
|
||||
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Easily access all libraries and includes of GNU Radio
|
||||
set(GNURADIO_ALL_LIBRARIES "")
|
||||
set(GNURADIO_ALL_INCLUDE_DIRS "")
|
||||
|
||||
MACRO(LIST_CONTAINS var value)
|
||||
SET(${var})
|
||||
FOREACH(value2 ${ARGN})
|
||||
IF (${value} STREQUAL ${value2})
|
||||
SET(${var} TRUE)
|
||||
ENDIF(${value} STREQUAL ${value2})
|
||||
ENDFOREACH(value2)
|
||||
ENDMACRO(LIST_CONTAINS)
|
||||
|
||||
function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE)
|
||||
|
||||
LIST_CONTAINS(REQUIRED_MODULE ${EXTVAR} ${GR_REQUIRED_COMPONENTS})
|
||||
if(NOT REQUIRED_MODULE)
|
||||
#message("Ignoring GNU Radio Module ${EXTVAR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Checking for GNU Radio Module: ${EXTVAR}")
|
||||
|
||||
# check for .pc hints
|
||||
PKG_CHECK_MODULES(PC_GNURADIO_${EXTVAR} ${PCNAME})
|
||||
|
||||
if(NOT PC_GNURADIO_${EXTVAR}_FOUND)
|
||||
set(PC_GNURADIO_${EXTVAR}_LIBRARIES ${LIBFILE})
|
||||
endif()
|
||||
|
||||
set(INCVAR_NAME "GNURADIO_${EXTVAR}_INCLUDE_DIRS")
|
||||
set(LIBVAR_NAME "GNURADIO_${EXTVAR}_LIBRARIES")
|
||||
set(PC_INCDIR ${PC_GNURADIO_${EXTVAR}_INCLUDEDIR})
|
||||
set(PC_LIBDIR ${PC_GNURADIO_${EXTVAR}_LIBDIR})
|
||||
|
||||
# look for include files
|
||||
FIND_PATH(
|
||||
${INCVAR_NAME}
|
||||
NAMES ${INCFILE}
|
||||
HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
|
||||
${PC_INCDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
${GNURADIO_INSTALL_PREFIX}/include
|
||||
PATHS /usr/local/include
|
||||
/usr/include
|
||||
${GNURADIO_INSTALL_PREFIX}/include
|
||||
)
|
||||
|
||||
# look for libs
|
||||
foreach(libname ${PC_GNURADIO_${EXTVAR}_LIBRARIES})
|
||||
FIND_LIBRARY(
|
||||
${LIBVAR_NAME}_${libname}
|
||||
NAMES ${libname}
|
||||
HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
|
||||
${PC_LIBDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/lib/
|
||||
${CMAKE_INSTALL_PREFIX}/lib64/
|
||||
${GNURADIO_INSTALL_PREFIX}/lib/
|
||||
${GNURADIO_INSTALL_PREFIX}/lib64
|
||||
PATHS /usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
${GNURADIO_INSTALL_PREFIX}/lib
|
||||
)
|
||||
list(APPEND ${LIBVAR_NAME} ${${LIBVAR_NAME}_${libname}})
|
||||
endforeach(libname)
|
||||
|
||||
set(${LIBVAR_NAME} ${${LIBVAR_NAME}} PARENT_SCOPE)
|
||||
|
||||
# show results
|
||||
message(STATUS " * INCLUDES=${GNURADIO_${EXTVAR}_INCLUDE_DIRS}")
|
||||
message(STATUS " * LIBS=${GNURADIO_${EXTVAR}_LIBRARIES}")
|
||||
|
||||
# append to all includes and libs list
|
||||
set(GNURADIO_ALL_INCLUDE_DIRS ${GNURADIO_ALL_INCLUDE_DIRS} ${GNURADIO_${EXTVAR}_INCLUDE_DIRS} PARENT_SCOPE)
|
||||
set(GNURADIO_ALL_LIBRARIES ${GNURADIO_ALL_LIBRARIES} ${GNURADIO_${EXTVAR}_LIBRARIES} PARENT_SCOPE)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_${EXTVAR} DEFAULT_MSG GNURADIO_${EXTVAR}_LIBRARIES GNURADIO_${EXTVAR}_INCLUDE_DIRS)
|
||||
message(STATUS "GNURADIO_${EXTVAR}_FOUND = ${GNURADIO_${EXTVAR}_FOUND}")
|
||||
set(GNURADIO_${EXTVAR}_FOUND ${GNURADIO_${EXTVAR}_FOUND} PARENT_SCOPE)
|
||||
|
||||
# generate an error if the module is missing
|
||||
if(NOT GNURADIO_${EXTVAR}_FOUND)
|
||||
message(STATUS "Required GNU Radio Component: ${EXTVAR} missing!")
|
||||
endif()
|
||||
|
||||
MARK_AS_ADVANCED(GNURADIO_${EXTVAR}_LIBRARIES GNURADIO_${EXTVAR}_INCLUDE_DIRS)
|
||||
|
||||
endfunction()
|
||||
|
||||
GR_MODULE(RUNTIME gnuradio-runtime gnuradio/top_block.h gnuradio-runtime)
|
||||
GR_MODULE(ANALOG gnuradio-analog gnuradio/analog/api.h gnuradio-analog)
|
||||
GR_MODULE(ATSC gnuradio-atsc gnuradio/atsc/api.h gnuradio-atsc)
|
||||
GR_MODULE(AUDIO gnuradio-audio gnuradio/audio/api.h gnuradio-audio)
|
||||
GR_MODULE(BLOCKS gnuradio-blocks gnuradio/blocks/api.h gnuradio-blocks)
|
||||
GR_MODULE(CHANNELS gnuradio-channels gnuradio/channels/api.h gnuradio-channels)
|
||||
GR_MODULE(DIGITAL gnuradio-digital gnuradio/digital/api.h gnuradio-digital)
|
||||
GR_MODULE(FCD gnuradio-fcd gnuradio/fcd_api.h gnuradio-fcd)
|
||||
GR_MODULE(FEC gnuradio-fec gnuradio/fec/api.h gnuradio-fec)
|
||||
GR_MODULE(FFT gnuradio-fft gnuradio/fft/api.h gnuradio-fft)
|
||||
GR_MODULE(FILTER gnuradio-filter gnuradio/filter/api.h gnuradio-filter)
|
||||
GR_MODULE(NOAA gnuradio-noaa gnuradio/noaa/api.h gnuradio-noaa)
|
||||
GR_MODULE(PAGER gnuradio-pager gnuradio/pager/api.h gnuradio-pager)
|
||||
GR_MODULE(QTGUI gnuradio-qtgui gnuradio/qtgui/api.h gnuradio-qtgui)
|
||||
GR_MODULE(TRELLIS gnuradio-trellis gnuradio/trellis/api.h gnuradio-trellis)
|
||||
GR_MODULE(UHD gnuradio-uhd gnuradio/uhd/api.h gnuradio-uhd)
|
||||
GR_MODULE(VOCODER gnuradio-vocoder gnuradio/vocoder/api.h gnuradio-vocoder)
|
||||
GR_MODULE(WAVELET gnuradio-wavelet gnuradio/wavelet/api.h gnuradio-wavelet)
|
||||
GR_MODULE(WXGUI gnuradio-wxgui gnuradio/wxgui/api.h gnuradio-wxgui)
|
||||
GR_MODULE(PMT gnuradio-runtime pmt/pmt.h gnuradio-pmt)
|
||||
|
||||
list(REMOVE_DUPLICATES GNURADIO_ALL_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES GNURADIO_ALL_LIBRARIES)
|
Loading…
Reference in New Issue
Block a user