Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
smarek committed Jan 4, 2023
1 parent 04e089d commit 0208fd3
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 62 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*.pyc
__pycache__
/build
.cmake
CMakeCache.txt
CMakeFiles
.ninja_deps
.ninja_log
/Testing
CTestTestfile.cmake
cmake_install.cmake
cmake_uninstall.cmake
build.ninja
python_compile_helper.py
get_swig_deps.py
*.i
/lib/test_fsk4_test.sh
/swig/_fsk4_swig_swig_tag.cpp
*.cpp.in
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.0)
project(gr-fsk4 CXX C)
enable_testing()

Expand Down Expand Up @@ -67,6 +67,7 @@ endif()
# Install directories
########################################################################
include(GrPlatform) #define LIB_SUFFIX
include(GrMiscUtils)
set(GR_RUNTIME_DIR bin)
set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
set(GR_INCLUDE_DIR include/fsk4)
Expand Down Expand Up @@ -103,7 +104,7 @@ endif(APPLE)
########################################################################
# Find gnuradio build dependencies
########################################################################
find_package(CppUnit)
find_package(CPPUNIT)
find_package(Doxygen)

# Search for GNU Radio and its components and versions. Add any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
# CPPUNIT_FOUND, If false, do not try to use CppUnit.

INCLUDE(FindPkgConfig)
if(NOT PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
endif()
PKG_CHECK_MODULES(PC_CPPUNIT "cppunit")

FIND_PATH(CPPUNIT_INCLUDE_DIRS
Expand Down
52 changes: 24 additions & 28 deletions cmake/Modules/GrMiscUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,30 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.

if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
return()
endif()
set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)

########################################################################
# Generates the .la libtool file
# This appears to generate libtool files that cannot be used by auto*.
# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
# Notice: there is not COMPONENT option, these will not get distributed.
########################################################################
function(GR_LIBTOOL)
if(NOT DEFINED GENERATE_LIBTOOL)
set(GENERATE_LIBTOOL OFF) #disabled by default
endif()

if(GENERATE_LIBTOOL)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})

find_program(LIBTOOL libtool)
if(LIBTOOL)
include(CMakeMacroLibtoolFile)
CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
endif(LIBTOOL)
endif(GENERATE_LIBTOOL)

endfunction(GR_LIBTOOL)

########################################################################
# Set global variable macro.
Expand Down Expand Up @@ -104,30 +124,6 @@ macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
endif(${have})
endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)

########################################################################
# Generates the .la libtool file
# This appears to generate libtool files that cannot be used by auto*.
# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
# Notice: there is not COMPONENT option, these will not get distributed.
########################################################################
function(GR_LIBTOOL)
if(NOT DEFINED GENERATE_LIBTOOL)
set(GENERATE_LIBTOOL OFF) #disabled by default
endif()

if(GENERATE_LIBTOOL)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})

find_program(LIBTOOL libtool)
if(LIBTOOL)
include(CMakeMacroLibtoolFile)
CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
endif(LIBTOOL)
endif(GENERATE_LIBTOOL)

endfunction(GR_LIBTOOL)

########################################################################
# Do standard things to the library target
# - set target properties
Expand Down
10 changes: 5 additions & 5 deletions cmake/Modules/GrPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ if(PYTHON_EXECUTABLE)
else(PYTHON_EXECUTABLE)

#use the built-in find script
find_package(PythonInterp 2)
find_package(PythonInterp 3)

#and if that fails use the find program routine
if(NOT PYTHONINTERP_FOUND)
find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python2.6 python2.5)
find_program(PYTHON_EXECUTABLE NAMES python python3 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5)
if(PYTHON_EXECUTABLE)
set(PYTHONINTERP_FOUND TRUE)
endif(PYTHON_EXECUTABLE)
Expand All @@ -49,7 +49,7 @@ else(PYTHON_EXECUTABLE)
endif(PYTHON_EXECUTABLE)

if (CMAKE_CROSSCOMPILING)
set(QA_PYTHON_EXECUTABLE "/usr/bin/python")
set(QA_PYTHON_EXECUTABLE "/usr/bin/python3")
else (CMAKE_CROSSCOMPILING)
set(QA_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
endif(CMAKE_CROSSCOMPILING)
Expand Down Expand Up @@ -119,7 +119,7 @@ file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
function(GR_UNIQUE_TARGET desc)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
unique = hashlib.md5('${reldir}${ARGN}'.encode('ascii')).hexdigest()[:5]
print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_target(${_target} ALL DEPENDS ${ARGN})
Expand Down Expand Up @@ -191,7 +191,7 @@ function(GR_PYTHON_INSTALL)
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)

if (CMAKE_CROSSCOMPILING)
set(pyexe_native "/usr/bin/env python")
set(pyexe_native "/usr/bin/env python3")
endif()

foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/GrSwig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ function(GR_SWIG_MAKE_DOCS output_file)
@ONLY)

#Create a dummy custom command that depends on other targets
include(GrMiscUtils)
GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})

#call doxygen on the Doxyfile + input headers
Expand Down Expand Up @@ -127,7 +126,7 @@ macro(GR_SWIG_MAKE name)
endif()

