Fix Swig issue with the debug blocks

This commit is contained in:
Manolis Surligas 2018-02-02 11:46:59 +02:00
parent 12a2aa0090
commit 4f45abaf08
4 changed files with 69 additions and 24 deletions

View File

@ -21,8 +21,8 @@
# Check if there is C++ code at all
########################################################################
if(NOT satnogs_sources)
MESSAGE(STATUS "No C++ sources... skipping swig/")
return()
MESSAGE(STATUS "No C++ sources... skipping swig/")
return()
endif(NOT satnogs_sources)
########################################################################
@ -43,32 +43,51 @@ foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
endforeach(incdir)
set(GR_SWIG_LIBRARIES gnuradio-satnogs)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/satnogs_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
if(${INCLUDE_DEBUG_BLOCKS})
set(INCLUDE_DEBUG_BLOCKS_BOOL_VAL 1)
else()
set(INCLUDE_DEBUG_BLOCKS_BOOL_VAL 0)
endif()
GR_SWIG_MAKE(satnogs_swig satnogs_swig.i)
########################################################################
# Install the build swig module
########################################################################
GR_SWIG_INSTALL(TARGETS satnogs_swig DESTINATION ${GR_PYTHON_DIR}/satnogs)
########################################################################
# Install swig .i files for development
########################################################################
list(APPEND swig_files
satnogs_swig.i
${CMAKE_CURRENT_BINARY_DIR}/satnogs_swig_doc.i
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/satnogs_swig.py.in
${CMAKE_CURRENT_BINARY_DIR}/satnogs_swig.py
@ONLY)
if(${INCLUDE_DEBUG_BLOCKS})
list(APPEND swig_files "satnogs_debug_swig.i")
set(SATONGS_SWIG_FILES
satnogs_swig0
satnogs_debug_swig
)
else()
set(SATONGS_SWIG_FILES
satnogs_swig0
)
endif()
foreach(swigfile ${SATONGS_SWIG_FILES})
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${swigfile}_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
set(GR_SWIG_LIBRARIES gnuradio-satnogs)
GR_SWIG_MAKE(${swigfile} ${swigfile}.i)
GR_SWIG_INSTALL(TARGETS ${swigfile} DESTINATION ${GR_PYTHON_DIR}/satnogs)
list(APPEND SWIGFILES ${swigfile}.i)
list(APPEND SWIGDOCFILES ${CMAKE_CURRENT_BINARY_DIR}/${swigfile}_doc.i)
endforeach(swigfile)
install(
FILES
${swig_files}
${CMAKE_CURRENT_BINARY_DIR}/satnogs_swig_doc.i
${SWIGFILES}
${SWIGDOCFILES}
DESTINATION ${GR_INCLUDE_DIR}/satnogs/swig
)
# Install the Python file that pulls in the swig built files.
GR_PYTHON_INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/satnogs_swig.py
DESTINATION ${GR_PYTHON_DIR}/satnogs
COMPONENT "satnogs_python"
)

View File

@ -1,10 +1,12 @@
/* -*- c++ -*- */
#define SATNOGS_API
%include <typemaps.i>
%include "gnuradio.i" // the common stuff
//load generated python docstrings
%include "satnogs_swig_doc.i"
%include "satnogs_debug_swig_doc.i"
%{
#include "satnogs/morse_debug_source.h"

24
swig/satnogs_swig.py.in Normal file
View File

@ -0,0 +1,24 @@
#! /usr/bin/python
#
# gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
#
# Copyright (C) 2018
# Libre Space Foundation <http://librespacefoundation.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
from satnogs_swig0 import *
if @INCLUDE_DEBUG_BLOCKS_BOOL_VAL@:
from satnogs_debug_swig import *

View File

@ -6,7 +6,7 @@
%include "gnuradio.i" // the common stuff
//load generated python docstrings
%include "satnogs_swig_doc.i"
%include "satnogs_swig0_doc.i"
%{
#include "satnogs/morse_tree.h"