|
| 1 | +# |
| 2 | +# Copyright 2013 Free Software Foundation, Inc. |
| 3 | +# |
| 4 | +# This program is free software: you can redistribute it and/or modify |
| 5 | +# it under the terms of the GNU General Public License as published by |
| 6 | +# the Free Software Foundation, either version 3 of the License, or |
| 7 | +# (at your option) any later version. |
| 8 | +# |
| 9 | +# This program is distributed in the hope that it will be useful, |
| 10 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +# GNU General Public License for more details. |
| 13 | +# |
| 14 | +# You should have received a copy of the GNU General Public License |
| 15 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | +# |
| 17 | +######################################################################## |
| 18 | +# Project setup |
| 19 | +######################################################################## |
| 20 | +cmake_minimum_required(VERSION 2.6) |
| 21 | +project(gr-ieee802-11 CXX C) |
| 22 | +enable_testing() |
| 23 | + |
| 24 | +#select the release build type by default to get optimization flags |
| 25 | +if(NOT CMAKE_BUILD_TYPE) |
| 26 | + set(CMAKE_BUILD_TYPE "Release") |
| 27 | + message(STATUS "Build type not specified: defaulting to release.") |
| 28 | +endif(NOT CMAKE_BUILD_TYPE) |
| 29 | +set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") |
| 30 | + |
| 31 | +list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) |
| 32 | + |
| 33 | +######################################################################## |
| 34 | +# Compiler specific setup |
| 35 | +######################################################################## |
| 36 | +if(NOT WIN32) |
| 37 | + #http://gcc.gnu.org/wiki/Visibility |
| 38 | + add_definitions(-fvisibility=hidden) |
| 39 | + add_definitions(-std=c++0x) |
| 40 | +endif() |
| 41 | + |
| 42 | +######################################################################## |
| 43 | +# Find boost |
| 44 | +######################################################################## |
| 45 | +if(UNIX AND EXISTS "/usr/lib64") |
| 46 | + list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix |
| 47 | +endif(UNIX AND EXISTS "/usr/lib64") |
| 48 | +set(Boost_ADDITIONAL_VERSIONS |
| 49 | + "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" |
| 50 | + "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" |
| 51 | + "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" |
| 52 | + "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" |
| 53 | + "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" |
| 54 | + "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" |
| 55 | + "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" |
| 56 | +) |
| 57 | +find_package(Boost "1.35" COMPONENTS filesystem system) |
| 58 | + |
| 59 | +if(NOT Boost_FOUND) |
| 60 | + message(FATAL_ERROR "Boost required to compile ieee802-11") |
| 61 | +endif() |
| 62 | + |
| 63 | +######################################################################## |
| 64 | +# Install directories |
| 65 | +######################################################################## |
| 66 | +include(GrPlatform) #define LIB_SUFFIX |
| 67 | +set(GR_RUNTIME_DIR bin) |
| 68 | +set(GR_LIBRARY_DIR lib${LIB_SUFFIX}) |
| 69 | +set(GR_INCLUDE_DIR include/ieee802-11) |
| 70 | +set(GR_DATA_DIR share) |
| 71 | +set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) |
| 72 | +set(GR_DOC_DIR ${GR_DATA_DIR}/doc) |
| 73 | +set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) |
| 74 | +set(GR_CONF_DIR etc) |
| 75 | +set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) |
| 76 | +set(GR_LIBEXEC_DIR libexec) |
| 77 | +set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) |
| 78 | +set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) |
| 79 | + |
| 80 | +######################################################################## |
| 81 | +# Find gnuradio build dependencies |
| 82 | +######################################################################## |
| 83 | +set(GR_REQUIRED_COMPONENTS RUNTIME FILTER FFT PMT DIGITAL) |
| 84 | +find_package(Gnuradio) |
| 85 | +find_package(CppUnit) |
| 86 | +find_package(ITPP) |
| 87 | + |
| 88 | +if(NOT GNURADIO_RUNTIME_FOUND) |
| 89 | + message(FATAL_ERROR "GnuRadio Runtime required to compile ieee802-11") |
| 90 | +endif() |
| 91 | + |
| 92 | +if(NOT CPPUNIT_FOUND) |
| 93 | + message(FATAL_ERROR "CppUnit required to compile ieee802-11") |
| 94 | +endif() |
| 95 | + |
| 96 | +if(NOT ITPP_FOUND) |
| 97 | + message(FATAL_ERROR "ITPP required to compile ieee802-11") |
| 98 | +endif() |
| 99 | + |
| 100 | +######################################################################## |
| 101 | +# Setup logging options |
| 102 | +######################################################################## |
| 103 | + |
| 104 | +include(GrMiscUtils) |
| 105 | +GR_LOGGING() |
| 106 | + |
| 107 | +######################################################################## |
| 108 | +# On Apple only, set install name and use rpath correctly, if not already set |
| 109 | +######################################################################## |
| 110 | +if(APPLE) |
| 111 | + if(NOT CMAKE_INSTALL_NAME_DIR) |
| 112 | + set(CMAKE_INSTALL_NAME_DIR |
| 113 | + ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE |
| 114 | + PATH "Library Install Name Destination Directory" FORCE) |
| 115 | + endif(NOT CMAKE_INSTALL_NAME_DIR) |
| 116 | + if(NOT CMAKE_INSTALL_RPATH) |
| 117 | + set(cmakE_INSTALL_RPATH |
| 118 | + ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE |
| 119 | + PATH "Library Install RPath" FORCE) |
| 120 | + endif(NOT CMAKE_INSTALL_RPATH) |
| 121 | + if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) |
| 122 | + set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE |
| 123 | + BOOL "Do Build Using Library Install RPath" FORCE) |
| 124 | + endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) |
| 125 | +endif(APPLE) |
| 126 | + |
| 127 | +######################################################################## |
| 128 | +# Setup the include and linker paths |
| 129 | +######################################################################## |
| 130 | +include_directories( |
| 131 | + ${CMAKE_SOURCE_DIR}/include |
| 132 | + ${CMAKE_SOURCE_DIR}/lib |
| 133 | + ${CMAKE_BINARY_DIR}/include |
| 134 | + ${Boost_INCLUDE_DIRS} |
| 135 | + ${CPPUNIT_INCLUDE_DIRS} |
| 136 | + ${ITPP_INCLUDE_DIR} |
| 137 | + ${GNURADIO_RUNTIME_INCLUDE_DIRS} |
| 138 | + ${LOG4CPP_INCLUDE_DIRS} |
| 139 | +) |
| 140 | + |
| 141 | +link_directories( |
| 142 | + ${Boost_LIBRARY_DIRS} |
| 143 | + ${CPPUNIT_LIBRARY_DIRS} |
| 144 | + ${GNURADIO_RUNTIME_LIBRARY_DIRS} |
| 145 | + ${LOG4CPP_LIBRARY_DIRS} |
| 146 | +) |
| 147 | + |
| 148 | +######################################################################## |
| 149 | +# Create uninstall target |
| 150 | +######################################################################## |
| 151 | +configure_file( |
| 152 | + ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in |
| 153 | + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 154 | +@ONLY) |
| 155 | + |
| 156 | +add_custom_target(uninstall |
| 157 | + ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 158 | +) |
| 159 | + |
| 160 | +######################################################################## |
| 161 | +# Add subdirectories |
| 162 | +######################################################################## |
| 163 | +add_subdirectory(include/ieee802-11) |
| 164 | +add_subdirectory(lib) |
| 165 | +add_subdirectory(swig) |
| 166 | +add_subdirectory(python) |
| 167 | +add_subdirectory(grc) |
0 commit comments