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) |
| 25 | project(gr-gsm CXX C) |
| 26 | enable_testing() |
| 27 | |
| 28 | #select the release build type by default to get optimization flags |
| 29 | if(NOT CMAKE_BUILD_TYPE) |
| 30 | set(CMAKE_BUILD_TYPE "Release") |
| 31 | message(STATUS "Build type not specified: defaulting to release.") |
| 32 | endif(NOT CMAKE_BUILD_TYPE) |
| 33 | set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") |
| 34 | |
| 35 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) |
| 36 | |
| 37 | ######################################################################## |
| 38 | # Compiler specific setup |
| 39 | ######################################################################## |
| 40 | if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) |
| 41 | #http://gcc.gnu.org/wiki/Visibility |
| 42 | add_definitions(-fvisibility=hidden) |
| 43 | endif() |
| 44 | |
| 45 | ######################################################################## |
| 46 | # Find boost |
| 47 | ######################################################################## |
| 48 | if(UNIX AND EXISTS "/usr/lib64") |
| 49 | list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix |
| 50 | endif(UNIX AND EXISTS "/usr/lib64") |
| 51 | set(Boost_ADDITIONAL_VERSIONS |
| 52 | "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" |
| 53 | "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" |
| 54 | "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" |
| 55 | "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" |
| 56 | "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" |
| 57 | "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" |
| 58 | "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" |
| 59 | ) |
| 60 | find_package(Boost "1.35" COMPONENTS filesystem system) |
| 61 | |
| 62 | if(NOT Boost_FOUND) |
| 63 | message(FATAL_ERROR "Boost required to compile gsm") |
| 64 | endif() |
| 65 | |
| 66 | ######################################################################## |
| 67 | # Install directories |
| 68 | ######################################################################## |
| 69 | include(GrPlatform) #define LIB_SUFFIX |
| 70 | set(GR_RUNTIME_DIR bin) |
| 71 | set(GR_LIBRARY_DIR lib${LIB_SUFFIX}) |
| 72 | set(GR_INCLUDE_DIR include/gsm) |
| 73 | set(GR_DATA_DIR share) |
| 74 | set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) |
| 75 | set(GR_DOC_DIR ${GR_DATA_DIR}/doc) |
| 76 | set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) |
| 77 | set(GR_CONF_DIR etc) |
| 78 | set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) |
| 79 | set(GR_LIBEXEC_DIR libexec) |
| 80 | set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) |
| 81 | set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) |
| 82 | |
| 83 | ######################################################################## |
| 84 | # Find gnuradio build dependencies |
| 85 | ######################################################################## |
| 86 | find_package(GnuradioRuntime) |
| 87 | find_package(CppUnit) |
| 88 | |
| 89 | # To run a more advanced search for GNU Radio and it's components and |
| 90 | # versions, use the following. Add any components required to the list |
| 91 | # of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the |
| 92 | # minimum API compatible version required. |
| 93 | # |
| 94 | # set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER ...) |
| 95 | # find_package(Gnuradio "version") |
| 96 | |
| 97 | if(NOT GNURADIO_RUNTIME_FOUND) |
| 98 | message(FATAL_ERROR "GnuRadio Runtime required to compile gsm") |
| 99 | endif() |
| 100 | if(NOT CPPUNIT_FOUND) |
| 101 | message(FATAL_ERROR "CppUnit required to compile gsm") |
| 102 | endif() |
| 103 | |
| 104 | ######################################################################## |
| 105 | # Setup the include and linker paths |
| 106 | ######################################################################## |
| 107 | include_directories( |
| 108 | ${CMAKE_SOURCE_DIR}/lib |
| 109 | ${CMAKE_SOURCE_DIR}/include |
| 110 | ${CMAKE_BINARY_DIR}/lib |
| 111 | ${CMAKE_BINARY_DIR}/include |
| 112 | ${Boost_INCLUDE_DIRS} |
| 113 | ${CPPUNIT_INCLUDE_DIRS} |
| 114 | ${GNURADIO_RUNTIME_INCLUDE_DIRS} |
| 115 | ) |
| 116 | |
| 117 | link_directories( |
| 118 | ${Boost_LIBRARY_DIRS} |
| 119 | ${CPPUNIT_LIBRARY_DIRS} |
| 120 | ${GNURADIO_RUNTIME_LIBRARY_DIRS} |
| 121 | ) |
| 122 | |
| 123 | # Set component parameters |
| 124 | set(GR_GSM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) |
| 125 | set(GR_GSM_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) |
| 126 | |
| 127 | ######################################################################## |
| 128 | # Create uninstall target |
| 129 | ######################################################################## |
| 130 | configure_file( |
| 131 | ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in |
| 132 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 133 | @ONLY) |
| 134 | |
| 135 | add_custom_target(uninstall |
| 136 | ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 137 | ) |
| 138 | |
| 139 | ######################################################################## |
| 140 | # Add subdirectories |
| 141 | ######################################################################## |
| 142 | add_subdirectory(include/gsm) |
| 143 | add_subdirectory(lib) |
| 144 | add_subdirectory(swig) |
| 145 | add_subdirectory(python) |
| 146 | add_subdirectory(grc) |
| 147 | add_subdirectory(apps) |
| 148 | add_subdirectory(docs) |
| 149 | |
| 150 | ######################################################################## |
| 151 | # Install cmake search helper for this library |
| 152 | ######################################################################## |
| 153 | install(FILES cmake/Modules/gsmConfig.cmake |
| 154 | DESTINATION lib/cmake/gsm |
| 155 | ) |