blob: 6892effa7d381cde8a0a616f924807f1d9b08996 [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 Krysike4da4172021-05-02 23:20:47 +020079list (APPEND grgsm_link_libraries ${LIBOSMOCORE_LIBRARY} ${LIBOSMOCODEC_LIBRARY} ${LIBOSMOGSM_LIBRARY} ${LIBOSMOCODING_LIBRARY})
Piotr Krysik8bed6122018-02-27 07:46:04 +010080
Piotr Krysik8722be52016-02-19 15:22:51 +010081add_library(grgsm SHARED ${grgsm_sources})
Vasil Velichkovb82bbeb2019-11-16 02:12:16 +020082target_link_libraries(grgsm gnuradio::gnuradio-runtime gnuradio::gnuradio-filter volk ${grgsm_link_libraries})
Vasil Velichkov1789ae22019-08-13 20:32:05 +000083target_include_directories(grgsm
84 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
85 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/receiver>
Piotr Krysike4da4172021-05-02 23:20:47 +020086 PUBLIC $<BUILD_INTERFACE:${LIBOSMOCORE_INCLUDE_DIR}>
Vasil Velichkov1789ae22019-08-13 20:32:05 +000087 PUBLIC $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
88 PUBLIC $<INSTALL_INTERFACE:include>
89 )
Piotr Krysik0fdbfdd2016-02-19 19:33:17 +010090set_target_properties(grgsm PROPERTIES DEFINE_SYMBOL "grgsm_EXPORTS")
Vasil Velichkov1789ae22019-08-13 20:32:05 +000091
92if(APPLE)
93 set_target_properties(grgsm PROPERTIES
94 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
95 )
96endif(APPLE)
piotr437f5462014-02-04 17:57:25 +010097
98########################################################################
99# Install built library files
100########################################################################
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000101include(GrMiscUtils)
102GR_LIBRARY_FOO(grgsm)
103
104########################################################################
105# Print summary
106########################################################################
107message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
108message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
109
110set (grgsm_sources ${grgsm_sources} PARENT_SCOPE)
piotr437f5462014-02-04 17:57:25 +0100111
112########################################################################
113# Build and register unit test
114########################################################################
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000115include(GrTest)
piotr437f5462014-02-04 17:57:25 +0100116
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000117# If your unit tests require special include paths, add them here
118#include_directories()
119# List all files that contain Boost.UTF unit tests here
Piotr Krysik21b0f7d2020-02-16 08:46:26 +0100120list(APPEND test_grgsm_sources
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000121)
122# Anything we need to link to for the unit tests go here
123list(APPEND GR_TEST_TARGET_DEPS grgsm)
piotr437f5462014-02-04 17:57:25 +0100124
Piotr Krysik21b0f7d2020-02-16 08:46:26 +0100125if(NOT test_grgsm_sources)
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000126 MESSAGE(STATUS "No C++ unit tests... skipping")
127 return()
Piotr Krysik21b0f7d2020-02-16 08:46:26 +0100128endif(NOT test_grgsm_sources)
piotr437f5462014-02-04 17:57:25 +0100129
Piotr Krysik21b0f7d2020-02-16 08:46:26 +0100130foreach(qa_file ${test_grgsm_sources})
131 GR_ADD_CPP_TEST("grgsm_${qa_file}"
Vasil Velichkov1789ae22019-08-13 20:32:05 +0000132 ${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
133 )
134endforeach(qa_file)