From 16b04ba7860321cf902019c454c65f1081dbbe18 Mon Sep 17 00:00:00 2001 From: Christian Nowke <nowke@vr.rwth-aachen.de> Date: Wed, 9 Mar 2016 13:18:02 +0100 Subject: [PATCH] added dependent libraries since this must be a dynamic library --- CMakeLists.txt | 19 +++++++++++++------ src/nett-python/nett-python.cpp | 15 +++++++++++++++ tests/create_slot.py | 11 ++++++++++- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a71e3ad..d052e59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,22 +9,27 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y" ) endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") -set( PROTOBUF_BIN "" CACHE FILEPATH "The protobuf binary directory for the schema compiler 'protoc'" ) -set( PROTOBUF_INCLUDE_DIR "" CACHE FILEPATH "The protobuf include directory" ) +set( PROTOBUF_BIN "" CACHE PATH "The protobuf binary directory for the schema compiler 'protoc'" ) +set( PROTOBUF_INCLUDE_DIR "" CACHE PATH "The protobuf include directory" ) +set( PROTOBUF_LIBRARY "" CACHE FILEPATH "The protobuf library to link against" ) +set( PROTOBUF_LIBRARY_DEBUG "" CACHE FILEPATH "The protobuf library to link against" ) -set( BOOST_INCLUDE_DIR "" CACHE FILEPATH "The boost include path" ) +set( BOOST_INCLUDE_DIR "" CACHE PATH "The boost include path" ) set( BOOST_PYTHON_LIBRARY "" CACHE FILEPATH "The boost python library to link against" ) set( BOOST_PYTHON_LIBRARY_DEBUG "" CACHE FILEPATH "The boost python debug library to link against" ) -set (PYTHON_INCLUDE_DIR "" CACHE FILEPATH "The python include path" ) +set (PYTHON_INCLUDE_DIR "" CACHE PATH "The python include path" ) set (PYTHON_LIBRARY "" CACHE FILEPATH "The python library to link against" ) set (PYTHON_LIBRARY_DEBUG "" CACHE FILEPATH "The python debug library to link against" ) -set (NETT_INCLUDE_DIR "" CACHE FILEPATH "The nett include path" ) -set (NETT_SCHEMA_DIR "" CACHE FILEPATH "The nett schema path" ) +set (NETT_INCLUDE_DIR "" CACHE PATH "The nett include path" ) +set (NETT_SCHEMA_DIR "" CACHE PATH "The nett schema path" ) set (NETT_LIBRARY "" CACHE FILEPATH "The nett library to link against" ) set (NETT_LIBRARY_DEBUG "" CACHE FILEPATH "The nett debug library to link against" ) +set( ZMQ_LIBRARY "" CACHE FILEPATH "The zmq library to link against" ) + + include( "include/nett-python/_SourceFiles.cmake" ) include( "src/nett-python/_SourceFiles.cmake" ) @@ -40,6 +45,8 @@ add_library (nett_python SHARED ${ProjectSources}) target_link_libraries( nett_python optimized ${NETT_LIBRARY} debug ${NETT_LIBRARY_DEBUG}) target_link_libraries( nett_python optimized ${PYTHON_LIBRARY} debug ${PYTHON_LIBRARY_DEBUG}) target_link_libraries( nett_python optimized ${BOOST_PYTHON_LIBRARY} debug ${BOOST_PYTHON_LIBRARY_DEBUG}) +target_link_libraries( nett_python optimized ${PROTOBUF_LIBRARY} debug ${PROTOBUF_LIBRARY_DEBUG}) +target_link_libraries( nett_python ${ZMQ_LIBRARY} ) add_event ( nett_python routing_message ${NETT_SCHEMA_DIR} ${PROJECT_BINARY_DIR} ) add_event ( nett_python string_message ${NETT_SCHEMA_DIR} ${PROJECT_BINARY_DIR} ) diff --git a/src/nett-python/nett-python.cpp b/src/nett-python/nett-python.cpp index 8e011ab..51e8973 100644 --- a/src/nett-python/nett-python.cpp +++ b/src/nett-python/nett-python.cpp @@ -7,11 +7,26 @@ #include <nett/nett.h> +#include <memory> + +#include <../schema/string_message.pb.h> + using namespace boost::python; +std::shared_ptr<nett::slot_in<string_message>> create_slot_in_string_message() +{ + return nett::make_slot_in<string_message>(); +} + +//nett::make_slot_out<string_message>(const std::string &slot_tag); + + + BOOST_PYTHON_MODULE(nett_python) { def("initialize", &nett::initialize); + + class_ < nett::slot_in < string_message >, boost::noncopyable >( "slot_in_string", no_init ); } \ No newline at end of file diff --git a/tests/create_slot.py b/tests/create_slot.py index c929681..767be4f 100644 --- a/tests/create_slot.py +++ b/tests/create_slot.py @@ -1,2 +1,11 @@ import nett_python as nett -nett.initialize("tcp://127.0.0.1:6555") +import string_message_pb2 + +nett.initialize("tcp://127.0.0.1:65551") + +message = string_message_pb2.string_message() +message.value = 'hi there' + +byte_stream = message.SerializeToString() + + -- GitLab