From 3257d8cba1ba1ef9be1f0f2a9dde47dc10f953bd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 7 Aug 2014 21:04:01 +0200 Subject: [PATCH] Improving handling of optional processing blocks and linking libraries. New options ENABLE_GN3S, ENABLE_RTLSDR, ENABLE_OPENCL, ENABLE_ARRAY and ENABLE_GPERFTOOLS, all set by default to OFF. Users can enable that features by 'cmake -DENABLE_XXX=ON ../ '. OpenCL is now not used by default since it was giving problems in some platforms. Old variables (RTSDR_DRIVER, GN3S_DRIVER, RAW_ARRAY_DRIVER and DISABLE_OPENCL) are still honored and can be used in the same way, but the new ENABLE_XXX are recommended for the sake of more uniform naming. Main CMakeFile.txt has been rearranged, putting options first, then searching for the required libraries, and then the optional ones. If Gperftools is enabled and found, binaries are linked to the tcmalloc and profiler libraries, and using the adequate flags. Fixed building in Mac OSX if Armadillo and OpenBLAS were not installed in the system. --- CMakeLists.txt | 337 ++++++++++-------- .../signal_source/adapters/CMakeLists.txt | 19 +- src/core/receiver/CMakeLists.txt | 32 +- src/main/CMakeLists.txt | 15 +- src/tests/CMakeLists.txt | 16 +- src/utils/front-end-cal/CMakeLists.txt | 12 +- 6 files changed, 232 insertions(+), 199 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 418e91fb6..b45267c28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,20 +16,34 @@ # along with GNSS-SDR. If not, see . # -######################################################################## -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "Prevented in-tree build. This is bad practice. Try 'cd build && cmake ../' ") -endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) ######################################################################## # Project setup ######################################################################## +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "Prevented in-tree build. This is bad practice. Try 'cd build && cmake ../' ") +endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) cmake_minimum_required(VERSION 2.8) project(gnss-sdr CXX C) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) +file(RELATIVE_PATH RELATIVE_CMAKE_CALL ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -# Set the version information here + +######################################################################## +# Determine optional blocks/libraries to be built (default: not built) +# Enable them here or at the command line by doing 'cmake -DENABLE_XXX=ON ../' +######################################################################## + +option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF) +option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF) +option(ENABLE_RTLSDR "Enable the use of RTL dongles as signal source (experimental)" OFF) +option(ENABLE_OPENCL "Enable building of processing blocks implemented with OpenCL (experimental)" OFF) +option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) + + +############################### +# GNSS-SDR version information +############################### # Get the current working branch execute_process( COMMAND git rev-parse --abbrev-ref HEAD @@ -51,7 +65,7 @@ set(VERSION_INFO_API_COMPAT 0) set(VERSION_INFO_MINOR_VERSION 3.git-${GIT_BRANCH}-${GIT_COMMIT_HASH}) set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION}) -file(RELATIVE_PATH RELATIVE_CMAKE_CALL ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + ######################################################################## # Environment setup @@ -198,6 +212,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + ################################################################################ # Googletest - http://code.google.com/p/googletest/ ################################################################################ @@ -219,7 +234,6 @@ endif(GTEST_DIR) ################################################################################ # Boost - http://www.boost.org ################################################################################ - if(UNIX AND EXISTS "/usr/lib64") list(APPEND BOOST_LIBRARYDIR "/usr/lib64") # Fedora 64-bit fix endif(UNIX AND EXISTS "/usr/lib64") @@ -247,9 +261,7 @@ endif(NOT Boost_FOUND) ################################################################################ # GNU Radio - http://gnuradio.org/redmine/projects/gnuradio/wiki ################################################################################ - find_package(Gnuradio) - if(NOT GNURADIO_RUNTIME_FOUND) message(STATUS "CMake cannot find GNU Radio >= 3.7") if(OS_IS_LINUX) @@ -372,7 +384,6 @@ endif(NOT GFlags_FOUND OR LOCAL_GLOG) ################################################################################ # glog - http://code.google.com/p/google-glog/ ################################################################################ - find_package(GLOG) set(glog_RELEASE 0.3.3) if (NOT GLOG_FOUND OR LOCAL_GFLAGS) @@ -474,93 +485,9 @@ endif(NOT GLOG_FOUND OR LOCAL_GFLAGS) - -################################################################################ -# GPerftools - http://code.google.com/p/gperftools/ -################################################################################ - -set(GCC_GPERFTOOLS_FLAGS "") -find_package(Gperftools) -if ( NOT GPERFTOOLS_FOUND ) - message(STATUS "The optional library GPerftools has not been found.") -else( NOT GPERFTOOLS_FOUND ) - message (STATUS "GPerftools library found." ) - link_libraries(${GPERFTOOLS_PROFILER} ${GPERFTOOLS_TCMALLOC}) -endif( NOT GPERFTOOLS_FOUND ) -list(APPEND CMAKE_CXX_FLAGS ${GCC_GPERFTOOLS_FLAGS}) - - - - -################################################################################ -# Doxygen - http://www.stack.nl/~dimitri/doxygen/index.html -################################################################################ - -find_package(Doxygen) -if(DOXYGEN_FOUND) - message(STATUS "Doxygen found.") - message(STATUS "You can build the documentation with 'make doc'." ) - message(STATUS "When done, point your browser to ${CMAKE_SOURCE_DIR}/html/index.html") - set(HAVE_DOT ${DOXYGEN_DOT_FOUND}) - file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) - file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) - find_package(LATEX) - if (PDFLATEX_COMPILER) - set(GENERATE_PDF_DOCUMENTATION "YES") - set(GNSSSDR_USE_MATHJAX "NO") - else(PDFLATEX_COMPILER) - set(GENERATE_PDF_DOCUMENTATION "NO") - set(GNSSSDR_USE_MATHJAX "YES") - endif(PDFLATEX_COMPILER) - configure_file(${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.in - ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile - @ONLY - ) - add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMENT "Generating API documentation with Doxygen." VERBATIM - ) - if(LATEX_COMPILER) - message(STATUS "'make pdfmanual' will generate a manual at ${CMAKE_SOURCE_DIR}/docs/GNSS-SDR_manual.pdf") - add_custom_target(pdfmanual - COMMAND ${CMAKE_MAKE_PROGRAM} - COMMAND ${CMAKE_COMMAND} -E copy refman.pdf ${CMAKE_SOURCE_DIR}/docs/GNSS-SDR_manual.pdf - COMMAND ${CMAKE_MAKE_PROGRAM} clean - DEPENDS doc - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/latex - COMMENT "Generating PDF manual with Doxygen." VERBATIM - ) - endif(LATEX_COMPILER) - message(STATUS "'make doc-clean' will clean the documentation.") - add_custom_target(doc-clean - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/docs/html - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/docs/latex - COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SOURCE_DIR}/docs/GNSS-SDR_manual.pdf - COMMENT "Cleaning documentation." VERBATIM - ) -else(DOXYGEN_FOUND) - message(STATUS " Doxygen has not been found in your system.") - message(STATUS " You can get nice code documentation by using it!") - message(STATUS " Get it from http://www.stack.nl/~dimitri/doxygen/index.html") - if(OS_IS_LINUX) - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" or simply by doing 'sudo yum install doxygen-latex'.") - else(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" or simply by doing 'sudo apt-get install doxygen-latex'.") - endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - endif(OS_IS_LINUX) - if(OS_IS_MACOSX) - message(STATUS " or simply by doing 'sudo port install doxygen +latex'.") - endif(OS_IS_MACOSX) -endif(DOXYGEN_FOUND) - - - ################################################################################ # Armadillo - http://arma.sourceforge.net/ ################################################################################ - if(OS_IS_LINUX) ############################################################################# # Check that LAPACK is found in the system @@ -696,6 +623,9 @@ if(NOT ARMADILLO_FOUND) ExternalProject_Get_Property(armadillo-${armadillo_RELEASE} binary_dir) set(ARMADILLO_INCLUDE_DIRS ${binary_dir}/include ) find_library(LAPACK NAMES lapack HINTS /usr/lib /usr/local/lib /usr/lib64) + if(OS_IS_MACOSX) + find_library(BLAS blas) + endif(OS_IS_MACOSX) find_package(OpenBLAS) if(OPENBLAS_FOUND) set(BLAS ${OPENBLAS}) @@ -714,27 +644,6 @@ endif(NOT ARMADILLO_FOUND) -############################################################################### -# OpenCL -############################################################################### -find_package(OpenCL) -if($ENV{DISABLE_OPENCL}) - set(DISABLE_OPENCL TRUE) -endif($ENV{DISABLE_OPENCL}) -if(DISABLE_OPENCL) - set(OPENCL_FOUND FALSE) -else(DISABLE_OPENCL) - if(OPENCL_FOUND) - message(STATUS "OpenCL has been found and will be used by some processing blocks") - message(STATUS "You can disable OpenCL use by doing 'cmake -DDISABLE_OPENCL=1 ../' ") - endif(OPENCL_FOUND) -endif(DISABLE_OPENCL) -if(NOT OPENCL_FOUND) - message(STATUS "Processing blocks using OpenCL will not be built.") -endif(NOT OPENCL_FOUND) - - - ################################################################################ # OpenSSL - http://www.openssl.org ################################################################################ @@ -756,41 +665,166 @@ if(NOT OPENSSL_FOUND) endif(NOT OPENSSL_FOUND) + +################################################################################ +# Doxygen - http://www.stack.nl/~dimitri/doxygen/index.html (OPTIONAL) +################################################################################ +find_package(Doxygen) +if(DOXYGEN_FOUND) + message(STATUS "Doxygen found.") + message(STATUS "You can build the documentation with 'make doc'." ) + message(STATUS "When done, point your browser to ${CMAKE_SOURCE_DIR}/html/index.html") + set(HAVE_DOT ${DOXYGEN_DOT_FOUND}) + file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) + file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) + find_package(LATEX) + if (PDFLATEX_COMPILER) + set(GENERATE_PDF_DOCUMENTATION "YES") + set(GNSSSDR_USE_MATHJAX "NO") + else(PDFLATEX_COMPILER) + set(GENERATE_PDF_DOCUMENTATION "NO") + set(GNSSSDR_USE_MATHJAX "YES") + endif(PDFLATEX_COMPILER) + configure_file(${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.in + ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile + @ONLY + ) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Generating API documentation with Doxygen." VERBATIM + ) + if(LATEX_COMPILER) + message(STATUS "'make pdfmanual' will generate a manual at ${CMAKE_SOURCE_DIR}/docs/GNSS-SDR_manual.pdf") + add_custom_target(pdfmanual + COMMAND ${CMAKE_MAKE_PROGRAM} + COMMAND ${CMAKE_COMMAND} -E copy refman.pdf ${CMAKE_SOURCE_DIR}/docs/GNSS-SDR_manual.pdf + COMMAND ${CMAKE_MAKE_PROGRAM} clean + DEPENDS doc + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/latex + COMMENT "Generating PDF manual with Doxygen." VERBATIM + ) + endif(LATEX_COMPILER) + message(STATUS "'make doc-clean' will clean the documentation.") + add_custom_target(doc-clean + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/docs/html + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/docs/latex + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SOURCE_DIR}/docs/GNSS-SDR_manual.pdf + COMMENT "Cleaning documentation." VERBATIM + ) +else(DOXYGEN_FOUND) + message(STATUS " Doxygen has not been found in your system.") + message(STATUS " You can get nice code documentation by using it!") + message(STATUS " Get it from http://www.stack.nl/~dimitri/doxygen/index.html") + if(OS_IS_LINUX) + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" or simply by doing 'sudo yum install doxygen-latex'.") + else(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" or simply by doing 'sudo apt-get install doxygen-latex'.") + endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + endif(OS_IS_LINUX) + if(OS_IS_MACOSX) + message(STATUS " or simply by doing 'sudo port install doxygen +latex'.") + endif(OS_IS_MACOSX) +endif(DOXYGEN_FOUND) + + + +############################################################################### +# OpenCL (OPTIONAL) +############################################################################### +if(ENABLE_OPENCL) + find_package(OpenCL) + if($ENV{DISABLE_OPENCL}) + set(DISABLE_OPENCL TRUE) + endif($ENV{DISABLE_OPENCL}) + if(DISABLE_OPENCL) + set(OPENCL_FOUND FALSE) + else(DISABLE_OPENCL) + if(OPENCL_FOUND) + message(STATUS "OpenCL has been found and will be used by some processing blocks") + message(STATUS "You can disable OpenCL use by doing 'cmake -DENABLE_OPENCL=OFF ../' ") + endif(OPENCL_FOUND) + endif(DISABLE_OPENCL) + if(NOT OPENCL_FOUND) + message(STATUS "Processing blocks using OpenCL will not be built.") + endif(NOT OPENCL_FOUND) +else(ENABLE_OPENCL) + set(OPENCL_FOUND FALSE) +endif(ENABLE_OPENCL) + + + + +################################################################################ +# GPerftools - http://code.google.com/p/gperftools/ (OPTIONAL) +################################################################################ + +if(ENABLE_GPERFTOOLS) + find_package(Gperftools) + if ( NOT GPERFTOOLS_FOUND ) + message(STATUS "The optional library GPerftools has not been found.") + else( NOT GPERFTOOLS_FOUND ) + message (STATUS "GPerftools library found." ) + endif( NOT GPERFTOOLS_FOUND ) +endif(ENABLE_GPERFTOOLS) + + + ################################################################################ # Setup of optional drivers ################################################################################ -if( $ENV{GN3S_DRIVER} ) - message(STATUS "GN3S_DRIVER variable found." ) - # copy firmware to install folder - # Build project gr-gn3s -else( $ENV{GN3S_DRIVER} ) - if( GN3S_DRIVER ) - message(STATUS "GN3S driver will be compiled") - else( GNSS_DRIVER ) - message(STATUS "GN3S_DRIVER is not defined." ) - message(STATUS "Define it with 'export GN3S_DRIVER=1' to add support for the GN3S dongle." ) - endif( GN3S_DRIVER ) -endif($ENV{GN3S_DRIVER} ) -if( $ENV{RAW_ARRAY_DRIVER} ) - message(STATUS "RAW_ARRAY_DRIVER variable found." ) +if($ENV{GN3S_DRIVER}) + message(STATUS "GN3S_DRIVER environment variable found." ) + set(ENABLE_GN3S ON) +endif($ENV{GN3S_DRIVER}) +if(GN3S_DRIVER) + set(ENABLE_GN3S ON) +endif(GN3S_DRIVER) +if(ENABLE_GN3S) + message(STATUS "The GN3S driver will be compiled.") + message(STATUS "You can disable it with 'cmake -DENABLE_GN3S=OFF ../'" ) +else(ENABLE_GN3S) + message(STATUS "The (optional and experimental) GN3S driver is not enabled." ) + message(STATUS "Enable it with 'cmake -DENABLE_GN3S=ON ../' to add support for the GN3S dongle." ) +endif(ENABLE_GN3S) + + +if($ENV{RAW_ARRAY_DRIVER}) + message(STATUS "RAW_ARRAY_DRIVER environment variable found." ) + set(ENABLE_ARRAY ON) +endif($ENV{RAW_ARRAY_DRIVER}) +if(RAW_ARRAY_DRIVER) + set(ENABLE_ARRAY ON) +endif(RAW_ARRAY_DRIVER) +if(ENABLE_ARRAY) + message(STATUS "CTTC's Antenna Array front-end driver will be compiled." ) + message(STATUS "You can disable it with 'cmake -DENABLE_ARRAY=OFF ../'" ) # copy firmware to install folder # Build project gr-dbfcttc -else( $ENV{RAW_ARRAY_DRIVER} ) - if( RAW_ARRAY_DRIVER ) - message(STATUS "RAW_ARRAY_DRIVER driver will be compiled") - else( RAW_ARRAY_DRIVER ) - message(STATUS "RAW_ARRAY_DRIVER is not defined." ) - message(STATUS "Define it with 'export RAW_ARRAY_DRIVER=1' to add support for the CTTC experimental array front-end." ) - endif( RAW_ARRAY_DRIVER ) -endif($ENV{RAW_ARRAY_DRIVER} ) +else(ENABLE_ARRAY) + message(STATUS "The (optional) CTTC's Antenna Array front-end driver is not enabled." ) + message(STATUS "Enable it with 'cmake -DENABLE_ARRAY=ON ../' to add support for the CTTC experimental array front-end." ) +endif(ENABLE_ARRAY) -if( $ENV{RTLSDR_DRIVER} ) - message(STATUS "RTLSDR_DRIVER variable found." ) + +if($ENV{RTLSDR_DRIVER}) + message(STATUS "RTLSDR_DRIVER environment variable found." ) + set(ENABLE_RTLSDR ON) +endif($ENV{RTLSDR_DRIVER}) +if(RAW_ARRAY_DRIVER) + set(ENABLE_RTLSDR ON) +endif(RAW_ARRAY_DRIVER) +if(ENABLE_RTLSDR) + message(STATUS "The driver for RTL-based dongles will be compiled." ) + message(STATUS "You can disable it with 'cmake -DENABLE_RTLSDR=OFF ../'" ) # find libosmosdr (done in src/algorithms/signal_sources/adapters) # find gr-osmosdr (done in src/algorithms/signal_sources/adapters) -endif($ENV{RTLSDR_DRIVER} ) - +else(ENABLE_RTLSDR) + message(STATUS "The (optional) driver for RTL-based dongles is not enabled." ) + message(STATUS "Enable it with 'cmake -DENABLE_RTLSDR=ON ../' to add support for Realtek's RTL2832U-based USB dongles." ) +endif(ENABLE_RTLSDR) ######################################################################## @@ -825,13 +859,18 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) add_definitions(-fvisibility=hidden) endif() -# Set GPerftools related flags if it is available -# See http://gperftools.googlecode.com/svn/trunk/README -if(GPERFTOOLS_FOUND) - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) - set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") - endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) -endif(GPERFTOOLS_FOUND) +if(ENABLE_GPERFTOOLS) + # Set GPerftools related flags if it is available + # See http://gperftools.googlecode.com/svn/trunk/README + if(GPERFTOOLS_FOUND) + if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") + endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -fno-builtin") + endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + endif(GPERFTOOLS_FOUND) +endif(ENABLE_GPERFTOOLS) list(APPEND CMAKE_CXX_FLAGS ${MY_CXX_FLAGS}) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 269ad0fc4..6027298a9 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -18,7 +18,7 @@ # Optional drivers -if($ENV{GN3S_DRIVER}) +if(ENABLE_GN3S) ############################################## # GN3S (USB dongle) ############################################## @@ -49,12 +49,10 @@ if($ENV{GN3S_DRIVER}) file(COPY ${CMAKE_SOURCE_DIR}/firmware/GN3S_v2/bin/gn3s_firmware.ihx DESTINATION ${CMAKE_SOURCE_DIR}/install/ ) -endif($ENV{GN3S_DRIVER}) +endif(ENABLE_GN3S) -if($ENV{RAW_ARRAY_DRIVER}) - set(RAW_ARRAY_DRIVER ON) -endif($ENV{RAW_ARRAY_DRIVER}) -if(RAW_ARRAY_DRIVER) + +if(ENABLE_ARRAY) ############################################## # GRDBFCTTC GNSS EXPERIMENTAL ARRAY PROTOTYPE ############################################## @@ -82,13 +80,10 @@ if(RAW_ARRAY_DRIVER) set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GRDBFCTTC_LIBRARIES}) set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${GRDBFCTTC_INCLUDE_DIRS}) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} raw_array_signal_source.cc) -endif(RAW_ARRAY_DRIVER) +endif(ENABLE_ARRAY) -if($ENV{RTLSDR_DRIVER}) - set(RTLSDR_DRIVER ON) -endif($ENV{RTLSDR_DRIVER}) -if(RTLSDR_DRIVER) +if(ENABLE_RTLSDR) ################################################################################ # OsmoSDR - http://sdr.osmocom.org/trac/ ################################################################################ @@ -104,7 +99,7 @@ if(RTLSDR_DRIVER) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} rtlsdr_signal_source.cc) set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GROSMOSDR_LIBRARIES}) set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${RTL_DRIVER_INCLUDE_DIRS}) -endif(RTLSDR_DRIVER) +endif(ENABLE_RTLSDR) set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc gen_signal_source.cc diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 2b54995c2..4f4c0200a 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -65,37 +65,17 @@ include_directories( ) -#Enable GN3S module if the flag is present -if( $ENV{GN3S_DRIVER} ) - message(STATUS "Support for RF front-end GN3S v2 enabled" ) +if(ENABLE_GN3S) add_definitions(-DGN3S_DRIVER=1) -endif( $ENV{GN3S_DRIVER} ) -if( GN3S_DRIVER ) - message(STATUS "Support for RF front-end GN3S v2 enabled" ) - add_definitions(-DGN3S_DRIVER=1) -endif( GN3S_DRIVER ) +endif(ENABLE_GN3S) - -if( $ENV{RAW_ARRAY_DRIVER} ) - message(STATUS "Support for CTTC RAW ARRAY enabled" ) +if(ENABLE_ARRAY) add_definitions(-DRAW_ARRAY_DRIVER=1) -endif( $ENV{RAW_ARRAY_DRIVER} ) +endif(ENABLE_ARRAY) -if( RAW_ARRAY_DRIVER ) - message(STATUS "Support for CTTC RAW ARRAY enabled" ) - add_definitions(-DRAW_ARRAY_DRIVER=1) -endif( RAW_ARRAY_DRIVER ) - -#Enable RTL-SDR module if the flag is present -if( $ENV{RTLSDR_DRIVER} ) - message(STATUS "Support for RF front-end based on RTL dongle enabled" ) +if(ENABLE_RTLSDR) add_definitions(-DRTLSDR_DRIVER=1) -endif( $ENV{RTLSDR_DRIVER} ) - -if( RTLSDR_DRIVER ) - message(STATUS "Support for RF front-end based on RTL dongle enabled" ) - add_definitions(-DRTLSDR_DRIVER=1) -endif( RTLSDR_DRIVER ) +endif(ENABLE_RTLSDR) #Enable OpenCL if found in the system if(OPENCL_FOUND) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 2140b352e..c3765cded 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright (C) 2012-2013 (see AUTHORS file for a list of contributors) +# Copyright (C) 2012-2014 (see AUTHORS file for a list of contributors) # # This file is part of GNSS-SDR. # # GNSS-SDR 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 of the License, or -# at your option) any later version. +# (at your option) any later version. # # GNSS-SDR is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,6 +16,15 @@ # along with GNSS-SDR. If not, see . # +set(GNSS_SDR_OPTIONAL_LIBS "") +set(GNSS_SDR_OPTIONAL_HEADERS "") + +if(ENABLE_GPERFTOOLS) + if(GPERFTOOLS_FOUND) + set(GNSS_SDR_OPTIONAL_LIBS "${GNSS_SDR_OPTIONAL_LIBS};${GPERFTOOLS_LIBRARIES}") + set(GNSS_SDR_OPTIONAL_HEADERS "${GNSS_SDR_OPTIONAL_HEADERS};${GPERFTOOLS_INCLUDE_DIR}") + endif(GPERFTOOLS_FOUND) +endif(ENABLE_GPERFTOOLS) include_directories( ${CMAKE_SOURCE_DIR}/src/core/system_parameters @@ -30,6 +39,7 @@ include_directories( ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} + ${GNSS_SDR_OPTIONAL_HEADERS} ) add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) @@ -57,6 +67,7 @@ target_link_libraries(gnss-sdr ${MAC_LIBRARIES} ${UHD_LIBRARIES} gnss_sp_libs gnss_rx + ${GNSS_SDR_OPTIONAL_LIBS} ) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 568ee181e..5d38ed1e7 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) +# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors) # # This file is part of GNSS-SDR. # # GNSS-SDR 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 of the License, or -# at your option) any later version. +# (at your option) any later version. # # GNSS-SDR is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -89,6 +89,16 @@ else(NOT GTEST_DIR_LOCAL) endif(NOT GTEST_DIR_LOCAL) +set(GNSS_SDR_TEST_OPTIONAL_LIBS "") +set(GNSS_SDR_TEST_OPTIONAL_HEADERS "") + +if(ENABLE_GPERFTOOLS) + if(GPERFTOOLS_FOUND) + set(GNSS_SDR_TEST_OPTIONAL_LIBS "${GNSS_SDR_TEST_OPTIONAL_LIBS};${GPERFTOOLS_LIBRARIES}") + set(GNSS_SDR_TEST_OPTIONAL_HEADERS "${GNSS_SDR_TEST_OPTIONAL_HEADERS};${GPERFTOOLS_INCLUDE_DIR}") + endif(GPERFTOOLS_FOUND) +endif(ENABLE_GPERFTOOLS) + include_directories( ${GTEST_INCLUDE_DIRECTORIES} @@ -120,6 +130,7 @@ include_directories( ${Boost_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS} + ${GNSS_SDR_TEST_OPTIONAL_HEADERS} ) @@ -158,6 +169,7 @@ target_link_libraries(run_tests ${MAC_LIBRARIES} signal_generator_adapters out_adapters pvt_gr_blocks + ${GNSS_SDR_TEST_OPTIONAL_LIBS} ) install(TARGETS run_tests DESTINATION ${CMAKE_SOURCE_DIR}/install) diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index aa82e9fe5..5a4b1ae17 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright (C) 2012-2013 (see AUTHORS file for a list of contributors) +# Copyright (C) 2012-2014 (see AUTHORS file for a list of contributors) # # This file is part of GNSS-SDR. # # GNSS-SDR 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 of the License, or -# at your option) any later version. +# (at your option) any later version. # # GNSS-SDR is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,11 +17,7 @@ # -if($ENV{RTLSDR_DRIVER}) - set(RTLSDR_DRIVER ON) -endif($ENV{RTLSDR_DRIVER}) - -if(RTLSDR_DRIVER) +if(ENABLE_RTLSDR) set(FRONT_END_CAL_SOURCES front_end_cal.cc) include_directories( @@ -76,4 +72,4 @@ if(RTLSDR_DRIVER) DESTINATION ${CMAKE_SOURCE_DIR}/install ) -endif(RTLSDR_DRIVER) +endif(ENABLE_RTLSDR)