blob: e7dae1484d23a3d49cc80a6aa4f35d36d33500df [file] [log] [blame]
Vasil Velichkov1789ae22019-08-13 20:32:05 +00001# Copyright 2011,2012,2016,2018,2019 Free Software Foundation, Inc.
piotr437f5462014-02-04 17:57:25 +01002#
Vasil Velichkov1789ae22019-08-13 20:32:05 +00003# This file was generated by gr_modtool, a tool from the GNU Radio framework
4# This file is a part of gr-gsm
piotr437f5462014-02-04 17:57:25 +01005#
6# GNU Radio is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3, or (at your option)
9# any later version.
10#
11# GNU Radio is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with GNU Radio; see the file COPYING. If not, write to
18# the Free Software Foundation, Inc., 51 Franklin Street,
19# Boston, MA 02110-1301, USA.
20
Vasil Velichkov1789ae22019-08-13 20:32:05 +000021########################################################################
22# Setup library
23########################################################################
piotr437f5462014-02-04 17:57:25 +010024include(GrPlatform) #define LIB_SUFFIX
Piotr Krysikbb961c12017-08-24 15:35:42 +020025
26########################################################################
Piotr Krysik0945cc52017-09-13 09:17:50 +020027# Add sources macro
28########################################################################
29set(grgsm_sources "")
30
31macro (add_sources)
32 file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}/lib" "${CMAKE_CURRENT_SOURCE_DIR}")
33 foreach (_src ${ARGN})
34 if (_relPath)
35 list (APPEND grgsm_sources "${_relPath}/${_src}")
36 else()
37 list (APPEND grgsm_sources "${_src}")
38 endif()
39 endforeach()
40 if (_relPath)
41 # propagate grgsm_sources to parent directory
42 set (grgsm_sources ${grgsm_sources} PARENT_SCOPE)
43 endif()
44endmacro()
45
46########################################################################
Piotr Krysikbb961c12017-08-24 15:35:42 +020047# Handle the generated constants
48########################################################################
49execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
Vasil Velichkov1789ae22019-08-13 20:32:05 +000050 "import time;print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))"
Piotr Krysikbb961c12017-08-24 15:35:42 +020051 OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
52)
53message(STATUS "Loading build date ${BUILD_DATE} into constants...")
54message(STATUS "Loading version ${VERSION} into constants...")
55
56#double escape for windows backslash path separators
57string(REPLACE "\\" "\\\\" prefix "${prefix}")
58
59configure_file(
60 ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in
61 ${CMAKE_CURRENT_BINARY_DIR}/constants.cc
62 ESCAPE_QUOTES
63@ONLY)
64
Piotr Krysik184d7062017-09-13 12:46:38 +020065list(APPEND grgsm_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc)
Piotr Krysikbb961c12017-08-24 15:35:42 +020066#########################################################################
Piotr Krysik0945cc52017-09-13 09:17:50 +020067# Subdirecories
68#########################################################################
69add_subdirectory(decoding)
70add_subdirectory(decryption)
71add_subdirectory(demapping)
72add_subdirectory(flow_control)
73add_subdirectory(misc_utils)
74add_subdirectory(qa_utils)
75add_subdirectory(receiver)
Piotr Krysik517464c2017-11-05 12:23:15 +010076add_subdirectory(transmitter)
Piotr Krysik99305532018-05-05 12:38:11 +020077add_subdirectory(trx)
piotr437f5462014-02-04 17:57:25 +010078
Piotr Krysikac140212018-06-19 12:07:28 +020079if(NOT LOCAL_OSMOCOM)
Piotr Krysikc711e972018-06-18 14:53:59 +020080 list (APPEND grgsm_link_libraries ${LIBOSMOCORE_LIBRARIES} ${LIBOSMOCODEC_LIBRARIES} ${LIBOSMOGSM_LIBRARY})
Piotr Krysik1a5e87e2018-03-04 19:36:24 +010081 if(LIBOSMOCODING_FOUND)
Vasil Velichkov1789ae22019-08-13 20:32:05 +000082 list (APPEND grgsm_link_libraries
83 ${LIBOSMOCODING_LIBRARIES}
84 )
85 list (APPEND grgsm_include_directories
86 ${LIBOSMOCORE_INCLUDE_DIR}
87 )
Piotr Krysik1a5e87e2018-03-04 19:36:24 +010088 endif()
Piotr Krysik8bed6122018-02-27 07:46:04 +010089endif()
90
Piotr Krysik8722be52016-02-19 15:22:51 +010091add_library(grgsm SHARED ${grgsm_sources})
Vasil Velichkov1789ae22019-08-13 20:32:05 +000092target_link_libraries(grgsm gnuradio::gnuradio-runtime gnuradio::gnuradio-filter volk osmocoding)
93target_include_directories(grgsm
94 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
95 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/receiver>
96 PUBLIC $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
97 PUBLIC $<INSTALL_INTERFACE:include>
98 )
Piotr Krysik0fdbfdd2016-02-19 19:33:17 +010099set_target_properties(grgsm PROPERTIES DEFINE_SYMBOL "grgsm_EXPORTS")
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000100
101if(APPLE)
102 set_target_properties(grgsm PROPERTIES
103 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
104 )
105endif(APPLE)
piotr437f5462014-02-04 17:57:25 +0100106
107########################################################################
108# Install built library files
109########################################################################
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000110include(GrMiscUtils)
111GR_LIBRARY_FOO(grgsm)
112
113########################################################################
114# Print summary
115########################################################################
116message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
117message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
118
119set (grgsm_sources ${grgsm_sources} PARENT_SCOPE)
piotr437f5462014-02-04 17:57:25 +0100120
121########################################################################
122# Build and register unit test
123########################################################################
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000124include(GrTest)
piotr437f5462014-02-04 17:57:25 +0100125
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000126# If your unit tests require special include paths, add them here
127#include_directories()
128# List all files that contain Boost.UTF unit tests here
129list(APPEND test_gsm_sources
130)
131# Anything we need to link to for the unit tests go here
132list(APPEND GR_TEST_TARGET_DEPS grgsm)
piotr437f5462014-02-04 17:57:25 +0100133
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000134if(NOT test_gsm_sources)
135 MESSAGE(STATUS "No C++ unit tests... skipping")
136 return()
137endif(NOT test_gsm_sources)
piotr437f5462014-02-04 17:57:25 +0100138
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000139foreach(qa_file ${test_gsm_sources})
140 GR_ADD_CPP_TEST("gsm_${qa_file}"
141 ${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
142 )
143endforeach(qa_file)