Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
    Add op25_python installation file to .gitignore
    Fix SIGSEGV when pulse audio doesn't open properly
    Repair gdb pause option broken by python2/3 changes
    Extra error-checking for cleaner shutdown
    Changes to install script and cmake build environment to automatically
      figure out gnuradio version and python version
  • Loading branch information
boatbod committed Dec 20, 2020
1 parent 41abda3 commit 77b71b5
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 392 deletions.
78 changes: 78 additions & 0 deletions CMakeLists.txt
@@ -1,7 +1,85 @@
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 2.6)
project(gr-op25 CXX C)
enable_testing()

#select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")

########################################################################
# Compiler specific setup
########################################################################
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
#http://gcc.gnu.org/wiki/Visibility
add_definitions(-fvisibility=hidden)
endif()

########################################################################
# Find boost
########################################################################
if(UNIX AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
endif(UNIX AND EXISTS "/usr/lib64")
set(Boost_ADDITIONAL_VERSIONS
"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"
"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"
"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"
"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"
"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"
"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"
"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"
)
find_package(Boost "1.35" COMPONENTS filesystem system)

if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost required to compile op25")
endif()

########################################################################
# Find gnuradio build dependencies
########################################################################
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(CppUnit)
if(NOT CPPUNIT_FOUND)
message(FATAL_ERROR "CppUnit required to compile op25")
endif()
set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER PMT)
find_package(GnuradioRuntime)
find_package(Gnuradio REQUIRED)
MESSAGE(STATUS "GnuRadio version ${Gnuradio_VERSION}")
if ("${Gnuradio_VERSION}" VERSION_LESS "2.7.0")
MESSAGE(FATAL_ERROR "OP25 Required Gnuradio minimum version 2.7.0")
elseif ("${Gnuradio_VERSION}" VERSION_LESS "3.8.0")
set(OP25_PYTHON_VER 2)
else()
set(OP25_PYTHON_VER 3)
endif()
MESSAGE(STATUS "Configuring for Python ${OP25_PYTHON_VER}")

execute_process(COMMAND python${OP25_PYTHON_VER} -c "
import os
import sys
from distutils import sysconfig
pfx = '/usr/local'
m1 = os.path.join('lib', 'python' + sys.version[:3], 'dist-packages')
m2 = sysconfig.get_python_lib(plat_specific=True, prefix='')
f1 = os.path.join(pfx, m1)
f2 = os.path.join(pfx, m2)
ok2 = f2 in sys.path
if ok2:
print(m2)
else:
print(m1)
" OUTPUT_VARIABLE OP25_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "OP25_PYTHON_DIR has been set to \"${OP25_PYTHON_DIR}\".")

add_subdirectory(op25/gr-op25)
add_subdirectory(op25/gr-op25_repeater)
Expand Down
16 changes: 0 additions & 16 deletions README-gr3.8.patch

This file was deleted.

3 changes: 2 additions & 1 deletion README-installation
Expand Up @@ -4,7 +4,8 @@ These high level instructions will lead you through installing op25
on Debian based Linux systems such as Ubuntu, Linux Mint and similar.

Note 1: op25 is currently tested against gnuradio-3.7/python2 with Ubuntu 16.04
and gnuradio-3.8/python3 with Ubuntu 20.04.
and gnuradio-3.8/python3 with Ubuntu 20.04. Build environment automatically figures
out which version of gnuradio you have and therefore which version of python to use.

Note 2: versions of cmake later than 3.10.3 have been known to cause dependency
issues while building the swig libraries on pyhton2. At the current time if you
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/GrSwig.cmake
Expand Up @@ -114,7 +114,7 @@ macro(GR_SWIG_MAKE name)
endif()

#append additional include directories
find_package(PythonLibs 2)
find_package(PythonLibs ${OP25_PYTHON_VER})
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
224 changes: 0 additions & 224 deletions gr3.8.patch

This file was deleted.

3 changes: 1 addition & 2 deletions install.sh
Expand Up @@ -16,7 +16,6 @@ sudo apt-get update
GR_VER=$(apt list gnuradio 2>/dev/null | grep -m 1 gnuradio | cut -d' ' -f2 | cut -d'.' -f1,2)
if [ ${GR_VER} = "3.8" ]; then
echo "Installing for GNURadio 3.8"
cat gr3.8.patch | patch -N -p1 -r -
sudo sed -i -- 's/^# *deb-src/deb-src/' /etc/apt/sources.list
sudo apt-get build-dep gnuradio
sudo apt-get install gnuradio gnuradio-dev gr-osmosdr librtlsdr-dev libuhd-dev libhackrf-dev libitpp-dev libpcap-dev cmake git swig build-essential pkg-config doxygen python3-numpy python3-waitress python3-requests gnuplot-x11
Expand All @@ -30,7 +29,7 @@ else
sudo apt-get install gnuradio gnuradio-dev gr-osmosdr librtlsdr-dev libuhd-dev libhackrf-dev libitpp-dev libpcap-dev cmake git swig build-essential pkg-config doxygen python-numpy python-waitress python-requests gnuplot-x11

# Tell op25 to use python2
echo "/usr/bin/python" > op25/gr-op25_repeater/apps/op25_python
echo "/usr/bin/python2" > op25/gr-op25_repeater/apps/op25_python

fi

Expand Down

0 comments on commit 77b71b5

Please sign in to comment.