From 9089b48b9ae6bb250405989268505357b11e3d2f Mon Sep 17 00:00:00 2001 From: Olivier Stasse <ostasse@laas.fr> Date: Mon, 17 Apr 2023 06:49:35 +0200 Subject: [PATCH] Add python bindings for the test impl_test_sot_mock_device --- tests/CMakeLists.txt | 29 +++++++++++++++++-- ...l_test_sot_mock_device-python-module-py.cc | 20 +++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tests/impl_test_sot_mock_device-python-module-py.cc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 720c139..7ffb1d8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,9 +10,34 @@ if(BUILD_TESTING) find_package(launch_testing_ament_cmake) ament_lint_auto_find_test_dependencies() + # Library for sot_mock_device + add_library(impl_test_sot_mock_device SHARED impl_test_sot_mock_device.cpp) + set_target_properties(impl_test_sot_mock_device PROPERTIES INSTALL_RPATH + $ORIGIN) + # target_include_directories(impl_test_sot_mock_device PUBLIC include) + target_link_libraries( + impl_test_sot_mock_device PUBLIC sot-core::sot-core + dynamic-graph-python::dynamic-graph-python) + + install( + TARGETS impl_test_sot_mock_device + EXPORT ${TARGETS_EXPORT_NAME} + DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR}) + + file(MAKE_DIRECTORY + ${PROJECT_BINARY_DIR}/tests/dynamic_graph/ros/impl_test_sot_mock_device) + + dynamic_graph_python_module( + "${PYTHON_DIR}/ros/impl_test_sot_mock_device" impl_test_sot_mock_device + dynamic_graph_bridge-impl_test_sot_mock_device-wrap SOURCE_PYTHON_MODULE + "${CMAKE_CURRENT_SOURCE_DIR}/impl_test_sot_mock_device-python-module-py.cc") + + install( + TARGETS ${plugin_library_name} + EXPORT ${TARGETS_EXPORT_NAME} + DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR}) # Library for sot_external_interface - add_library(impl_test_library SHARED impl_test_sot_external_interface.cpp - impl_test_sot_mock_device.cpp) + add_library(impl_test_library SHARED impl_test_sot_external_interface.cpp) target_include_directories(impl_test_library PUBLIC include) target_link_libraries(impl_test_library PUBLIC sot-core::sot-core) diff --git a/tests/impl_test_sot_mock_device-python-module-py.cc b/tests/impl_test_sot_mock_device-python-module-py.cc new file mode 100644 index 0000000..92b69d2 --- /dev/null +++ b/tests/impl_test_sot_mock_device-python-module-py.cc @@ -0,0 +1,20 @@ +/* + * Copyright 2023, LAAS, CNRS + * + * Author:Olivier Stasse + * + * This file is part of dynamic_graph_bridge. + * This file is under the APACHE license 2.0 + * + */ +#include <dynamic-graph/python/module.hh> + +#include "impl_test_sot_mock_device.hh" +namespace dg = dynamicgraph; + +BOOST_PYTHON_MODULE(wrap) { + bp::import("dynmic_graph.sot.core.wrap"); + + dg::python::exposeEntity<ImplTestSotMockDevice, + bp::bases<dg::sot::Device> >(); +} -- GitLab