diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8cd6dae..4f6e22f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,14 +2,14 @@ version: 2
jobs:
build:
docker:
- - image: ubuntu:18.04
+ - image: ubuntu:22.04
steps:
- run:
name: apt-get
- command: apt update && apt -y install build-essential gcc g++ cmake git wget libgoogle-glog-dev libboost-test-dev libboost-filesystem-dev libboost-serialization-dev libboost-system-dev pkg-config libeigen3-dev libclass-loader-dev libtinyxml-dev librosconsole-bridge-dev
- - run:
- name: fix-class-loader-pkg-config
- command: "sed -i '/Libs:/c\\Libs: -lclass_loader -lboost_filesystem -lboost_thread -lboost_system -lpthread -lPocoFoundation -ldl -lconsole_bridge' /usr/lib/x86_64-linux-gnu/pkgconfig/class_loader.pc"
+ command: apt update && apt -y install build-essential gcc g++ cmake git wget libgoogle-glog-dev libboost-test-dev libboost-filesystem-dev libboost-serialization-dev libboost-system-dev pkg-config libeigen3-dev libtinyxml-dev librosconsole-bridge-dev libpoco-dev
+ # - run:
+ # name: fix-class-loader-pkg-config
+ # command: "sed -i '/Libs:/c\\Libs: -lclass_loader -lboost_filesystem -lboost_thread -lboost_system -lpthread -lPocoFoundation -ldl -lconsole_bridge' /usr/lib/x86_64-linux-gnu/pkgconfig/class_loader.pc"
- checkout
- run:
name: chmod install script
diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
new file mode 100644
index 0000000..33fa881
--- /dev/null
+++ b/.github/workflows/build_and_test.yml
@@ -0,0 +1,42 @@
+# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
+# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
+name: CMake on a single platform
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+
+env:
+ # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
+ BUILD_TYPE: Release
+
+jobs:
+ build:
+ # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
+ # You can convert this to a matrix build if you need cross-platform coverage.
+ # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
+ runs-on: ubuntu-22.04
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: apt-get
+ run: sudo apt update && sudo apt install -y build-essential gcc g++ cmake git wget libgoogle-glog-dev libboost-test-dev libboost-filesystem-dev libboost-serialization-dev libboost-system-dev pkg-config libeigen3-dev libclass-loader-dev libtinyxml-dev librosconsole-bridge-dev
+
+ - name: fix-class-loader-pkg-config
+ run: "sudo sed -i '/Libs:/c\\Libs: -lclass_loader -lboost_filesystem -lboost_thread -lboost_system -lpthread -lPocoFoundation -ldl -lconsole_bridge' /usr/lib/x86_64-linux-gnu/pkgconfig/class_loader.pc"
+
+ - name: cmake and dep install
+ run: mkdir build && cd build && cmake -DINSTALL_DEPS=ON -DROCK_TEST_ENABLED=ON ..
+
+ - name: compile lib
+ run: cd build && make -j2 install
+
+ - name: test_suit
+ run: ./test/test_suite
+
+ - name: test_plugins
+ run: export LD_LIBRARY_PATH=/usr/local/lib && ./test/test_plugins
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4b1994..856cb10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,12 +2,23 @@
# executed from 'project/build' with 'cmake ../'.
cmake_minimum_required(VERSION 3.9)
project(envire_core VERSION 0.1 DESCRIPTION "Envire Graph Core Library")
+
+
+if(INSTALL_DEPS)
+ execute_process(COMMAND bash build.bash ${CMAKE_INSTALL_PREFIX}
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/source_dependencies)
+ set(ENV{PKG_CONFIG_PATH} ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/)
+ set(ENV{CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX}/share/rock/cmake/)
+endif()
+
+
find_package(Rock)
set(ROCK_TEST_ENABLED ON CACHE BOOL "set to ON to enable the unit tests")
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
option(COVERAGE "Enable code coverage. run 'make test && make coverage' to generate the coverage report. The report will be in ${CMAKE_BINARY_DIR}/cov" OFF)
+
find_package(PkgConfig REQUIRED)
pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader_melodic)
if(PLUGIN_LIBS_FOUND)
@@ -38,5 +49,6 @@ if(COVERAGE)
endif()
rock_init()
+rock_feature(NOCURDIR)
rock_standard_layout()
diff --git a/README.asciidoc b/README.asciidoc
index 36a8028..3690848 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -37,20 +37,38 @@ apt install build-essential gcc g++ cmake git wget libgoogle-glog-dev libboost-t
----
Some dependencies need to be build from source. A script is provided to install those:
+
+==== Install Dependencies Automatically when building envire core
+
+Defining -DINSTALL_DEPS=ON for cmake builds and isntalls the source dependencies automatically.
+
+[source,bash]
+----
+mkdir build
+cd build
+cmake -DINSTALL_DEPS=ON ..
+make install
+----
+
+When -DCMAKE_INSTALL_PREFIX is used, the dependencies are also installed there.
+
+The install script generates an `env.sh` file in the CMAKE_INSTALL_PREFIX folder. If you did not install system wide, source this file before building and running code. It exports all neccessary environment variables.
+
+==== Install Dependencies Manually
+
[source,bash]
----
-chmod +x install_dependencies.sh
-sudo ./install_dependencies.sh [path_to_prefix]
+cd source_dependencies
+sudo bash ./build.bash [path_to_prefix]
----
-If no prefix is provided, the dependencies will be installed system-wide.
-The install script generates an `env.sh` file. Source this file before building. It exports all neccessary environment variables.
----
-source env.sh
+source [path_to_prefix]/env.sh
----
-After all dependencies have been installed, build and install like any other cmake project.
+After all dependencies have been installed, go to the main folder build and install like any other cmake project.
----
+cd ..
mkdir build
cd build
cmake ..
@@ -58,6 +76,7 @@ make install
----
+
=== Test Coverage and API Documentation
Run `make doc` to generate the API documentation.
diff --git a/install_dependencies.sh b/install_dependencies.sh
index 2b4087e..5521845 100755
--- a/install_dependencies.sh
+++ b/install_dependencies.sh
@@ -52,6 +52,7 @@ build https://github.com/rock-core/base-logging.git master base-logging "$PREFIX
build https://github.com/rock-core/base-types.git master base-types "-DBINDINGS_RUBY=OFF -DUSE_SISL=OFF -DROCK_VIZ_ENABLED=FALSE $PREFIX"
build https://github.com/envire/base-numeric.git master base-numeric "$PREFIX"
build https://github.com/envire/base-boost_serialization.git master base-boost_serialization "$PREFIX"
+build https://github.com/dfki-ric/class_loader melodic-devel class_loader_melodic "$PREFIX"
#plugins
build https://github.com/envire/tools-plugin_manager.git master tools-plugin_manager "$PREFIX"
diff --git a/manifest.xml b/manifest.xml
index e0d2caf..6988511 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -41,8 +41,8 @@
-
-
+
+
active
diff --git a/source_dependencies/CMakeLists.txt b/source_dependencies/CMakeLists.txt
new file mode 100644
index 0000000..3e2c5fe
--- /dev/null
+++ b/source_dependencies/CMakeLists.txt
@@ -0,0 +1,73 @@
+
+
+cmake_minimum_required(VERSION 3.10)
+
+#https://stackoverflow.com/questions/15175318/cmake-how-to-build-external-projects-and-include-their-targets
+#https://crascit.com/2015/07/25/cmake-gtest/
+
+include(ExternalProject)
+
+ExternalProject_Add(base-cmake
+ GIT_REPOSITORY https://github.com/rock-core/base-cmake.git
+ GIT_TAG master
+ INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
+ CMAKE_CACHE_ARGS -DENV{PKG_CONFIG_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/
+ -DENV{CMAKE_PREFIX_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/share/rock/cmake/
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
+)
+
+ExternalProject_Add(base-logging
+ GIT_REPOSITORY https://github.com/rock-core/base-logging.git
+ GIT_TAG master
+ INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
+ CMAKE_CACHE_ARGS -DENV{PKG_CONFIG_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/
+ -DENV{CMAKE_PREFIX_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/share/rock/cmake/
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
+)
+add_dependencies(base-logging base-cmake)
+
+ExternalProject_Add(base-types
+ GIT_REPOSITORY https://github.com/rock-core/base-types.git
+ GIT_TAG master
+ INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
+ CMAKE_CACHE_ARGS -DENV{PKG_CONFIG_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/
+ -DENV{CMAKE_PREFIX_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/share/rock/cmake/
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
+ -DBINDINGS_RUBY=OFF
+ -DUSE_SISL=OFF
+ -DROCK_VIZ_ENABLED=FALSE
+)
+add_dependencies(base-types base-logging)
+
+ExternalProject_Add(base-numeric
+ GIT_REPOSITORY https://github.com/envire/base-numeric.git
+ GIT_TAG master
+ INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
+ CMAKE_CACHE_ARGS -DENV{PKG_CONFIG_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/
+ -DENV{CMAKE_PREFIX_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/share/rock/cmake/
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
+)
+add_dependencies(base-numeric base-types)
+
+ExternalProject_Add(base-boost_serialization
+ GIT_REPOSITORY https://github.com/envire/base-boost_serialization.git
+ GIT_TAG master
+ INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
+ CMAKE_CACHE_ARGS -DENV{PKG_CONFIG_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/
+ -DENV{CMAKE_PREFIX_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/share/rock/cmake/
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
+)
+add_dependencies(base-boost_serialization base-numeric)
+
+ExternalProject_Add(tools-plugin_manager
+ GIT_REPOSITORY https://github.com/envire/tools-plugin_manager.git
+ GIT_TAG master
+ INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
+ CMAKE_CACHE_ARGS -DENV{PKG_CONFIG_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/
+ -DENV{CMAKE_PREFIX_PATH}:STRING=${CMAKE_INSTALL_PREFIX}/share/rock/cmake/
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
+)
+add_dependencies(tools-plugin_manager base-boost_serialization)
+
+configure_file(env.sh.in ${PROJECT_SOURCE_DIR}/env.sh)
+install(FILES ${PROJECT_SOURCE_DIR}/env.sh DESTINATION ${CMAKE_INSTALL_PREFIX})
diff --git a/source_dependencies/build.bash b/source_dependencies/build.bash
new file mode 100644
index 0000000..dbecd1e
--- /dev/null
+++ b/source_dependencies/build.bash
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if [ "$#" -ne 1 ]; then
+ echo
+ echo "Please specify a prefix. If you want system wide installation use '/usr/local' as prefix. for a local install use e.g. './install'"
+ echo "In case you use a local prefix, please source the generated env.sh script in this folder to set up the paths before building the main library"
+ echo
+ exit -1
+fi
+
+if [[ $1 != .* && $1 != /* ]]; then
+ echo
+ echo -e "\033[1;33mPlease specify a global path or a local path with '/' or './' \033[1;0m"
+ echo
+ exit -1
+fi
+
+#download and build (in subshell to return to original folder)
+
+INSTALLPATH=$(realpath $1)
+
+mkdir -p build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX=${INSTALLPATH} ..
+make -j install
+
+if [[ $1 = .* ]]; then
+ echo
+ echo -e "\033[1;33m'source ${INSTALLPATH}/env.sh' in this folder before building the main library \033[1;0m"
+ echo
+fi
\ No newline at end of file
diff --git a/source_dependencies/env.sh.in b/source_dependencies/env.sh.in
new file mode 100644
index 0000000..6ae305f
--- /dev/null
+++ b/source_dependencies/env.sh.in
@@ -0,0 +1,4 @@
+export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@/share/rock/cmake/
+export PKG_CONFIG_PATH=@CMAKE_INSTALL_PREFIX@/lib/pkgconfig/
+export LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@CMAKE_INSTALL_PREFIX@/lib64:$LD_LIBRARY_PATH
+export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH
\ No newline at end of file
diff --git a/source_dependencies/install_os_dependencies.bash b/source_dependencies/install_os_dependencies.bash
new file mode 100644
index 0000000..e0804e8
--- /dev/null
+++ b/source_dependencies/install_os_dependencies.bash
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+sudo apt install build-essential gcc g++ cmake git wget libgoogle-glog-dev libboost-test-dev libboost-filesystem-dev libboost-serialization-dev libboost-system-dev pkg-config libeigen3-dev libclass-loader-dev libtinyxml-dev librosconsole-bridge-dev
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 079071b..3f327ba 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -78,7 +78,7 @@ rock_library(envire_core
SOURCES ${sources}
DEPS_CMAKE Glog
DEPS_PKGCONFIG ${deps_pkg_config}
- DEPS
+ DEPS_TARGET
Boost::filesystem
Boost::serialization
Boost::system
diff --git a/src/events/GraphEventDispatcher.cpp b/src/events/GraphEventDispatcher.cpp
index 3da9ac1..617979c 100644
--- a/src/events/GraphEventDispatcher.cpp
+++ b/src/events/GraphEventDispatcher.cpp
@@ -104,6 +104,65 @@ void GraphEventDispatcher::waitForFrame(const std::string &framename)
waitingForFrames.push_back(framename);
}
+void GraphEventDispatcher::addEdgeAddedEventCallback(std::function cb) {
+ edgeAddedCallbacks.push_back(cb);
+}
+void GraphEventDispatcher::addEdgeRemovedEventCallback(std::function cb) {
+ edgeRemovedCallbacks.push_back(cb);
+}
+void GraphEventDispatcher::addEdgeModifiedEventCallback(std::function cb) {
+ edgeModifiedCallbacks.push_back(cb);
+}
+void GraphEventDispatcher::addFrameAddedEventCallback(std::function cb) {
+ frameAddedCallbacks.push_back(cb);
+}
+void GraphEventDispatcher::addFrameRemovedEventCallback(std::function cb) {
+ frameRemovedCallbacks.push_back(cb);
+}
+void GraphEventDispatcher::addItemAddedEventCallback(std::function cb) {
+ itemAddedCallbacks.push_back(cb);
+}
+void GraphEventDispatcher::addItemRemovedEventCallback(std::function cb) {
+ itemRemovedCallbacks.push_back(cb);
+}
+
+
+void GraphEventDispatcher::edgeAdded(const envire::core::EdgeAddedEvent& e) {
+ for (const auto& cb : edgeAddedCallbacks){
+ cb(e);
+ }
+}
+void GraphEventDispatcher::edgeRemoved(const envire::core::EdgeRemovedEvent& e) {
+ for (const auto& cb : edgeRemovedCallbacks){
+ cb(e);
+ }
+}
+void GraphEventDispatcher::edgeModified(const envire::core::EdgeModifiedEvent& e) {
+ for (const auto& cb : edgeModifiedCallbacks){
+ cb(e);
+ }
+}
+void GraphEventDispatcher::frameAdded(const envire::core::FrameAddedEvent& e) {
+ for (const auto& cb : frameAddedCallbacks){
+ cb(e);
+ }
+}
+void GraphEventDispatcher::frameRemoved(const envire::core::FrameRemovedEvent& e) {
+ for (const auto& cb : frameRemovedCallbacks){
+ cb(e);
+ }
+}
+void GraphEventDispatcher::itemAdded(const envire::core::ItemAddedEvent& e) {
+ for (const auto& cb : itemAddedCallbacks){
+ cb(e);
+ }
+}
+void GraphEventDispatcher::itemRemoved(const envire::core::ItemRemovedEvent& e) {
+ for (const auto& cb : itemRemovedCallbacks){
+ cb(e);
+ }
+}
+
bool GraphEventDispatcher::checkWaitingForFrames(const FrameAddedEvent& frameAddedEvent)
{
// check if all frames are available, delete entires if they are
diff --git a/src/events/GraphEventDispatcher.hpp b/src/events/GraphEventDispatcher.hpp
index ae9f8d4..f6681c6 100644
--- a/src/events/GraphEventDispatcher.hpp
+++ b/src/events/GraphEventDispatcher.hpp
@@ -28,6 +28,8 @@
#include
#include
#include
+#include
+#include
namespace envire { namespace core
@@ -69,6 +71,14 @@ namespace envire { namespace core
return enabled;
}
+ void addEdgeAddedEventCallback(std::function cb);
+ void addEdgeRemovedEventCallback(std::function cb);
+ void addEdgeModifiedEventCallback(std::function cb);
+ void addFrameAddedEventCallback(std::function cb);
+ void addFrameRemovedEventCallback(std::function cb);
+ void addItemAddedEventCallback(std::function cb);
+ void addItemRemovedEventCallback(std::function cb);
+
/**
* @brief define a frame requirement, this GraphEventDispatcher stays disables until checkFramesAvailable() is successful
* @warning checkFramesAvailable() must be called manually by your application
@@ -83,16 +93,25 @@ namespace envire { namespace core
bool checkWaitingForFrames(const FrameAddedEvent& frameAddedEvent);
protected:
- virtual void edgeAdded(const EdgeAddedEvent& e) {}
- virtual void edgeRemoved(const EdgeRemovedEvent& e) {}
- virtual void edgeModified(const EdgeModifiedEvent& e) {}
- virtual void frameAdded(const FrameAddedEvent& e) {}
- virtual void frameRemoved(const FrameRemovedEvent& e) {}
- virtual void itemAdded(const ItemAddedEvent& e) {}
- virtual void itemRemoved(const ItemRemovedEvent& e) {}
+ virtual void edgeAdded(const EdgeAddedEvent& e);
+ virtual void edgeRemoved(const EdgeRemovedEvent& e);
+ virtual void edgeModified(const EdgeModifiedEvent& e);
+ virtual void frameAdded(const FrameAddedEvent& e);
+ virtual void frameRemoved(const FrameRemovedEvent& e);
+ virtual void itemAdded(const ItemAddedEvent& e);
+ virtual void itemRemoved(const ItemRemovedEvent& e);
private:
bool enabled;
+
+ std::list> edgeAddedCallbacks;
+ std::list> edgeRemovedCallbacks;
+ std::list> edgeModifiedCallbacks;
+ std::list> frameAddedCallbacks;
+ std::list> frameRemovedCallbacks;
+ std::list> itemAddedCallbacks;
+ std::list> itemRemovedCallbacks;
+
bool isWaitingForFrame;
std::list waitingForFrames;
};
diff --git a/src/util/EnvireManager.cpp b/src/util/EnvireManager.cpp
index 77f8ed2..d061be5 100644
--- a/src/util/EnvireManager.cpp
+++ b/src/util/EnvireManager.cpp
@@ -24,13 +24,14 @@ EnvireManager::EnvireManager() {
EnvireManager::~EnvireManager() {}
-EnvireGraphPtr EnvireManager::getInstance(std::string name) {
+EnvireGraphPtr EnvireManager::getInstance(std::string name, bool force_recreate) {
EnvireGraphPtr graph = graphs[name];
if (!graph.get()){
//create
graph = EnvireGraphPtr(new ThreadSaveEnvireGraph());
graphs[name] = graph;
-
+ } else if (force_recreate) {
+ graph.reset(new ThreadSaveEnvireGraph());
}
return graph;
}
diff --git a/src/util/EnvireManager.hpp b/src/util/EnvireManager.hpp
index f9b3d73..b0b8495 100644
--- a/src/util/EnvireManager.hpp
+++ b/src/util/EnvireManager.hpp
@@ -26,7 +26,7 @@ class EnvireManager {
typedef std::map GraphMap;
- static EnvireGraphPtr getInstance(std::string name);
+ static EnvireGraphPtr getInstance(std::string name, bool force_recreate = false);
EnvireManager();
diff --git a/src/util/ThreadSaveEnvireGraph.hpp b/src/util/ThreadSaveEnvireGraph.hpp
index e6e9dad..1e689a5 100644
--- a/src/util/ThreadSaveEnvireGraph.hpp
+++ b/src/util/ThreadSaveEnvireGraph.hpp
@@ -84,6 +84,11 @@ class ThreadSaveEnvireGraph {
graph->addFrame(name);
}
+ void removeFrame(const envire::core::FrameId& name) {
+ std::lock_guard lock(mutex);
+ graph->removeFrame(name);
+ }
+
bool containsFrame(const envire::core::FrameId& name) {
std::lock_guard lock(mutex);
return graph->containsFrame(name);
@@ -133,6 +138,10 @@ class ThreadSaveEnvireGraph {
* Items
***********/
+ void addItem(envire::core::ItemBase::Ptr item) {
+ std::lock_guard lock(mutex);
+ graph->addItem(item);
+ }
void addItemToFrame(const envire::core::FrameId& frameId, envire::core::ItemBase::Ptr item) {
std::lock_guard lock(mutex);
@@ -154,6 +163,11 @@ class ThreadSaveEnvireGraph {
return graph->getItems(frame, type);
}
+ template void visitItems(const FrameId& frameId, T func) {
+ std::lock_guard lock(mutex);
+ graph->visitItems(frameId, func);
+ }
+
/**
* @brief lock the protected variable manually to allow a reference access
*/
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d9e7f41..9625f2b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -59,7 +59,9 @@ rock_testsuite(test_suite suite.cpp
test_item_changed_callback.cpp
test_graph_event_dispatcher.cpp
PathSingleton.cpp
- DEPS_PKGCONFIG class_loader_melodic
+ DEPS_PKGCONFIG
+ plugin_manager
+ class_loader_melodic
DEPS
envire_core
DEPS_PLAIN
diff --git a/test/test_item_changed_callback.cpp b/test/test_item_changed_callback.cpp
index 2fc52e6..b013d5f 100644
--- a/test/test_item_changed_callback.cpp
+++ b/test/test_item_changed_callback.cpp
@@ -73,7 +73,7 @@ struct ItemCallbackSubscriber : public GraphItemEventDispatcher- >
virtual void itemRemoved(const TypedItemRemovedEvent
- >& event)
{
if (event.item->getFrame() == targetFrame){
- event.item->disconnectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1));
+ event.item->disconnectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1));
}
}
@@ -147,14 +147,14 @@ BOOST_AUTO_TEST_CASE(item_changed_callback_bind)
ItemContentReactor reactor;
graph.addItemToFrame(frame, item);
- item->connectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1));
+ item->connectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1));
item->contentsChanged();
BOOST_CHECK(reactor.called == true);
BOOST_CHECK(reactor.frame == frame);
reactor.reset();
- item->disconnectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1));
+ item->disconnectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1));
item->contentsChanged();
BOOST_CHECK(reactor.called == false);
diff --git a/viz/CMakeLists.txt b/viz/CMakeLists.txt
index b97321a..8c13465 100644
--- a/viz/CMakeLists.txt
+++ b/viz/CMakeLists.txt
@@ -1,12 +1,11 @@
-# temporary quick fix: dont build visualisation plugins for qt4
-if (${USE_QT5})
- SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
- find_package(Boost COMPONENTS system thread REQUIRED)
- rock_find_qt5(Core Gui Svg)
+find_package(Boost COMPONENTS system thread REQUIRED)
+rock_find_qt4(OPTIONAL QtSvg)
+rock_find_qt5(OPTIONAL Svg)
- add_subdirectory(EnvireGraphStructureVisualization)
- add_subdirectory(EnvireGraph2DStructureVisualization)
-endif (${USE_QT5})
+include(RockQt)
+add_subdirectory(EnvireGraphStructureVisualization)
+add_subdirectory(EnvireGraph2DStructureVisualization)
diff --git a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt
index a3eaa86..797ab9e 100644
--- a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt
+++ b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt
@@ -1,4 +1,7 @@
-rock_library(envire_2D_structure_widget
+
+rock_qt_library(
+ TARGETPREFIX envire_2D_structure_widget
+ QT4_SUFFIX ""
MOC EnvireGraph2DStructurWidget.hpp
QZoomableGraphicsView.hpp
HEADERS EnvireGraph2DStructurWidget.hpp
@@ -6,15 +9,18 @@ rock_library(envire_2D_structure_widget
SOURCES EnvireGraph2DStructurWidget.cpp
QZoomableGraphicsView.cpp
DEPS_PKGCONFIG libgvc
- LIBS Qt5::Core Qt5::Gui Qt5::Svg
- DEPS envire_core)
-
+ LIBS_QT4 Qt4::QtSvg
+ LIBS_QT5 Qt5::Svg
+ DEPS envire_core)
-rock_vizkit_widget(EnvireGraph2DStructureVisualization
+rock_qt_vizkit_widget(
+ TARGETPREFIX EnvireGraph2DStructureVisualization
+ QT4_SUFFIX ""
+ MISSINGQTDEPS_NOBUILD
SOURCES EnvireGraph2DStructureVisualizationPlugin.cpp
HEADERS EnvireGraph2DStructureVisualization.hpp
MOC EnvireGraph2DStructureVisualization.hpp
EnvireGraph2DStructureVisualizationPlugin.hpp
- LIBS Qt5::Core Qt5::Gui
- DEPS envire_2D_structure_widget
+ DEPS_QT envire_2D_structure_widget
)
+
diff --git a/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualization-qt5.pc.in b/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualization-qt5.pc.in
new file mode 100644
index 0000000..dff22b9
--- /dev/null
+++ b/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualization-qt5.pc.in
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: @TARGET_NAME@
+Description: @PROJECT_DESCRIPTION@
+Version: @PROJECT_VERSION@
+Requires: @PKGCONFIG_REQUIRES@
+Libs: -L${libdir} -l@TARGET_NAME@ @PKGCONFIG_LIBS@
+Cflags: -I${includedir} @PKGCONFIG_CFLAGS@
+
diff --git a/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.cpp b/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.cpp
index c5c5a1a..31b5eff 100644
--- a/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.cpp
+++ b/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.cpp
@@ -27,6 +27,10 @@
#include "EnvireGraph2DStructureVisualizationPlugin.hpp"
#include "EnvireGraph2DStructureVisualization.hpp"
+#if QT_VERSION < 0x050000
+Q_EXPORT_PLUGIN2(EnvireGraph2DStructureVisualization, EnvireGraph2DStructureVisualizationPlugin)
+#endif
+
EnvireGraph2DStructureVisualizationPlugin::EnvireGraph2DStructureVisualizationPlugin(QObject *parent)
: QObject(parent)
{
diff --git a/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.hpp b/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.hpp
index 2518468..afd53c9 100644
--- a/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.hpp
+++ b/viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualizationPlugin.hpp
@@ -28,12 +28,20 @@
#define ENVIREGRAPH2DSTRUCTUREVISUALIZATION2PLUGIN_HPP
#include
+#if QT_VERSION >= 0x050000
+#include
+#else
#include
+#endif
class EnvireGraph2DStructureVisualizationPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
+#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.qt-project.QDesignerCustomWidgetInterface")
+#else
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+#endif
public:
EnvireGraph2DStructureVisualizationPlugin(QObject *parent = 0);
diff --git a/viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget-qt5.pc.in b/viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget-qt5.pc.in
new file mode 100644
index 0000000..97dfe13
--- /dev/null
+++ b/viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget-qt5.pc.in
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: @TARGET_NAME@
+Description: envire 2D structure widget
+Requires: Qt5Core Qt5Gui Qt5Svg envire_core libgvc @PKGCONFIG_DEPS@
+Version: @PROJECT_VERSION@
+Libs: -L${libdir} -l@TARGET_NAME@
+Cflags: -I${includedir}
+
diff --git a/viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget.pc.in b/viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget.pc.in
index f1eebad..2c52568 100644
--- a/viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget.pc.in
+++ b/viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget.pc.in
@@ -3,10 +3,10 @@ exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include
-Name: envire_2D_structure_widget
+Name: @TARGET_NAME@
Description: envire 2D structure widget
-Requires: Qt5Core Qt5Gui Qt5Svg envire_core libgvc @PKGCONFIG_DEPS@
+Requires: QtCore QtGui QtSvg envire_core libgvc @PKGCONFIG_DEPS@
Version: @PROJECT_VERSION@
-Libs: -L${libdir} -lenvire_2D_structure_widget
+Libs: -L${libdir} -l@TARGET_NAME@
Cflags: -I${includedir}
diff --git a/viz/EnvireGraphStructureVisualization/CMakeLists.txt b/viz/EnvireGraphStructureVisualization/CMakeLists.txt
index ff00b51..7f65fbd 100644
--- a/viz/EnvireGraphStructureVisualization/CMakeLists.txt
+++ b/viz/EnvireGraphStructureVisualization/CMakeLists.txt
@@ -1,6 +1,10 @@
-rock_vizkit_plugin(envire_core-viz
- EnvireGraphStructureVisualization.cpp
+
+rock_qt_vizkit_plugin(
+ TARGETPREFIX envire_core-viz
+ QT4_SUFFIX ""
+ MISSINGQTDEPS_NOBUILD
+ SOURCES EnvireGraphStructureVisualization.cpp
MOC EnvireGraphStructureVisualization.hpp
HEADERS EnvireGraphStructureVisualization.hpp
- DEPS envire_core
- LIBS Qt5::Core Qt5::Gui Qt5::Widgets)
\ No newline at end of file
+ DEPS envire_core)
+
diff --git a/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.cpp b/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.cpp
index 5fe8ee8..cd7f5a3 100644
--- a/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.cpp
+++ b/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.cpp
@@ -216,3 +216,7 @@ bool EnvireGraphStructureVisualization::areSame(const QStringList& a, const QStr
return true;
}
+namespace vizkit3d
+{
+ VizkitQtPluginImpl(EnvireGraphStructureVisualization)
+}
diff --git a/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.hpp b/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.hpp
index e76e107..70a9446 100644
--- a/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.hpp
+++ b/viz/EnvireGraphStructureVisualization/EnvireGraphStructureVisualization.hpp
@@ -90,7 +90,7 @@ namespace vizkit3d
std::unique_ptr p;
};
- VizkitQtPlugin(EnvireGraphStructureVisualization)
+ VizkitQtPluginHeaderDecls(EnvireGraphStructureVisualization)
}
#endif
diff --git a/viz/EnvireGraphStructureVisualization/envire_core-viz-qt5.pc.in b/viz/EnvireGraphStructureVisualization/envire_core-viz-qt5.pc.in
new file mode 100644
index 0000000..8d1a889
--- /dev/null
+++ b/viz/EnvireGraphStructureVisualization/envire_core-viz-qt5.pc.in
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: envire_core-viz-qt5
+Description: vizKit plugin for the envire_core library
+Requires: envire_core @PKGCONFIG_DEPS@
+Version: @PROJECT_VERSION@
+Libs: -L${libdir} -lenvire_core-viz-qt5
+Cflags: -I${includedir}
+