discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] How do I add third party library to gnuradio bloc


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] How do I add third party library to gnuradio block using cmake?
Date: Mon, 31 Jul 2017 11:07:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Hi Pawel,

would you have the full, verbatim output of trying to execute a specific, minimal flow graph, alongside with the code of that flow graph, so that we can get an actual feeling for where things go wrong?

Best regards,

Marcus


On 07/30/2017 12:15 AM, Pawel wrote:

For last two days i'm trying to create new block in gnuradio, but i'm constantly getting error when i try to execute flow graph:

AttributeError: 'module' object has no attribute 'test'

I think that there is some problem with 3rd party libraries (opennn) i'm trying to use in my project.In main source file (test_impl.cc) i've imported opennn header file. In funtion general_work i'm invoking function:

   int
    test_impl::general_work (int noutput_items,
                       gr_vector_int &ninput_items,
                       gr_vector_const_void_star &input_items,
                       gr_vector_void_star &output_items)
    {
      const float *in = (const float *) input_items[0];
      float *out = (float *) output_items[0];
       OpenNN::NeuralNetwork nn(8, 1, 1);

      // Do <+signal processing+>
      // Tell runtime system how many input items we consumed on
      // each input stream.
      consume_each (noutput_items);

      // Tell runtime system how many output items we produced.
      return noutput_items;
    }

My lib/CMakeLists.txt (in lib folder i have auto-generated gnuradio block source files and dirs with opennn library):

########################################################################
# Setup library
########################################################################
include(GrPlatform) #define LIB_SUFFIX

include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})

list(APPEND tutorial3_sources
    test_impl.cc
)

set(tutorial3_sources "${tutorial3_sources}" PARENT_SCOPE)
if(NOT tutorial3_sources)
    MESSAGE(STATUS "No C++ sources... skipping lib/")
    return()
endif(NOT tutorial3_sources)

add_library(gnuradio-tutorial3 SHARED ${tutorial3_sources})
target_link_libraries(gnuradio-tutorial3 ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES})
set_target_properties(gnuradio-tutorial3 PROPERTIES DEFINE_SYMBOL "gnuradio_tutorial3_EXPORTS")

if(APPLE)
    set_target_properties(gnuradio-tutorial3 PROPERTIES
        INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
    )
endif(APPLE)
########################################################################
# Install built library files
########################################################################
include(GrMiscUtils)
GR_LIBRARY_FOO(gnuradio-tutorial3 RUNTIME_COMPONENT "tutorial3_runtime" DEVEL_COMPONENT "tutorial3_devel")

########################################################################
# Build and register unit test
########################################################################
include(GrTest)

include_directories(${CPPUNIT_INCLUDE_DIRS})

list(APPEND test_tutorial3_sources
    ${CMAKE_CURRENT_SOURCE_DIR}/test_tutorial3.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_tutorial3.cc
)

add_executable(test-tutorial3 ${test_tutorial3_sources})

target_link_libraries(
  test-tutorial3
  ${GNURADIO_RUNTIME_LIBRARIES}
  ${Boost_LIBRARIES}
  ${CPPUNIT_LIBRARIES}
  gnuradio-tutorial3
)

GR_ADD_TEST(test_tutorial3 test-tutorial3)

########################################################################
# Print summary
########################################################################
message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Building for version: ${VERSION} / ${LIBVER}")

I've tried adding following code:

########################################################################
# Install opennn library files
########################################################################
add_subdirectory(tinyxml2)
add_subdirectory(opennn)
include_directories(opennn)
add_subdirectory(examples)
add_subdirectory(blank)
add_subdirectory(tests)
include(CPack)

To be honest i've tried to modify this CMake file on many ways, but i'm always getting this error.



_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]