blob: 518edc47e0ccdeb9f56efde57a06971897f3e4a6 [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
piotr437f5462014-02-04 17:57:25 +010020include(GrPlatform) #define LIB_SUFFIX
Piotr Krysikbb961c12017-08-24 15:35:42 +020021include(GrMiscUtils)
22
23########################################################################
Piotr Krysik0945cc52017-09-13 09:17:50 +020024# Add sources macro
25########################################################################
26set(grgsm_sources "")
27
28macro (add_sources)
29 file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}/lib" "${CMAKE_CURRENT_SOURCE_DIR}")
30 foreach (_src ${ARGN})
31 if (_relPath)
32 list (APPEND grgsm_sources "${_relPath}/${_src}")
33 else()
34 list (APPEND grgsm_sources "${_src}")
35 endif()
36 endforeach()
37 if (_relPath)
38 # propagate grgsm_sources to parent directory
39 set (grgsm_sources ${grgsm_sources} PARENT_SCOPE)
40 endif()
41endmacro()
42
43########################################################################
Piotr Krysikbb961c12017-08-24 15:35:42 +020044# Handle the generated constants
45########################################################################
46execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
47 "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())"
48 OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
49)
50message(STATUS "Loading build date ${BUILD_DATE} into constants...")
51message(STATUS "Loading version ${VERSION} into constants...")
52
53#double escape for windows backslash path separators
54string(REPLACE "\\" "\\\\" prefix "${prefix}")
55
56configure_file(
57 ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in
58 ${CMAKE_CURRENT_BINARY_DIR}/constants.cc
59 ESCAPE_QUOTES
60@ONLY)
61
Piotr Krysik184d7062017-09-13 12:46:38 +020062list(APPEND grgsm_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc)
Piotr Krysikbb961c12017-08-24 15:35:42 +020063#########################################################################
Piotr Krysik0945cc52017-09-13 09:17:50 +020064# Subdirecories
65#########################################################################
66add_subdirectory(decoding)
67add_subdirectory(decryption)
68add_subdirectory(demapping)
69add_subdirectory(flow_control)
70add_subdirectory(misc_utils)
71add_subdirectory(qa_utils)
72add_subdirectory(receiver)
Piotr Krysik517464c2017-11-05 12:23:15 +010073add_subdirectory(transmitter)
Piotr Krysik99305532018-05-05 12:38:11 +020074add_subdirectory(trx)
piotr437f5462014-02-04 17:57:25 +010075
Piotr Krysik0945cc52017-09-13 09:17:50 +020076########################################################################
77# Setup library
78########################################################################
ptrkrysik18b631e2014-12-15 09:09:18 +010079include_directories(${Boost_INCLUDE_DIR} receiver)
piotr437f5462014-02-04 17:57:25 +010080link_directories(${Boost_LIBRARY_DIRS})
piotr437f5462014-02-04 17:57:25 +010081
Piotr Krysik8bed6122018-02-27 07:46:04 +010082set(grgsm_link_libraries "")
83list (APPEND grgsm_link_libraries ${Boost_LIBRARIES})
84list (APPEND grgsm_link_libraries ${GNURADIO_ALL_LIBRARIES})
85list (APPEND grgsm_link_libraries ${VOLK_LIBRARIES})
Piotr Krysik8bed6122018-02-27 07:46:04 +010086if(WIN32)
Piotr Krysik1a5e87e2018-03-04 19:36:24 +010087 list (APPEND grgsm_link_libraries wsock32)
88 list (APPEND grgsm_link_libraries ws2_32)
89endif()
90
91if(LIBOSMOCORE_FOUND AND LIBOSMOCODEC_FOUND)
92 list (APPEND grgsm_link_libraries ${LIBOSMOCORE_LIBRARIES} ${LIBOSMOCODEC_LIBRARIES})
93 if(LIBOSMOCODING_FOUND)
94 list (APPEND grgsm_link_libraries ${LIBOSMOCODING_LIBRARIES})
95 endif()
Piotr Krysik8bed6122018-02-27 07:46:04 +010096endif()
97
98
Piotr Krysik1a5e87e2018-03-04 19:36:24 +010099
Piotr Krysik8722be52016-02-19 15:22:51 +0100100add_library(grgsm SHARED ${grgsm_sources})
Piotr Krysik1a5e87e2018-03-04 19:36:24 +0100101target_link_libraries(grgsm ${grgsm_link_libraries}
ptrkrysik30f39452014-12-05 18:25:58 +0100102# libraries required by plotting.h - have troubles to be installed by pybombs
103# boost_iostreams
104# boost_system
105# boost_filesystem
piotr3f1ea812014-04-17 10:56:08 +0200106)
Piotr Krysik8bed6122018-02-27 07:46:04 +0100107
Piotr Krysik0fdbfdd2016-02-19 19:33:17 +0100108set_target_properties(grgsm PROPERTIES DEFINE_SYMBOL "grgsm_EXPORTS")
Piotr Krysikbb961c12017-08-24 15:35:42 +0200109GR_LIBRARY_FOO(grgsm)
piotr437f5462014-02-04 17:57:25 +0100110
111########################################################################
112# Install built library files
113########################################################################
Piotr Krysik8722be52016-02-19 15:22:51 +0100114install(TARGETS grgsm
piotr437f5462014-02-04 17:57:25 +0100115 LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
116 ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
117 RUNTIME DESTINATION bin # .dll file
118)
119
120########################################################################
121# Build and register unit test
122########################################################################
piotr7f3f3662014-07-08 16:47:53 +0200123#include(GrTest)
piotr437f5462014-02-04 17:57:25 +0100124
piotr7f3f3662014-07-08 16:47:53 +0200125#include_directories(${CPPUNIT_INCLUDE_DIRS})
piotr437f5462014-02-04 17:57:25 +0100126
ptrkrysika25b8302015-05-08 08:59:17 +0200127#list(APPEND test_grgsm_sources
piotr7f3f3662014-07-08 16:47:53 +0200128# ${CMAKE_CURRENT_SOURCE_DIR}/test_gsm.cc
129# ${CMAKE_CURRENT_SOURCE_DIR}/qa_gsm.cc
130# ${CMAKE_CURRENT_SOURCE_DIR}/qa_receiver.cc
131#)
piotr437f5462014-02-04 17:57:25 +0100132
ptrkrysika25b8302015-05-08 08:59:17 +0200133#add_executable(test-gsm ${test_grgsm_sources})
piotr437f5462014-02-04 17:57:25 +0100134
piotr7f3f3662014-07-08 16:47:53 +0200135#target_link_libraries(
136# test-gsm
137# ${GNURADIO_RUNTIME_LIBRARIES}
138# ${Boost_LIBRARIES}
139# ${CPPUNIT_LIBRARIES}
Piotr Krysik8722be52016-02-19 15:22:51 +0100140# grgsm
piotr7f3f3662014-07-08 16:47:53 +0200141#)
piotr437f5462014-02-04 17:57:25 +0100142
piotr7f3f3662014-07-08 16:47:53 +0200143#GR_ADD_TEST(test_gsm test-gsm)