piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 1 | # 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 | |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 20 | include(GrPlatform) #define LIB_SUFFIX |
Piotr Krysik | bb961c1 | 2017-08-24 15:35:42 +0200 | [diff] [blame] | 21 | include(GrMiscUtils) |
| 22 | |
| 23 | ######################################################################## |
Piotr Krysik | 0945cc5 | 2017-09-13 09:17:50 +0200 | [diff] [blame] | 24 | # Add sources macro |
| 25 | ######################################################################## |
| 26 | set(grgsm_sources "") |
| 27 | |
| 28 | macro (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() |
| 41 | endmacro() |
| 42 | |
| 43 | ######################################################################## |
Piotr Krysik | bb961c1 | 2017-08-24 15:35:42 +0200 | [diff] [blame] | 44 | # Handle the generated constants |
| 45 | ######################################################################## |
| 46 | execute_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 | ) |
| 50 | message(STATUS "Loading build date ${BUILD_DATE} into constants...") |
| 51 | message(STATUS "Loading version ${VERSION} into constants...") |
| 52 | |
| 53 | #double escape for windows backslash path separators |
| 54 | string(REPLACE "\\" "\\\\" prefix "${prefix}") |
| 55 | |
| 56 | configure_file( |
| 57 | ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in |
| 58 | ${CMAKE_CURRENT_BINARY_DIR}/constants.cc |
| 59 | ESCAPE_QUOTES |
| 60 | @ONLY) |
| 61 | |
Piotr Krysik | 184d706 | 2017-09-13 12:46:38 +0200 | [diff] [blame] | 62 | list(APPEND grgsm_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc) |
Piotr Krysik | bb961c1 | 2017-08-24 15:35:42 +0200 | [diff] [blame] | 63 | ######################################################################### |
Piotr Krysik | 0945cc5 | 2017-09-13 09:17:50 +0200 | [diff] [blame] | 64 | # Subdirecories |
| 65 | ######################################################################### |
| 66 | add_subdirectory(decoding) |
| 67 | add_subdirectory(decryption) |
| 68 | add_subdirectory(demapping) |
| 69 | add_subdirectory(flow_control) |
| 70 | add_subdirectory(misc_utils) |
| 71 | add_subdirectory(qa_utils) |
| 72 | add_subdirectory(receiver) |
Piotr Krysik | 517464c | 2017-11-05 12:23:15 +0100 | [diff] [blame] | 73 | add_subdirectory(transmitter) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 74 | |
Piotr Krysik | 0945cc5 | 2017-09-13 09:17:50 +0200 | [diff] [blame] | 75 | ######################################################################## |
| 76 | # Setup library |
| 77 | ######################################################################## |
ptrkrysik | 18b631e | 2014-12-15 09:09:18 +0100 | [diff] [blame] | 78 | include_directories(${Boost_INCLUDE_DIR} receiver) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 79 | link_directories(${Boost_LIBRARY_DIRS}) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 80 | |
Piotr Krysik | 8722be5 | 2016-02-19 15:22:51 +0100 | [diff] [blame] | 81 | add_library(grgsm SHARED ${grgsm_sources}) |
Piotr Krysik | 70c25a1 | 2017-01-03 08:01:23 +0100 | [diff] [blame] | 82 | target_link_libraries(grgsm ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES} ${VOLK_LIBRARIES} ${LIBOSMOCODEC_LIBRARIES} ${LIBOSMOCORE_LIBRARIES} |
| 83 | # ${LIBOSMOCODING_LIBRARIES} |
ptrkrysik | 30f3945 | 2014-12-05 18:25:58 +0100 | [diff] [blame] | 84 | # libraries required by plotting.h - have troubles to be installed by pybombs |
| 85 | # boost_iostreams |
| 86 | # boost_system |
| 87 | # boost_filesystem |
piotr | 3f1ea81 | 2014-04-17 10:56:08 +0200 | [diff] [blame] | 88 | ) |
Piotr Krysik | 0fdbfdd | 2016-02-19 19:33:17 +0100 | [diff] [blame] | 89 | set_target_properties(grgsm PROPERTIES DEFINE_SYMBOL "grgsm_EXPORTS") |
Piotr Krysik | bb961c1 | 2017-08-24 15:35:42 +0200 | [diff] [blame] | 90 | GR_LIBRARY_FOO(grgsm) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 91 | |
| 92 | ######################################################################## |
| 93 | # Install built library files |
| 94 | ######################################################################## |
Piotr Krysik | 8722be5 | 2016-02-19 15:22:51 +0100 | [diff] [blame] | 95 | install(TARGETS grgsm |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 96 | LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file |
| 97 | ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file |
| 98 | RUNTIME DESTINATION bin # .dll file |
| 99 | ) |
| 100 | |
| 101 | ######################################################################## |
| 102 | # Build and register unit test |
| 103 | ######################################################################## |
piotr | 7f3f366 | 2014-07-08 16:47:53 +0200 | [diff] [blame] | 104 | #include(GrTest) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 105 | |
piotr | 7f3f366 | 2014-07-08 16:47:53 +0200 | [diff] [blame] | 106 | #include_directories(${CPPUNIT_INCLUDE_DIRS}) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 107 | |
ptrkrysik | a25b830 | 2015-05-08 08:59:17 +0200 | [diff] [blame] | 108 | #list(APPEND test_grgsm_sources |
piotr | 7f3f366 | 2014-07-08 16:47:53 +0200 | [diff] [blame] | 109 | # ${CMAKE_CURRENT_SOURCE_DIR}/test_gsm.cc |
| 110 | # ${CMAKE_CURRENT_SOURCE_DIR}/qa_gsm.cc |
| 111 | # ${CMAKE_CURRENT_SOURCE_DIR}/qa_receiver.cc |
| 112 | #) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 113 | |
ptrkrysik | a25b830 | 2015-05-08 08:59:17 +0200 | [diff] [blame] | 114 | #add_executable(test-gsm ${test_grgsm_sources}) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 115 | |
piotr | 7f3f366 | 2014-07-08 16:47:53 +0200 | [diff] [blame] | 116 | #target_link_libraries( |
| 117 | # test-gsm |
| 118 | # ${GNURADIO_RUNTIME_LIBRARIES} |
| 119 | # ${Boost_LIBRARIES} |
| 120 | # ${CPPUNIT_LIBRARIES} |
Piotr Krysik | 8722be5 | 2016-02-19 15:22:51 +0100 | [diff] [blame] | 121 | # grgsm |
piotr | 7f3f366 | 2014-07-08 16:47:53 +0200 | [diff] [blame] | 122 | #) |
piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 123 | |
piotr | 7f3f366 | 2014-07-08 16:47:53 +0200 | [diff] [blame] | 124 | #GR_ADD_TEST(test_gsm test-gsm) |