diff options
-rw-r--r-- | CMakeLists.txt | 136 | ||||
-rw-r--r-- | cmake/Modules/GrBoost.cmake | 4 | ||||
-rw-r--r-- | docs/doxygen/CMakeLists.txt | 4 | ||||
-rw-r--r-- | docs/doxygen/other/build_guide.dox.in (renamed from docs/doxygen/other/build_guide.dox) | 34 |
4 files changed, 123 insertions, 55 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f07e2c9e0..774f8e6b4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,16 +25,18 @@ endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) ######################################################################## # Project setup ######################################################################## +# Make sure this version matches ${GR_CMAKE_MIN_VERSION} (a variable can't be +# used here). cmake_minimum_required(VERSION 2.8.12) project(gnuradio CXX C) enable_testing() -#make sure our local CMake Modules path comes first +# Make sure our local CMake Modules path comes first list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) include(GrBuildTypes) -#select the release build type by default to get optimization flags +# Select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") message(STATUS "Build type not specified: defaulting to release.") @@ -50,41 +52,23 @@ set(VERSION_INFO_MINOR_VERSION git) set(VERSION_INFO_MAINT_VERSION 0) include(GrVersion) #setup version info -# Append -O2 optimization flag for Debug builds (Not on MSVC since conflicts with RTC1 flag) -IF (NOT MSVC) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2") -ENDIF() +# Minimum dependency versions for central dependencies: +set(GR_BOOST_MIN_VERSION "1.48") +set(GR_SWIG_MIN_VERSION "2.0.3") +set(GR_CMAKE_MIN_VERSION "2.8.12") +set(GR_MAKO_MIN_VERSION "0.4.2") +set(GR_PYTHON_MIN_VERSION "2.7") +#set(GR_PYTHON3_MIN_VERSION "3.x") # Py3k not yet supported +set(GR_CPPUNIT_MIN_VERSION "1.12.1") +set(GCC_MIN_VERSION "4.4.0") +set(CLANG_MIN_VERSION "3.3.0") +set(APPLECLANG_MIN_VERSION "500") -# Set C/C++ standard for all targets -# NOTE: Starting with cmake v3.1 this should be used: -# set(CMAKE_C_STANDARD 90) -# set(CMAKE_CXX_STANDARD 98) - -IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") -ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") -ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") -ELSE() - message(warning "C++ standard could not be set because compiler is not GNU, Clang or MSVC.") -ENDIF() - -IF(CMAKE_C_COMPILER_ID STREQUAL "GNU") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") -ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") -ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") -ELSE() - message(warning "C standard could not be set because compiler is not GNU, Clang or MSVC.") -ENDIF() - -# Set cmake policies. +######################################################################## +# Configure CMake policies +######################################################################## # This will suppress developer warnings during the cmake process that can occur # if a newer cmake version than the minimum is used. - if(POLICY CMP0026) cmake_policy(SET CMP0026 OLD) endif() @@ -99,6 +83,81 @@ if(POLICY CMP0046) endif() ######################################################################## +# Compiler version setup +######################################################################## +# Append -O2 optimization flag for Debug builds (Not on MSVC since conflicts with RTC1 flag) +IF (NOT MSVC) + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2") +ENDIF() + +# Check compiler version against our minimum +IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + IF(DEFINED CMAKE_CXX_COMPILER_VERSION) + IF(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS ${GCC_MIN_VERSION}) + MESSAGE(WARNING "\nThe compiler selected to build GNU Radio (GCC version ${CMAKE_CXX_COMPILER_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${GCC_MIN_VERSION} minimum). This build may or not work. We highly recommend using a more recent GCC version.") + ENDIF() + ELSE() + MESSAGE(WARNING "\nCannot determine the version of the compiler selected to build GNU Radio (GCC : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using GCC version ${GCC_MIN_VERSION} or more recent.") + ENDIF() +ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + EXECUTE_PROCESS(COMMAND + ${CMAKE_CXX_COMPILER} -v + RESULT_VARIABLE _res ERROR_VARIABLE _err + ERROR_STRIP_TRAILING_WHITESPACE) + IF(${_res} STREQUAL "0") + # output is in error stream + STRING(REGEX MATCH "^Apple.*" IS_APPLE ${_err}) + IF("${IS_APPLE}" STREQUAL "") + SET(MIN_VERSION ${CLANG_MIN_VERSION}) + SET(APPLE_STR "") + # retrieve the compiler's version from it + STRING(REGEX MATCH "clang version [0-9.]+" CLANG_OTHER_VERSION ${_err}) + STRING(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_OTHER_VERSION}) + ELSE() + SET(MIN_VERSION ${APPLECLANG_MIN_VERSION}) + SET(APPLE_STR "Apple ") + # retrieve the compiler's version from it + STRING(REGEX MATCH "(clang-[0-9.]+)" CLANG_APPLE_VERSION ${_err}) + STRING(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_APPLE_VERSION}) + ENDIF() + IF(${CLANG_VERSION} VERSION_LESS "${MIN_VERSION}") + MESSAGE(WARNING "\nThe compiler selected to build GNU Radio (${APPLE_STR}Clang version ${CLANG_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${MIN_VERSION} minimum). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.") + ENDIF() + ELSE() + MESSAGE(WARNING "\nCannot determine the version of the compiler selected to build GNU Radio (${APPLE_STR}Clang : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.") + ENDIF() +ELSE() + MESSAGE(status "Skipping compiler version check.") +ENDIF() + +# Configure C++ and C standards +IF(CMAKE_VERSION VERSION_LESS "3.1") + IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") + ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") + ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") + ELSE() + MESSAGE(warning "C++ standard could not be set because compiler is not GNU, Clang or MSVC.") + ENDIF() + + IF(CMAKE_C_COMPILER_ID STREQUAL "GNU") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") + ELSE() + MESSAGE(warning "C standard could not be set because compiler is not GNU, Clang or MSVC.") + ENDIF() +ELSE() + SET(CMAKE_C_STANDARD 90) + SET(CMAKE_CXX_STANDARD 98) +ENDIF() + +######################################################################## # Environment setup ######################################################################## IF(NOT DEFINED BOOST_ROOT) @@ -283,15 +342,12 @@ include(GrBoost) ######################################################################## # Enable python component ######################################################################## -find_package(PythonLibs 2) +find_package(PythonLibs ${GR_PYTHON_MIN_VERSION}) find_package(SWIG) if(SWIG_FOUND) - # Minimum SWIG version required is 2.0.4 - # Recommended revisit: EOL of Ubuntu 12.04 LTS, bump to 2.0.7 - # see https://github.com/gnuradio/gnuradio/issues/1222 set(SWIG_VERSION_CHECK FALSE) - if("${SWIG_VERSION}" VERSION_GREATER "2.0.3") + if("${SWIG_VERSION}" VERSION_GREATER ${GR_SWIG_MIN_VERSION}) set(SWIG_VERSION_CHECK TRUE) endif() endif(SWIG_FOUND) @@ -303,7 +359,7 @@ GR_REGISTER_COMPONENT("python-support" ENABLE_PYTHON SWIG_VERSION_CHECK ) -find_package(CppUnit) +find_package(CppUnit ${GR_CPPUNIT_MIN_VERSION}) GR_REGISTER_COMPONENT("testing-support" ENABLE_TESTING CPPUNIT_FOUND ) diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake index 39a78c5b86..150009a7b9 100644 --- a/cmake/Modules/GrBoost.cmake +++ b/cmake/Modules/GrBoost.cmake @@ -68,15 +68,13 @@ if(MSVC) endif(BOOST_ALL_DYN_LINK) endif(MSVC) -find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) +find_package(Boost ${GR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) # This does not allow us to disable specific versions. It is used # internally by cmake to know the formation newer versions. As newer # Boost version beyond what is shown here are produced, we must extend # this list. To disable Boost versions, see below. set(Boost_ADDITIONAL_VERSIONS - "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" - "1.40.0" "1.40" "1.41.0" "1.41" "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.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt index d22f9d9f62..83a9ee29ed 100644 --- a/docs/doxygen/CMakeLists.txt +++ b/docs/doxygen/CMakeLists.txt @@ -34,6 +34,10 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/other/build_guide.dox.in + ${CMAKE_CURRENT_BINARY_DIR}/other/build_guide.dox +@ONLY) set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html) diff --git a/docs/doxygen/other/build_guide.dox b/docs/doxygen/other/build_guide.dox.in index bbcb7c7d4a..d729e19976 100644 --- a/docs/doxygen/other/build_guide.dox +++ b/docs/doxygen/other/build_guide.dox.in @@ -16,8 +16,8 @@ if any, to build the various GNU Radio components. Most of these components do not need to be individually compiled or installed. Instead, rely on your operating system's package manager or -binary installation process (the <b>apt-get</b> system in Debian and -Ubuntu, <b>yum</b> in RedHat and Fedora, etc.). GNU Radio tries to keep an +binary installation process (the <b>apt-get</b> or \b apt system in Debian and +Ubuntu, <b>yum</b> or \b dnf in RedHat and Fedora, etc.). GNU Radio tries to keep an up-to-date build guide for the majority of the supported operating systems on gnuradio.org (http://gnuradio.org/redmine/projects/gnuradio/wiki/BuildGuide). @@ -33,17 +33,24 @@ installation tool (apt-get, pkg_install, YaST, yum, urpmi, etc.) first. Most recent systems have these packages available. \subsection dep_global Global Dependencies -\li git http://git-scm.com/downloads -\li cmake (>= 2.6.3) http://www.cmake.org/cmake/resources/software.html -\li boost (>= 1.35) http://www.boost.org/users/download/ -\li cppunit (>= 1.9.14) http://freedesktop.org/wiki/Software/cppunit/ -\li fftw3f (>= 3.0.1) http://www.fftw.org/download.html -\li mako (>= 0.4.2) http://www.makotemplates.org/download.html + +\li git http://git-scm.com/downloads +\li cmake (>= @GR_CMAKE_MIN_VERSION@) http://www.cmake.org/cmake/resources/software.html +\li boost (>= @GR_BOOST_MIN_VERSION@) http://www.boost.org/users/download/ +\li cppunit (>= @GR_CPPUNIT_MIN_VERSION@) http://freedesktop.org/wiki/Software/cppunit/ +\li mako (>= @GR_MAKO_MIN_VERSION@) http://www.makotemplates.org/download.html + +A C/C++ compiler is also required. These are known to work: + +\li gcc/g++ (>= @GCC_MIN_VERSION@) https://gcc.gnu.org/install/download.html +\li clang/clang++ (>= @CLANG_MIN_VERSION@) http://releases.llvm.org/download.html + +Other compilers may work, but are not supported. \subsection dep_python Python Wrappers -\li python (>= 2.5) http://www.python.org/download/ -\li swig (>= 1.3.31) http://www.swig.org/download.html -\li numpy (>= 1.1.0) http://sourceforge.net/projects/numpy/files/NumPy/ +\li python (>= @GR_PYTHON_MIN_VERSION@) http://www.python.org/download/ +\li swig (>= @GR_SWIG_MIN_VERSION@) http://www.swig.org/download.html +\li numpy (>= 1.1.0) http://sourceforge.net/projects/numpy/files/NumPy/ \subsection dep_docs docs: Building the documentation \li doxygen (>= 1.5) http://www.stack.nl/~dimitri/doxygen/download.html @@ -53,6 +60,9 @@ first. Most recent systems have these packages available. \li Cheetah (>= 2.0) http://www.cheetahtemplate.org/ \li pygtk (>= 2.10) http://www.pygtk.org/downloads.html +\subsection dep_fft gr-fft: Fast Frequency Transform +\li fftw3f (>= 3.0.1) http://www.fftw.org/download.html + \subsection dep_wavelet gr-wavelet: Collection of wavelet blocks \li gsl (>= 1.10) http://gnuwin32.sourceforge.net/packages/gsl.htm @@ -78,7 +88,7 @@ one(s) that are right for your system. On Linux, don't expect audio-osx and audio-windows to be either satisfied or built. \subsection dep_uhd uhd: The Ettus USRP Hardware Driver Interface -\li uhd (>= 3.0.0) http://code.ettus.com/redmine/ettus/projects/uhd/wiki +\li uhd (>= 3.5.5) https://www.ettus.com/downloads \subsection dep_gr_video_sdl gr-video-sdl: PAL and NTSC display \li SDL (>= 1.2.0) http://www.libsdl.org/download-1.2.php |