#append additional include directories
find_package(PythonLibs 2)
find_package(PythonLibs 3)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})

Expand Down Expand Up @@ -203,6 +202,7 @@ macro(GR_SWIG_INSTALL)
COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
)

include(GrMiscUtils)
GR_LIBTOOL(
TARGET ${SWIG_MODULE_${name}_REAL_NAME}
DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/UseSWIG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
unique = hashlib.md5('${reldir}${ARGN}'.encode('ascii')).hexdigest()[:5]
print(re.sub('\\W', '_', '${name} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE
)
Expand Down Expand Up @@ -253,7 +253,7 @@ macro(SWIG_ADD_MODULE name language)

set(swig_generated_sources)
foreach(it ${swig_dot_i_sources})
SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it})
SWIG_ADD_SOURCE_TO_MODULE("${name}" swig_generated_source "${it}")
set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}")
endforeach()
get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
Expand Down
2 changes: 1 addition & 1 deletion include/fsk4/apco25_f.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace gr {
class FSK4_API apco25_f : virtual public gr::block
{
public:
typedef boost::shared_ptr<apco25_f> sptr;
typedef std::shared_ptr<apco25_f> sptr;

/*!
* \brief Return a shared_ptr to a new instance of fsk4::apco25_f.
Expand Down
2 changes: 1 addition & 1 deletion include/fsk4/demod_ff.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace gr {
class FSK4_API demod_ff : virtual public gr::block
{
public:
typedef boost::shared_ptr<demod_ff> sptr;
typedef std::shared_ptr<demod_ff> sptr;

/*!
* \brief Return a shared_ptr to a new instance of fsk4::demod_ff.
Expand Down
2 changes: 1 addition & 1 deletion include/fsk4/generic_f.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace gr {
class FSK4_API generic_f : virtual public gr::block
{
public:
typedef boost::shared_ptr<generic_f> sptr;
typedef std::shared_ptr<generic_f> sptr;

/*!
* \brief Return a shared_ptr to a new instance of fsk4::generic_f.
Expand Down
8 changes: 3 additions & 5 deletions include/fsk4/rdlap_f.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
#include <gnuradio/msg_queue.h>
#include <gnuradio/message.h>

namespace gr {
namespace fsk4 {
namespace gr::fsk4 {

/*!
* \brief <+description of block+>
Expand All @@ -38,7 +37,7 @@ namespace gr {
class FSK4_API rdlap_f : virtual public gr::block
{
public:
typedef boost::shared_ptr<rdlap_f> sptr;
typedef std::shared_ptr<rdlap_f> sptr;

/*!
* \brief Return a shared_ptr to a new instance of fsk4::rdlap_f.
Expand All @@ -51,8 +50,7 @@ namespace gr {
static sptr make(gr::msg_queue::sptr queue, int processing_flags);
};

} // namespace fsk4
} // namespace gr
} // namespace gr

#endif /* INCLUDED_FSK4_RDLAP_F_H */

6 changes: 2 additions & 4 deletions lib/apco25_f_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#include <gnuradio/io_signature.h>
#include "apco25_f_impl.h"

namespace gr {
namespace fsk4 {
namespace gr::fsk4 {

apco25_f::sptr
apco25_f::make(gr::msg_queue::sptr queue, int processing_flags)
Expand Down Expand Up @@ -244,6 +243,5 @@ namespace gr {
return 0;
}

} /* namespace fsk4 */
} /* namespace gr */
} /* namespace gr */

17 changes: 8 additions & 9 deletions lib/generic_f_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
#endif

#include <gnuradio/io_signature.h>

#include <utility>
#include "generic_f_impl.h"

namespace gr {
namespace fsk4 {
namespace gr::fsk4 {

generic_f::sptr
generic_f::make(gr::msg_queue::sptr queue, int processing_flags)
{
return gnuradio::get_initial_sptr
(new generic_f_impl(queue, processing_flags));
return gnuradio::get_initial_sptr(new generic_f_impl(queue, processing_flags));
}

/*
Expand All @@ -42,7 +42,7 @@ namespace gr {
: gr::block("generic_f",
gr::io_signature::make(1, 1, sizeof(float)),
gr::io_signature::make(0, 0, 0)),
d_queue(queue)
d_queue(std::move(queue))
{
sym_counter = 0;

Expand Down Expand Up @@ -80,8 +80,8 @@ namespace gr {
{
unsigned char sym;

const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0];
const auto *in = (const float *) input_items[0];
auto *out = (float *) output_items[0];

// Do <+signal processing+>
// run through all provided data;
Expand Down Expand Up @@ -115,6 +115,5 @@ namespace gr {
return 0;
}

} /* namespace fsk4 */
} /* namespace gr */
} /* namespace gr */

Binary file removed python/__init__.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ endif(NOT fsk4_sources)
# Include swig generation macros
########################################################################
find_package(SWIG)
find_package(PythonLibs 2)
find_package(PythonLibs 3)
if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
return()
endif()

include(GrSwig)
include(GrPython)
include(GrMiscUtils)

########################################################################
# Setup swig generation
Expand Down

0 comments on commit 0208fd3

Please sign in to comment.