blob: 39e078b9db539617bc2b8af8b5a9377020543ffc [file] [log] [blame]
piotr437f5462014-02-04 17:57:25 +01001# 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########################################################################
24cmake_minimum_required(VERSION 2.6)
25project(gr-gsm CXX C)
26enable_testing()
27
ptrkrysik58213792014-10-30 09:05:15 +010028#set(CMAKE_BUILD_TYPE "Debug")
piotr437f5462014-02-04 17:57:25 +010029#select the release build type by default to get optimization flags
30if(NOT CMAKE_BUILD_TYPE)
31 set(CMAKE_BUILD_TYPE "Release")
32 message(STATUS "Build type not specified: defaulting to release.")
33endif(NOT CMAKE_BUILD_TYPE)
34set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
35
36list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
37
38########################################################################
39# Compiler specific setup
40########################################################################
41if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
42 #http://gcc.gnu.org/wiki/Visibility
43 add_definitions(-fvisibility=hidden)
44endif()
45
46########################################################################
47# Find boost
48########################################################################
49if(UNIX AND EXISTS "/usr/lib64")
50 list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
51endif(UNIX AND EXISTS "/usr/lib64")
52set(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)
61find_package(Boost "1.35" COMPONENTS filesystem system)
62
63if(NOT Boost_FOUND)
64 message(FATAL_ERROR "Boost required to compile gsm")
65endif()
66
67########################################################################
68# Install directories
69########################################################################
70include(GrPlatform) #define LIB_SUFFIX
71set(GR_RUNTIME_DIR bin)
72set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
73set(GR_INCLUDE_DIR include/gsm)
ptrkrysik4c825772014-08-16 11:34:54 +020074set(GR_INCLUDE_DIR include/gsm/misc_utils)
75set(GR_INCLUDE_DIR include/gsm/receiver)
76set(GR_INCLUDE_DIR include/gsm/demapping)
77set(GR_INCLUDE_DIR include/gsm/decoding)
piotr437f5462014-02-04 17:57:25 +010078set(GR_DATA_DIR share)
79set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
80set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
81set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
82set(GR_CONF_DIR etc)
83set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
84set(GR_LIBEXEC_DIR libexec)
85set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
86set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
87
88########################################################################
89# Find gnuradio build dependencies
90########################################################################
91find_package(GnuradioRuntime)
ptrkrysikaea7f342014-12-03 00:37:57 +010092find_package(Volk)
piotr437f5462014-02-04 17:57:25 +010093find_package(CppUnit)
ptrkrysik35433842014-08-14 14:56:16 +020094find_package(Doxygen)
piotr437f5462014-02-04 17:57:25 +010095
96# To run a more advanced search for GNU Radio and it's components and
97# versions, use the following. Add any components required to the list
98# of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the
99# minimum API compatible version required.
100#
101# set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER ...)
102# find_package(Gnuradio "version")
103
104if(NOT GNURADIO_RUNTIME_FOUND)
105 message(FATAL_ERROR "GnuRadio Runtime required to compile gsm")
106endif()
ptrkrysikaea7f342014-12-03 00:37:57 +0100107if(NOT VOLK_FOUND)
108 message(FATAL_ERROR "Volk library required to compile gsm")
109endif()
piotr437f5462014-02-04 17:57:25 +0100110if(NOT CPPUNIT_FOUND)
111 message(FATAL_ERROR "CppUnit required to compile gsm")
112endif()
113
114########################################################################
ptrkrysik35433842014-08-14 14:56:16 +0200115# Setup doxygen option
116########################################################################
117if(DOXYGEN_FOUND)
118 option(ENABLE_DOXYGEN "Build docs using Doxygen" ON)
119else(DOXYGEN_FOUND)
120 option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF)
121endif(DOXYGEN_FOUND)
122
123########################################################################
piotr437f5462014-02-04 17:57:25 +0100124# Setup the include and linker paths
125########################################################################
126include_directories(
127 ${CMAKE_SOURCE_DIR}/lib
128 ${CMAKE_SOURCE_DIR}/include
129 ${CMAKE_BINARY_DIR}/lib
130 ${CMAKE_BINARY_DIR}/include
131 ${Boost_INCLUDE_DIRS}
132 ${CPPUNIT_INCLUDE_DIRS}
133 ${GNURADIO_RUNTIME_INCLUDE_DIRS}
134)
135
136link_directories(
137 ${Boost_LIBRARY_DIRS}
138 ${CPPUNIT_LIBRARY_DIRS}
139 ${GNURADIO_RUNTIME_LIBRARY_DIRS}
140)
141
142# Set component parameters
143set(GR_GSM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
144set(GR_GSM_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
145
146########################################################################
147# Create uninstall target
148########################################################################
149configure_file(
150 ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
151 ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
152@ONLY)
153
154add_custom_target(uninstall
155 ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
156)
157
158########################################################################
159# Add subdirectories
160########################################################################
161add_subdirectory(include/gsm)
piotrbf2d9a42014-04-17 10:58:09 +0200162add_subdirectory(include/plotting)
piotr437f5462014-02-04 17:57:25 +0100163add_subdirectory(lib)
164add_subdirectory(swig)
165add_subdirectory(python)
166add_subdirectory(grc)
167add_subdirectory(apps)
168add_subdirectory(docs)
169
170########################################################################
171# Install cmake search helper for this library
172########################################################################
173install(FILES cmake/Modules/gsmConfig.cmake
174 DESTINATION lib/cmake/gsm
175)