piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 1 | # Copyright 2011,2012 Free Software Foundation, Inc. |
| 2 | # |
| 3 | # This file is part of GNU Radio |
| 4 | # |
| 5 | # GNU Radio is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; either version 3, or (at your option) |
| 8 | # any later version. |
| 9 | # |
| 10 | # GNU Radio is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with GNU Radio; see the file COPYING. If not, write to |
| 17 | # the Free Software Foundation, Inc., 51 Franklin Street, |
| 18 | # Boston, MA 02110-1301, USA. |
| 19 | |
| 20 | |
| 21 | ######################################################################## |
| 22 | # Project setup |
| 23 | ######################################################################## |
| 24 | cmake_minimum_required(VERSION 2.6) |
ptrkrysik | a25b830 | 2015-05-08 08:59:17 +0200 | [diff] [blame] | 25 | project(gr-grgsm CXX C) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 26 | enable_testing() |
| 27 | |
ptrkrysik | 5821379 | 2014-10-30 09:05:15 +0100 | [diff] [blame] | 28 | #set(CMAKE_BUILD_TYPE "Debug") |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 29 | #select the release build type by default to get optimization flags |
| 30 | if(NOT CMAKE_BUILD_TYPE) |
| 31 | set(CMAKE_BUILD_TYPE "Release") |
| 32 | message(STATUS "Build type not specified: defaulting to release.") |
| 33 | endif(NOT CMAKE_BUILD_TYPE) |
| 34 | set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") |
| 35 | |
| 36 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) |
| 37 | |
| 38 | ######################################################################## |
| 39 | # Compiler specific setup |
| 40 | ######################################################################## |
| 41 | if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) |
| 42 | #http://gcc.gnu.org/wiki/Visibility |
| 43 | add_definitions(-fvisibility=hidden) |
| 44 | endif() |
| 45 | |
| 46 | ######################################################################## |
| 47 | # Find boost |
| 48 | ######################################################################## |
| 49 | if(UNIX AND EXISTS "/usr/lib64") |
| 50 | list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix |
| 51 | endif(UNIX AND EXISTS "/usr/lib64") |
| 52 | set(Boost_ADDITIONAL_VERSIONS |
| 53 | "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" |
| 54 | "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" |
| 55 | "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" |
| 56 | "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" |
| 57 | "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" |
| 58 | "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" |
| 59 | "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" |
| 60 | ) |
Martin Jesper Low Madsen | f3105d9 | 2015-06-24 13:33:56 +0200 | [diff] [blame] | 61 | find_package(Boost "1.35" COMPONENTS filesystem system thread) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 62 | |
| 63 | if(NOT Boost_FOUND) |
ptrkrysik | 3c73810 | 2015-04-04 12:20:50 +0200 | [diff] [blame] | 64 | message(FATAL_ERROR "Boost required to compile gr-gsm") |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 65 | endif() |
| 66 | |
| 67 | ######################################################################## |
| 68 | # Install directories |
| 69 | ######################################################################## |
| 70 | include(GrPlatform) #define LIB_SUFFIX |
| 71 | set(GR_RUNTIME_DIR bin) |
| 72 | set(GR_LIBRARY_DIR lib${LIB_SUFFIX}) |
ptrkrysik | 3be74a7 | 2014-12-13 10:11:00 +0100 | [diff] [blame] | 73 | set(GR_INCLUDE_DIR include/grgsm) |
ptrkrysik | 3c73810 | 2015-04-04 12:20:50 +0200 | [diff] [blame] | 74 | set(GR_INCLUDE_DIR include/grgsm/misc_utils) |
ptrkrysik | 3be74a7 | 2014-12-13 10:11:00 +0100 | [diff] [blame] | 75 | set(GR_INCLUDE_DIR include/grgsm/receiver) |
| 76 | set(GR_INCLUDE_DIR include/grgsm/demapping) |
| 77 | set(GR_INCLUDE_DIR include/grgsm/decoding) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 78 | set(GR_DATA_DIR share) |
| 79 | set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) |
| 80 | set(GR_DOC_DIR ${GR_DATA_DIR}/doc) |
| 81 | set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) |
| 82 | set(GR_CONF_DIR etc) |
| 83 | set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) |
| 84 | set(GR_LIBEXEC_DIR libexec) |
| 85 | set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) |
| 86 | set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) |
| 87 | |
| 88 | ######################################################################## |
| 89 | # Find gnuradio build dependencies |
| 90 | ######################################################################## |
David Holm | c7f2682 | 2014-12-03 22:18:12 +0100 | [diff] [blame] | 91 | set(GR_REQUIRED_COMPONENTS RUNTIME PMT) |
| 92 | find_package(Gnuradio) |
ptrkrysik | aea7f34 | 2014-12-03 00:37:57 +0100 | [diff] [blame] | 93 | find_package(Volk) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 94 | find_package(CppUnit) |
ptrkrysik | 3543384 | 2014-08-14 14:56:16 +0200 | [diff] [blame] | 95 | find_package(Doxygen) |
Roman Khassraf | 9c58846 | 2015-07-17 13:57:24 +0200 | [diff] [blame] | 96 | find_package(Libosmocore) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 97 | |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 98 | if(NOT GNURADIO_RUNTIME_FOUND) |
ptrkrysik | 3c73810 | 2015-04-04 12:20:50 +0200 | [diff] [blame] | 99 | message(FATAL_ERROR "GnuRadio Runtime required to compile gr-gsm") |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 100 | endif() |
ptrkrysik | aea7f34 | 2014-12-03 00:37:57 +0100 | [diff] [blame] | 101 | if(NOT VOLK_FOUND) |
ptrkrysik | 3c73810 | 2015-04-04 12:20:50 +0200 | [diff] [blame] | 102 | message(FATAL_ERROR "Volk library required to compile gr-gsm") |
ptrkrysik | aea7f34 | 2014-12-03 00:37:57 +0100 | [diff] [blame] | 103 | endif() |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 104 | if(NOT CPPUNIT_FOUND) |
ptrkrysik | 3c73810 | 2015-04-04 12:20:50 +0200 | [diff] [blame] | 105 | message(FATAL_ERROR "CppUnit required to compile gr-gsm") |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 106 | endif() |
Roman Khassraf | 9c58846 | 2015-07-17 13:57:24 +0200 | [diff] [blame] | 107 | if(NOT LIBOSMOCORE_FOUND) |
| 108 | message(FATAL_ERROR "Libosmocore required to compile gr-gsm") |
| 109 | endif() |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 110 | |
| 111 | ######################################################################## |
ptrkrysik | 3543384 | 2014-08-14 14:56:16 +0200 | [diff] [blame] | 112 | # Setup doxygen option |
| 113 | ######################################################################## |
| 114 | if(DOXYGEN_FOUND) |
| 115 | option(ENABLE_DOXYGEN "Build docs using Doxygen" ON) |
| 116 | else(DOXYGEN_FOUND) |
| 117 | option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF) |
| 118 | endif(DOXYGEN_FOUND) |
| 119 | |
| 120 | ######################################################################## |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 121 | # Setup the include and linker paths |
| 122 | ######################################################################## |
| 123 | include_directories( |
| 124 | ${CMAKE_SOURCE_DIR}/lib |
| 125 | ${CMAKE_SOURCE_DIR}/include |
| 126 | ${CMAKE_BINARY_DIR}/lib |
| 127 | ${CMAKE_BINARY_DIR}/include |
| 128 | ${Boost_INCLUDE_DIRS} |
| 129 | ${CPPUNIT_INCLUDE_DIRS} |
| 130 | ${GNURADIO_RUNTIME_INCLUDE_DIRS} |
Roman Khassraf | 9c58846 | 2015-07-17 13:57:24 +0200 | [diff] [blame] | 131 | ${LIBOSMOCORE_INCLUDE_DIR} |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 132 | ) |
| 133 | |
| 134 | link_directories( |
| 135 | ${Boost_LIBRARY_DIRS} |
| 136 | ${CPPUNIT_LIBRARY_DIRS} |
| 137 | ${GNURADIO_RUNTIME_LIBRARY_DIRS} |
| 138 | ) |
| 139 | |
| 140 | # Set component parameters |
| 141 | set(GR_GSM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) |
| 142 | set(GR_GSM_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) |
| 143 | |
| 144 | ######################################################################## |
| 145 | # Create uninstall target |
| 146 | ######################################################################## |
| 147 | configure_file( |
| 148 | ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in |
| 149 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 150 | @ONLY) |
| 151 | |
| 152 | add_custom_target(uninstall |
| 153 | ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 154 | ) |
| 155 | |
| 156 | ######################################################################## |
| 157 | # Add subdirectories |
| 158 | ######################################################################## |
ptrkrysik | 3c73810 | 2015-04-04 12:20:50 +0200 | [diff] [blame] | 159 | add_subdirectory(include/grgsm) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 160 | add_subdirectory(lib) |
| 161 | add_subdirectory(swig) |
| 162 | add_subdirectory(python) |
| 163 | add_subdirectory(grc) |
| 164 | add_subdirectory(apps) |
| 165 | add_subdirectory(docs) |
| 166 | |
| 167 | ######################################################################## |
| 168 | # Install cmake search helper for this library |
| 169 | ######################################################################## |
Martin Jesper Low Madsen | f3105d9 | 2015-06-24 13:33:56 +0200 | [diff] [blame] | 170 | install(FILES cmake/Modules/gr-gsmConfig.cmake |
ptrkrysik | ec6306b | 2014-12-13 11:40:35 +0100 | [diff] [blame] | 171 | DESTINATION lib${LIB_SUFFIX}/cmake/grgsm |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 172 | ) |