From 004495507d436924c7291853268ec67c51b849c8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 14 Dec 2013 10:23:33 +0000 Subject: [PATCH] Fixing detection of GNU Radio when installed in non-usual locations (e.g. /home/user/target). Now the user can tell cmake where GNU Radio is by 'cmake ../ -DGNURADIO_INSTALL_PREFIX=/home/user/target' git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@462 64b25241-fba3-4117-9849-534c7e92360d --- CMakeLists.txt | 12 ++++++++--- README | 14 ++++++++----- cmake/Modules/FindGnuradio.cmake | 21 +++---------------- cmake/Modules/FindUHD.cmake | 2 ++ cmake/Modules/FindVolk.cmake | 6 ++++++ .../acquisition/adapters/CMakeLists.txt | 1 + .../channel/adapters/CMakeLists.txt | 2 +- src/algorithms/channel/libs/CMakeLists.txt | 1 + src/algorithms/libs/CMakeLists.txt | 1 + .../signal_source/adapters/CMakeLists.txt | 18 ++++++++++++++-- .../gnuradio_blocks/CMakeLists.txt | 1 + .../tracking/adapters/CMakeLists.txt | 11 +--------- .../tracking/gnuradio_blocks/CMakeLists.txt | 11 +--------- src/core/receiver/CMakeLists.txt | 3 ++- src/main/CMakeLists.txt | 4 +++- 15 files changed, 57 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16cd28b17..b1b4b6415 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,7 +81,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(NOT LINUX_DISTRIBUTION) if(EXISTS "/etc/os-release") execute_process(COMMAND cat /etc/os-release - COMMAND grep -m1 NAME + COMMAND grep -e "^[NAME]" COMMAND awk -F= "{ print $2 }" COMMAND tr "\n" " " COMMAND sed "s/ //" @@ -125,7 +125,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LINUX_DISTRIBUTION "Generic") set(LINUX_VER "Unknown") endif(NOT LINUX_DISTRIBUTION) - message(STATUS "Configuring GNSS-SDR to be built on ${LINUX_DISTRIBUTION} Release ${LINUX_VER} ${ARCH_}") + message(STATUS "Configuring GNSS-SDR to be built on ${LINUX_DISTRIBUTION} GNU/Linux Release ${LINUX_VER} ${ARCH_}") endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # Detect Mac OS X Version @@ -184,8 +184,14 @@ endif(GTEST_DIR) ################################################################################ if(UNIX AND EXISTS "/usr/lib64") - list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix + list(APPEND BOOST_LIBRARYDIR "/usr/lib64") # Fedora 64-bit fix endif(UNIX AND EXISTS "/usr/lib64") +if(GNURADIO_INSTALL_PREFIX) + if(EXISTS "${GNURADIO_INSTALL_PREFIX}/lib/libboost_thread-mt.so") + list(APPEND BOOST_LIBRARYDIR "${GNURADIO_INSTALL_PREFIX}/lib") # Boost installed by PyBOMBS + list(APPEND BOOST_INCLUDEDIR "${GNURADIO_INSTALL_PREFIX}/include") # Boost installed by PyBOMBS + endif(EXISTS "${GNURADIO_INSTALL_PREFIX}/lib/libboost_thread-mt.so") +endif(GNURADIO_INSTALL_PREFIX) set(Boost_ADDITIONAL_VERSIONS "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" "1.45.0" "1.45" "1.46.0" "1.46" "1.48.0" "1.48" "1.49.0" "1.49" diff --git a/README b/README index 0c4212ee1..9cd952a60 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ This document describes how to set up the compilation environment and build GNSS GNU/Linux ----------------------------------------------------------- -Tested distributions: Ubuntu 12.04, 12.10, 13.04 and 13.10 (32 and 64 bits), Debian 6.0.6, Fedora 18 (newer versions should work, too) +Tested distributions: Ubuntu 12.04, 12.10, 13.04 and 13.10 (32 and 64 bits), Debian 6.0.6 and 7.2, Fedora 18 (newer versions should work, too) * Install GNU Radio: @@ -16,13 +16,14 @@ $ cd pybombs Configure PyBOMBS: -$ ./pybombs config +$ sudo ./pybombs config You can safely accept the default options but for prefix. We recommend to put /usr/local there. After the configuration, you should get something similar to: gituser = username prefix = /usr/local -satisfy_order = deb,src +satisfy_order = deb,src # For Debian/Ubuntu/LinuxMint +satisfy_order = rpm,src # For Fedora/CentOS/RHEL forcepkgs = timeout = 30 cmakebuildtype = RelWithDebInfo @@ -40,7 +41,9 @@ In case you do not want to use PyBOMBS and prefer to build and install GNU Radio - Download, compile, and install the Armadillo linear algebra library -$ sudo apt-get install libblas-dev liblapack-dev gfortran +$ sudo apt-get install libblas-dev liblapack-dev gfortran # For Debian/Ubuntu/LinuxMint +$ sudo yum install lapack-devel blas-devel gcc-fortran # For Fedora/CentOS/RHEL + $ wget http://sourceforge.net/projects/arma/files/armadillo-3.920.2.tar.gz $ tar xvfz armadillo-3.920.2.tar.gz $ cd armadillo-3.920.2 @@ -96,7 +99,8 @@ changing /home/username/gtest-1.7.0 by the actual directory where you downloaded - Install Subversion and the SSL development libraries: -$ sudo apt-get install libssl-dev subversion +$ sudo apt-get install libssl-dev subversion # For Debian/Ubuntu/LinuxMint +$ sudo yum install openssl-devel subversion # For Fedora/CentOS/RHEL * Check out the latest version of GNSS-SDR diff --git a/cmake/Modules/FindGnuradio.cmake b/cmake/Modules/FindGnuradio.cmake index 04129c135..46f6c2fc3 100644 --- a/cmake/Modules/FindGnuradio.cmake +++ b/cmake/Modules/FindGnuradio.cmake @@ -1,21 +1,6 @@ -# 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. +######################################################################## +# Find GNU Radio +######################################################################## INCLUDE(FindPkgConfig) INCLUDE(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index b4d12b6d7..d5a12713a 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -12,6 +12,7 @@ FIND_PATH( ${PC_UHD_INCLUDEDIR} PATHS /usr/local/include /usr/include + ${GNURADIO_INSTALL_PREFIX}/include ) FIND_LIBRARY( @@ -21,6 +22,7 @@ FIND_LIBRARY( ${PC_UHD_LIBDIR} PATHS /usr/local/lib /usr/lib + ${GNURADIO_INSTALL_PREFIX}/lib ) INCLUDE(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindVolk.cmake b/cmake/Modules/FindVolk.cmake index 425eb010c..58da7edd9 100644 --- a/cmake/Modules/FindVolk.cmake +++ b/cmake/Modules/FindVolk.cmake @@ -1,3 +1,7 @@ +######################################################################## +# Find VOLK (Vector-Optimized Library of Kernels) +######################################################################## + INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_VOLK volk) @@ -8,6 +12,7 @@ FIND_PATH( ${PC_VOLK_INCLUDEDIR} PATHS /usr/local/include /usr/include + ${GNURADIO_INSTALL_PREFIX}/include ) FIND_LIBRARY( @@ -19,6 +24,7 @@ FIND_LIBRARY( /usr/local/lib64 /usr/lib /usr/lib64 + ${GNURADIO_INSTALL_PREFIX}/lib ) INCLUDE(FindPackageHandleStandardArgs) diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 097f608c4..26877803c 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -53,6 +53,7 @@ include_directories( ${Boost_INCLUDE_DIRS} ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(acq_adapters ${ACQ_ADAPTER_SOURCES}) diff --git a/src/algorithms/channel/adapters/CMakeLists.txt b/src/algorithms/channel/adapters/CMakeLists.txt index 89af68755..f065d91f3 100644 --- a/src/algorithms/channel/adapters/CMakeLists.txt +++ b/src/algorithms/channel/adapters/CMakeLists.txt @@ -30,4 +30,4 @@ include_directories( ) add_library(channel_adapters ${CHANNEL_ADAPTER_SOURCES}) -target_link_libraries(channel_adapters channel_fsm ${GNURADIO_RUNTIME_LIBRARIES}) +target_link_libraries(channel_adapters channel_fsm ${GNURADIO_RUNTIME_LIBRARIES} ${Boost_LIBRARIES}) diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index 4061a6f15..070d411c1 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -27,6 +27,7 @@ include_directories( ${Boost_INCLUDE_DIRS} ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(channel_fsm ${CHANNEL_FSM_SOURCES}) diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index de5c6930a..857a923a4 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -47,6 +47,7 @@ include_directories( ${Boost_INCLUDE_DIRS} ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) if(OPENCL_FOUND) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 2d8b36124..3a2d81d9a 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -74,7 +74,12 @@ if(RTLSDR_DRIVER) set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${RTL_DRIVER_INCLUDE_DIRS}) endif(RTLSDR_DRIVER) -set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc gen_signal_source.cc uhd_signal_source.cc nsr_file_signal_source.cc ${OPT_DRIVER_SOURCES}) +set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc + gen_signal_source.cc + uhd_signal_source.cc + nsr_file_signal_source.cc + ${OPT_DRIVER_SOURCES} +) include_directories( @@ -95,4 +100,13 @@ if(ARCH_64BITS) endif(ARCH_64BITS) add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES}) -target_link_libraries(signal_source_adapters signal_source_gr_blocks ${Boost_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES} ${OPT_LIBRARIES} gnss_sp_libs) + +target_link_libraries(signal_source_adapters signal_source_gr_blocks + ${Boost_LIBRARIES} + ${GNURADIO_PMT_LIBRARIES} + ${GNURADIO_BLOCKS_LIBRARIES} + ${UHD_LIBRARIES} + ${GNURADIO_UHD_LIBRARIES} + ${OPT_LIBRARIES} + gnss_sp_libs +) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index 1677776ab..5b50bfa6e 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -30,6 +30,7 @@ include_directories( ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(telemetry_decoder_gr_blocks ${TELEMETRY_DECODER_GR_BLOCKS_SOURCES}) diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index db04a39cf..5c82a8464 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -16,15 +16,7 @@ # along with GNSS-SDR. If not, see . # -#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") -#set(TRACKING_ADAPTER_SOURCES -# galileo_e1_dll_pll_veml_tracking.cc -# galileo_e1_tcp_connector_tracking.cc -# gps_l1_ca_dll_fll_pll_tracking.cc -# gps_l1_ca_dll_pll_tracking.cc -# gps_l1_ca_tcp_connector_tracking.cc -#) -#else(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(TRACKING_ADAPTER_SOURCES galileo_e1_dll_pll_veml_tracking.cc galileo_e1_tcp_connector_tracking.cc @@ -33,7 +25,6 @@ set(TRACKING_ADAPTER_SOURCES gps_l1_ca_dll_pll_tracking.cc gps_l1_ca_tcp_connector_tracking.cc ) -#endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") include_directories( $(CMAKE_CURRENT_SOURCE_DIR) diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index f5c912010..3d9473667 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -16,15 +16,6 @@ # along with GNSS-SDR. If not, see . # -#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") -#set(TRACKING_GR_BLOCKS_SOURCES -# galileo_e1_dll_pll_veml_tracking_cc.cc -# galileo_e1_tcp_connector_tracking_cc.cc -# gps_l1_ca_dll_fll_pll_tracking_cc.cc -# gps_l1_ca_dll_pll_tracking_cc.cc -# gps_l1_ca_tcp_connector_tracking_cc.cc -#) -#else(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(TRACKING_GR_BLOCKS_SOURCES galileo_e1_dll_pll_veml_tracking_cc.cc galileo_e1_tcp_connector_tracking_cc.cc @@ -33,7 +24,6 @@ set(TRACKING_GR_BLOCKS_SOURCES gps_l1_ca_dll_pll_tracking_cc.cc gps_l1_ca_tcp_connector_tracking_cc.cc ) -#endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") include_directories( $(CMAKE_CURRENT_SOURCE_DIR) @@ -45,6 +35,7 @@ include_directories( ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(tracking_gr_blocks ${TRACKING_GR_BLOCKS_SOURCES}) diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 0e89c26e5..42d7192ee 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -32,7 +32,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs ${CMAKE_SOURCE_DIR}/src/core/libs/supl ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp - ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl + ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl ${CMAKE_SOURCE_DIR}/src/algorithms/libs ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/gnuradio_blocks @@ -60,6 +60,7 @@ include_directories( ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 52d6370c2..2140b352e 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -24,11 +24,12 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs ${CMAKE_SOURCE_DIR}/src/core/libs/supl ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp - ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl + ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) @@ -53,6 +54,7 @@ target_link_libraries(gnss-sdr ${MAC_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} ${ARMADILLO_LIBRARIES} + ${UHD_LIBRARIES} gnss_sp_libs gnss_rx )