From 51964ddbd3c3976c20e1186f407a9546a3203c0a Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Wed, 5 Apr 2023 11:19:39 +0200 Subject: [PATCH 01/35] Allow building of qt4 and qt5 version side-by-side --- CMakeLists.txt | 1 + .../CMakeLists.txt | 34 ++++++++++++++++--- ...ireGraph2DStructureVisualizationPlugin.cpp | 4 +++ ...ireGraph2DStructureVisualizationPlugin.hpp | 8 +++++ .../CMakeLists.txt | 4 +-- .../EnvireGraphStructureVisualization.cpp | 4 +++ .../EnvireGraphStructureVisualization.hpp | 2 +- .../envire_core-viz-qt5.pc.in | 12 +++++++ 8 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 viz/EnvireGraphStructureVisualization/envire_core-viz-qt5.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 51fc9b7..448863c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,5 +38,6 @@ if(COVERAGE) endif() rock_init() +rock_feature(NOCURDIR) rock_standard_layout() diff --git a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt index a3eaa86..ad28baf 100644 --- a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt @@ -1,4 +1,8 @@ -rock_library(envire_2D_structure_widget +rock_find_qt4(OPTIONAL Svg) +rock_find_qt5(OPTIONAL Svg) + +if(ROCK_QT_VERSION_4) +rock_library(envire_2D_structure_widget MOC EnvireGraph2DStructurWidget.hpp QZoomableGraphicsView.hpp HEADERS EnvireGraph2DStructurWidget.hpp @@ -6,15 +10,35 @@ 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::QtSvg + DEPS envire_core) rock_vizkit_widget(EnvireGraph2DStructureVisualization SOURCES EnvireGraph2DStructureVisualizationPlugin.cpp HEADERS EnvireGraph2DStructureVisualization.hpp MOC EnvireGraph2DStructureVisualization.hpp EnvireGraph2DStructureVisualizationPlugin.hpp - LIBS Qt5::Core Qt5::Gui DEPS envire_2D_structure_widget ) +endif() + +if(ROCK_QT_VERSION_5) +rock_library(envire_2D_structure_widget-qt5 + MOC5 EnvireGraph2DStructurWidget.hpp + QZoomableGraphicsView.hpp + HEADERS EnvireGraph2DStructurWidget.hpp + QZoomableGraphicsView.hpp + SOURCES EnvireGraph2DStructurWidget.cpp + QZoomableGraphicsView.cpp + DEPS_PKGCONFIG libgvc + LIBS Qt5::Svg + DEPS envire_core) + +rock_vizkit_widget(EnvireGraph2DStructureVisualization-qt5 + SOURCES EnvireGraph2DStructureVisualizationPlugin.cpp + HEADERS EnvireGraph2DStructureVisualization.hpp + MOC5 EnvireGraph2DStructureVisualization.hpp + EnvireGraph2DStructureVisualizationPlugin.hpp + DEPS envire_2D_structure_widget-qt5 +) +endif() 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/EnvireGraphStructureVisualization/CMakeLists.txt b/viz/EnvireGraphStructureVisualization/CMakeLists.txt index ff00b51..a3e1dee 100644 --- a/viz/EnvireGraphStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraphStructureVisualization/CMakeLists.txt @@ -1,6 +1,6 @@ -rock_vizkit_plugin(envire_core-viz +rock_vizkit_plugin_qt5(envire_core-viz-qt5 EnvireGraphStructureVisualization.cpp MOC EnvireGraphStructureVisualization.hpp HEADERS EnvireGraphStructureVisualization.hpp DEPS envire_core - LIBS Qt5::Core Qt5::Gui Qt5::Widgets) \ No newline at end of file + LIBS Qt5::Core Qt5::Gui Qt5::Widgets) 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} + From fa31e0a2316f90c5a21d3c4710785ac72eb723c0 Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Fri, 11 Aug 2023 13:16:03 +0200 Subject: [PATCH 02/35] Actually build both versions, fix .pc files --- viz/CMakeLists.txt | 3 ++- .../CMakeLists.txt | 2 -- .../envire_2D_structure_widget-qt5.pc.in | 12 ++++++++++ .../envire_2D_structure_widget.pc.in | 6 ++--- .../CMakeLists.txt | 24 ++++++++++++++----- 5 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 viz/EnvireGraph2DStructureVisualization/envire_2D_structure_widget-qt5.pc.in diff --git a/viz/CMakeLists.txt b/viz/CMakeLists.txt index 5650088..35d4879 100644 --- a/viz/CMakeLists.txt +++ b/viz/CMakeLists.txt @@ -1,7 +1,8 @@ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") find_package(Boost COMPONENTS system thread REQUIRED) -rock_find_qt5(Core Gui Svg) +rock_find_qt4(OPTIONAL QtSvg) +rock_find_qt5(OPTIONAL Svg) add_subdirectory(EnvireGraphStructureVisualization) add_subdirectory(EnvireGraph2DStructureVisualization) diff --git a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt index ad28baf..e15d2ea 100644 --- a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt @@ -1,5 +1,3 @@ -rock_find_qt4(OPTIONAL Svg) -rock_find_qt5(OPTIONAL Svg) if(ROCK_QT_VERSION_4) rock_library(envire_2D_structure_widget 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 a3e1dee..d1c2517 100644 --- a/viz/EnvireGraphStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraphStructureVisualization/CMakeLists.txt @@ -1,6 +1,18 @@ -rock_vizkit_plugin_qt5(envire_core-viz-qt5 - EnvireGraphStructureVisualization.cpp - MOC EnvireGraphStructureVisualization.hpp - HEADERS EnvireGraphStructureVisualization.hpp - DEPS envire_core - LIBS Qt5::Core Qt5::Gui Qt5::Widgets) + +if(ROCK_QT_VERSION_4) + rock_vizkit_plugin(envire_core-viz + EnvireGraphStructureVisualization.cpp + MOC EnvireGraphStructureVisualization.hpp + HEADERS EnvireGraphStructureVisualization.hpp + DEPS envire_core + LIBS Qt4::QtCore Qt4::QtGui) +endif(ROCK_QT_VERSION_4) + +if(ROCK_QT_VERSION_5) + rock_vizkit_plugin_qt5(envire_core-viz-qt5 + EnvireGraphStructureVisualization.cpp + MOC5 EnvireGraphStructureVisualization.hpp + HEADERS EnvireGraphStructureVisualization.hpp + DEPS envire_core + LIBS Qt5::Core Qt5::Gui Qt5::Widgets) +endif(ROCK_QT_VERSION_5) From 8cd166a321b08efefb6b12d3fb3f80616bd451af Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Thu, 11 Apr 2024 11:45:52 +0200 Subject: [PATCH 03/35] New source dep install (#63) * build external libs via cmake * new source dependency install * remove unused environ var * set env variables for externals inside CMaleLists.txt * rename dependencies folder * option to install source dependencies via main cmakelists * update readme with new dep install process * CI seperate cmake (deps) and compile * CI: fix build step * update readme * Update config.yml * update build script * fix test build * fix CI * fis ci osdep install * fix ci --- .circleci/config.yml | 16 ++-- CMakeLists.txt | 11 +++ README.asciidoc | 31 ++++++-- install_dependencies.sh | 61 ---------------- source_dependencies/CMakeLists.txt | 73 +++++++++++++++++++ source_dependencies/build.bash | 31 ++++++++ source_dependencies/env.sh.in | 4 + .../install_os_dependencies.bash | 3 + test/CMakeLists.txt | 2 +- test/test_item_changed_callback.cpp | 8 +- 10 files changed, 159 insertions(+), 81 deletions(-) delete mode 100755 install_dependencies.sh create mode 100644 source_dependencies/CMakeLists.txt create mode 100644 source_dependencies/build.bash create mode 100644 source_dependencies/env.sh.in create mode 100644 source_dependencies/install_os_dependencies.bash diff --git a/.circleci/config.yml b/.circleci/config.yml index 8cd6dae..b6f3b24 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,24 +2,22 @@ version: 2 jobs: build: docker: - - image: ubuntu:18.04 + - image: ubuntu:latest 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 + command: apt update && 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 - 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 - command: chmod +x install_dependencies.sh - - run: - name: run install script - command: ./install_dependencies.sh + name: cmake and dep install + command: mkdir build && cd build && cmake -DINSTALL_DEPS=ON -DROCK_TEST_ENABLED=ON .. - run: - name: compile - command: mkdir build && cd build && cmake -DROCK_TEST_ENABLED=ON .. && make -j4 install + name: compile lib + command: cd build && make -j2 install - run: name: test_suit command: ~/project/build/test/test_suite diff --git a/CMakeLists.txt b/CMakeLists.txt index 51fc9b7..c43ad50 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) if(PLUGIN_LIBS_FOUND) 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 deleted file mode 100755 index 2b4087e..0000000 --- a/install_dependencies.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -set -e #abort with error if any command returns with something other than zero - -############ -# Install script for envire dependencies -# Run "$> sudo ./install_dependencies.sh" to install system wide -# Run "$> ./install_dependencies.sh " to install to a local prefix -############ - -function build { - - if [ -d $3 ] - then - echo "Directory $3 already exists. " - read -r -p "Do you want to delete and re-download $3? [y/N] " response - if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]] - then - rm -rf $3 - else - echo "Aborting!" - exit -1 - fi - fi - git clone --branch $2 $1 $3 - mkdir $3/build - cd $3/build - cmake .. $4 - make -j install - cd ../../ -} - - - -PREFIX="" -ABS_PREFIX="" -if [ "$#" -eq 1 ]; then -ABS_PREFIX=`readlink -f $1` -PREFIX="-DCMAKE_INSTALL_PREFIX=$ABS_PREFIX" - -echo "" > env.sh #create empty env.sh -echo "export CMAKE_PREFIX_PATH=$ABS_PREFIX" >> env.sh -echo "export PKG_CONFIG_PATH=$ABS_PREFIX/lib/pkgconfig:$ABS_PREFIX/share/pkgconfig:$ABS_PREFIX/lib64/pkgconfig:\$PKG_CONFIG_PATH" >> env.sh -echo "export LD_LIBRARY_PATH=$ABS_PREFIX/lib:$ABS_PREFIX/lib64:\$LD_LIBRARY_PATH" >> env.sh -echo "export PATH=$ABS_PREFIX/bin:\$PATH" >> env.sh - -source env.sh - -fi - -build https://github.com/rock-core/base-cmake.git master base-cmake "$PREFIX" -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" - -#plugins -build https://github.com/envire/tools-plugin_manager.git master tools-plugin_manager "$PREFIX" - - - - 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/test/CMakeLists.txt b/test/CMakeLists.txt index cb0bb61..cce8132 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -59,7 +59,7 @@ rock_testsuite(test_suite suite.cpp test_item_changed_callback.cpp test_graph_event_dispatcher.cpp PathSingleton.cpp - DEPS_PKGCONFIG class_loader + DEPS_PKGCONFIG class_loader plugin_manager DEPS envire_core DEPS_PLAIN diff --git a/test/test_item_changed_callback.cpp b/test/test_item_changed_callback.cpp index 8175302..6d07b85 100644 --- a/test/test_item_changed_callback.cpp +++ b/test/test_item_changed_callback.cpp @@ -66,14 +66,14 @@ struct ItemCallbackSubscriber : public GraphItemEventDispatcher> virtual void itemAdded(const TypedItemAddedEvent>& event) { if (event.item->getFrame() == targetFrame){ - event.item->connectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, _1)); + event.item->connectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1)); } } virtual void itemRemoved(const TypedItemRemovedEvent>& event) { if (event.item->getFrame() == targetFrame){ - event.item->disconnectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, _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, _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, _1)); + item->disconnectContentsChangedCallback(boost::bind(&ItemContentReactor::cb, &reactor, boost::placeholders::_1)); item->contentsChanged(); BOOST_CHECK(reactor.called == false); From 506cce7f335bee574576186707d1fe29e5632785 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 15 Apr 2024 16:57:11 +0200 Subject: [PATCH 04/35] use cmake targets for boost --- src/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8148d67..8625b91 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,7 +58,7 @@ set(sources items/ItemBase.cpp util/Demangle.cpp util/EnvireManager.cpp) -set(deps_pkg_config base-types boost_serialization) +set(deps_pkg_config base-types) if(PLUGIN_LIBS_FOUND) @@ -78,11 +78,11 @@ rock_library(envire_core SOURCES ${sources} DEPS_CMAKE Glog DEPS_PKGCONFIG ${deps_pkg_config} - DEPS_PLAIN - Boost_FILESYSTEM - Boost_SERIALIZATION - Boost_SYSTEM - Boost_THREAD + DEPS + Boost::filesystem + Boost::serialization + Boost::system + Boost::thread ) From 1065a0906513c23b198ead5d273d826e56bdd651 Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Wed, 15 May 2024 16:55:20 +0200 Subject: [PATCH 05/35] Remove qt5-svg dependency It is integrated in the qt5 dependency. --- manifest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.xml b/manifest.xml index 9755eed..1b14fc8 100644 --- a/manifest.xml +++ b/manifest.xml @@ -43,7 +43,6 @@ - active From 1bbf1eefcaf2128359b003d2a97dba699be0fb4e Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Fri, 2 Aug 2024 08:35:47 +0200 Subject: [PATCH 06/35] Create build_and_test.yml for github actions --- .github/workflows/build_and_test.yml | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/build_and_test.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 0000000..c55c16b --- /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-latest + + steps: + - uses: actions/checkout@v4 + + - name: apt-get + run: apt update && 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: "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: ~/project/build/test/test_suite + + - name: test_plugins + run: export LD_LIBRARY_PATH=/usr/local/lib && ~/project/build/test/test_plugins + From 98af7d2221aa0eafa9cbf39778e5a9fc2b7d3ba5 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Fri, 2 Aug 2024 08:38:45 +0200 Subject: [PATCH 07/35] Update build_and_test.yml --- .github/workflows/build_and_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c55c16b..03f2d3a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -23,10 +23,10 @@ jobs: - uses: actions/checkout@v4 - name: apt-get - run: apt update && 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 + run: sudo apt update && 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: "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" + 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 .. @@ -35,8 +35,8 @@ jobs: run: cd build && make -j2 install - name: test_suit - run: ~/project/build/test/test_suite + run: ./test/test_suite - name: test_plugins - run: export LD_LIBRARY_PATH=/usr/local/lib && ~/project/build/test/test_plugins + run: export LD_LIBRARY_PATH=/usr/local/lib && ./test/test_plugins From 741d6c691d3b66cffc0518f1f58f53d0dc14e73e Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Fri, 2 Aug 2024 08:39:33 +0200 Subject: [PATCH 08/35] Update build_and_test.yml --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 03f2d3a..b00ba8b 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v4 - name: apt-get - run: sudo apt update && 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 + 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" From d3cf2eec265b1b19aabc13bf0220456d74f75618 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Fri, 2 Aug 2024 08:41:52 +0200 Subject: [PATCH 09/35] Update build_and_test.yml --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index b00ba8b..33fa881 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -17,7 +17,7 @@ jobs: # 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-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 From 64f08b716de4edb34d330935a83b4041a3446b5d Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Wed, 25 Sep 2024 10:39:12 +0200 Subject: [PATCH 10/35] fix pkg-config deps --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8625b91..9fd273a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,7 +58,7 @@ set(sources items/ItemBase.cpp util/Demangle.cpp util/EnvireManager.cpp) -set(deps_pkg_config base-types) +set(deps_pkg_config base-types boost_serialization) if(PLUGIN_LIBS_FOUND) From 490e3bd8268d92a62ea772830627748aea7a6ef6 Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Fri, 27 Sep 2024 09:42:20 +0200 Subject: [PATCH 11/35] Add missing .pc.in for EnvireGraph2DStructureVisualization-qt5 --- .../EnvireGraph2DStructureVisualization-qt5.pc.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 viz/EnvireGraph2DStructureVisualization/EnvireGraph2DStructureVisualization-qt5.pc.in 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@ + From 2019cc3e4eb999d9da291b8b0830fb2f25e6ea4e Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 12:59:00 +0100 Subject: [PATCH 12/35] add qt5svg dependency --- manifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.xml b/manifest.xml index 1b14fc8..056e5bf 100644 --- a/manifest.xml +++ b/manifest.xml @@ -43,6 +43,7 @@ + active From 1448444619c8ac0ba6f6bc513f0148b4bad53e18 Mon Sep 17 00:00:00 2001 From: Malte Langosz Date: Wed, 4 Dec 2024 12:11:17 +0100 Subject: [PATCH 13/35] Switch to seperate version of class_loader --- CMakeLists.txt | 2 +- manifest.xml | 2 +- src/CMakeLists.txt | 2 +- src/plugin/Plugin.hpp | 2 +- test/CMakeLists.txt | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 448863c..7d062f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ 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) +pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader_melodic) if(PLUGIN_LIBS_FOUND) #this definition is used in the source to include/exclude the plugin headers message(STATUS "Plugin system enabled") diff --git a/manifest.xml b/manifest.xml index 056e5bf..d283faa 100644 --- a/manifest.xml +++ b/manifest.xml @@ -37,7 +37,7 @@ - + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fd273a..079071b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,7 +67,7 @@ if(PLUGIN_LIBS_FOUND) plugin/Plugin.hpp) set(sources ${sources} plugin/ClassLoader.cpp) - set(deps_pkg_config ${deps_pkg_config} class_loader plugin_manager) + set(deps_pkg_config ${deps_pkg_config} class_loader_melodic plugin_manager) endif() diff --git a/src/plugin/Plugin.hpp b/src/plugin/Plugin.hpp index 69516f8..39161a2 100644 --- a/src/plugin/Plugin.hpp +++ b/src/plugin/Plugin.hpp @@ -26,7 +26,7 @@ #pragma once -#include +#include #include #include #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index cb0bb61..d9e7f41 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,18 +1,18 @@ find_package(Boost COMPONENTS unit_test_framework system filesystem serialization thread) find_package(PkgConfig REQUIRED) -pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader) +pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader_melodic) if(PLUGIN_LIBS_FOUND) rock_library(envire_vector_plugin SOURCES vector_plugin.cpp DEPS envire_core - DEPS_PKGCONFIG class_loader) + DEPS_PKGCONFIG class_loader_melodic) rock_library(envire_string_plugin SOURCES string_plugin.cpp DEPS envire_core - DEPS_PKGCONFIG class_loader) + DEPS_PKGCONFIG class_loader_melodic) # The plugin test suit cannot use the rock test macros because it needs to set # the library path before executing the test @@ -24,12 +24,12 @@ if(PLUGIN_LIBS_FOUND) PathSingleton.cpp test_serialization.cpp) - pkg_check_modules(CLS_LOADER REQUIRED class_loader) + pkg_check_modules(CLS_LOADER REQUIRED class_loader_melodic) target_link_libraries(test_plugins envire_core ${Boost_LIBRARIES} - ${class_loader_PKGCONFIG_LIBRARIES}) + ${class_loader_melodic_PKGCONFIG_LIBRARIES}) add_test(NAME test-plugins-cxx COMMAND "${CMAKE_CURRENT_BINARY_DIR}/test_plugins") @@ -59,7 +59,7 @@ rock_testsuite(test_suite suite.cpp test_item_changed_callback.cpp test_graph_event_dispatcher.cpp PathSingleton.cpp - DEPS_PKGCONFIG class_loader + DEPS_PKGCONFIG class_loader_melodic DEPS envire_core DEPS_PLAIN From c59ccfcd72b1182fdd58f612efc657b833f1125c Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 13:17:34 +0100 Subject: [PATCH 14/35] use DEPS_TARGET for cmake targets --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From ef678e1916d0fecbc46c7e9d1232c175c4c6033f Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 13:57:12 +0100 Subject: [PATCH 15/35] remove boost libs from pc.in file --- src/envire_core.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/envire_core.pc.in b/src/envire_core.pc.in index 1ecb13b..dff22b9 100644 --- a/src/envire_core.pc.in +++ b/src/envire_core.pc.in @@ -7,6 +7,6 @@ Name: @TARGET_NAME@ Description: @PROJECT_DESCRIPTION@ Version: @PROJECT_VERSION@ Requires: @PKGCONFIG_REQUIRES@ -Libs: -L${libdir} -l@TARGET_NAME@ @PKGCONFIG_LIBS@ -lboost_thread -lboost_system -lboost_filesystem +Libs: -L${libdir} -l@TARGET_NAME@ @PKGCONFIG_LIBS@ Cflags: -I${includedir} @PKGCONFIG_CFLAGS@ From f36de1063ecd9bb73a4f13647b37a947665e2eef Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 14:03:00 +0100 Subject: [PATCH 16/35] fix circleci --- .circleci/config.yml | 8 ++++---- install_dependencies.sh | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8cd6dae..7283a76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,10 +6,10 @@ jobs: 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 + # - 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/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" From ceaafd4f92aa1c67ab24dc5287f0b43f1a79f2ae Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 14:16:27 +0100 Subject: [PATCH 17/35] update ci image version --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7283a76..eda1394 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: ubuntu:18.04 + - image: ubuntu:22.04 steps: - run: name: apt-get From edf8ebaed321b3c8f3fb135f5ffceabd46f18acf Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 14:23:35 +0100 Subject: [PATCH 18/35] add libpoco to deps --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eda1394..4f6e22f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: 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 libtinyxml-dev librosconsole-bridge-dev + 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" From ec4dae75c5e5cbd86be7203e9ddff092d4b52103 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 20 Jan 2025 17:21:31 +0100 Subject: [PATCH 19/35] fix class loader warning --- src/plugin/Plugin.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin/Plugin.hpp b/src/plugin/Plugin.hpp index 39161a2..1b39300 100644 --- a/src/plugin/Plugin.hpp +++ b/src/plugin/Plugin.hpp @@ -26,7 +26,7 @@ #pragma once -#include +#include #include #include #include From b70660f38c6291e2e9b8d80edf1e0d2cb78ab6b6 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 15 Apr 2024 16:57:11 +0200 Subject: [PATCH 20/35] use cmake targets for boost --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fd273a..8625b91 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,7 +58,7 @@ set(sources items/ItemBase.cpp util/Demangle.cpp util/EnvireManager.cpp) -set(deps_pkg_config base-types boost_serialization) +set(deps_pkg_config base-types) if(PLUGIN_LIBS_FOUND) From a3c93b63d09c8d1c805523f2397c2ada857331de Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Tue, 4 Feb 2025 14:13:39 +0100 Subject: [PATCH 21/35] add boost_serialization dependency --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8625b91..9fd273a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,7 +58,7 @@ set(sources items/ItemBase.cpp util/Demangle.cpp util/EnvireManager.cpp) -set(deps_pkg_config base-types) +set(deps_pkg_config base-types boost_serialization) if(PLUGIN_LIBS_FOUND) From 1df5330474df68941c5d426c49bbe69b93f784ce Mon Sep 17 00:00:00 2001 From: Malte Langosz Date: Wed, 4 Dec 2024 12:11:17 +0100 Subject: [PATCH 22/35] Switch to seperate version of class_loader --- CMakeLists.txt | 2 +- manifest.xml | 2 +- src/CMakeLists.txt | 2 +- src/plugin/Plugin.hpp | 2 +- test/CMakeLists.txt | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c43ad50..9522cd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ option(COVERAGE "Enable code coverage. run 'make test && make coverage' to gener find_package(PkgConfig REQUIRED) -pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader) +pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader_melodic) if(PLUGIN_LIBS_FOUND) #this definition is used in the source to include/exclude the plugin headers message(STATUS "Plugin system enabled") diff --git a/manifest.xml b/manifest.xml index 72e4247..e57072c 100644 --- a/manifest.xml +++ b/manifest.xml @@ -37,7 +37,7 @@ - + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fd273a..079071b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,7 +67,7 @@ if(PLUGIN_LIBS_FOUND) plugin/Plugin.hpp) set(sources ${sources} plugin/ClassLoader.cpp) - set(deps_pkg_config ${deps_pkg_config} class_loader plugin_manager) + set(deps_pkg_config ${deps_pkg_config} class_loader_melodic plugin_manager) endif() diff --git a/src/plugin/Plugin.hpp b/src/plugin/Plugin.hpp index 69516f8..39161a2 100644 --- a/src/plugin/Plugin.hpp +++ b/src/plugin/Plugin.hpp @@ -26,7 +26,7 @@ #pragma once -#include +#include #include #include #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index cce8132..e85c316 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,18 +1,18 @@ find_package(Boost COMPONENTS unit_test_framework system filesystem serialization thread) find_package(PkgConfig REQUIRED) -pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader) +pkg_check_modules(PLUGIN_LIBS plugin_manager class_loader_melodic) if(PLUGIN_LIBS_FOUND) rock_library(envire_vector_plugin SOURCES vector_plugin.cpp DEPS envire_core - DEPS_PKGCONFIG class_loader) + DEPS_PKGCONFIG class_loader_melodic) rock_library(envire_string_plugin SOURCES string_plugin.cpp DEPS envire_core - DEPS_PKGCONFIG class_loader) + DEPS_PKGCONFIG class_loader_melodic) # The plugin test suit cannot use the rock test macros because it needs to set # the library path before executing the test @@ -24,12 +24,12 @@ if(PLUGIN_LIBS_FOUND) PathSingleton.cpp test_serialization.cpp) - pkg_check_modules(CLS_LOADER REQUIRED class_loader) + pkg_check_modules(CLS_LOADER REQUIRED class_loader_melodic) target_link_libraries(test_plugins envire_core ${Boost_LIBRARIES} - ${class_loader_PKGCONFIG_LIBRARIES}) + ${class_loader_melodic_PKGCONFIG_LIBRARIES}) add_test(NAME test-plugins-cxx COMMAND "${CMAKE_CURRENT_BINARY_DIR}/test_plugins") @@ -59,7 +59,7 @@ rock_testsuite(test_suite suite.cpp test_item_changed_callback.cpp test_graph_event_dispatcher.cpp PathSingleton.cpp - DEPS_PKGCONFIG class_loader plugin_manager + DEPS_PKGCONFIG plugin_manager DEPS envire_core DEPS_PLAIN From fba57bdc7f23c843d38917caa6a15a746402d3f9 Mon Sep 17 00:00:00 2001 From: Raul Dominguez Date: Wed, 19 Feb 2025 15:43:37 +0100 Subject: [PATCH 23/35] [buildfix] find the class_loader in the new install path --- test/test_plugins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_plugins.cpp b/test/test_plugins.cpp index e1df82b..5433add 100644 --- a/test/test_plugins.cpp +++ b/test/test_plugins.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include From cce131cfdc5929f5eb372ced35b7f9e466e15228 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 14:03:00 +0100 Subject: [PATCH 24/35] fix circleci # Conflicts: # .circleci/config.yml # install_dependencies.sh --- .circleci/config.yml | 22 ++++++++------- install_dependencies.sh | 62 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 10 deletions(-) create mode 100755 install_dependencies.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index b6f3b24..7283a76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,22 +2,24 @@ version: 2 jobs: build: docker: - - image: ubuntu:latest + - image: ubuntu:18.04 steps: - run: name: apt-get - command: apt update && 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 - - 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 + # - 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: cmake and dep install - command: mkdir build && cd build && cmake -DINSTALL_DEPS=ON -DROCK_TEST_ENABLED=ON .. + name: chmod install script + command: chmod +x install_dependencies.sh + - run: + name: run install script + command: ./install_dependencies.sh - run: - name: compile lib - command: cd build && make -j2 install + name: compile + command: mkdir build && cd build && cmake -DROCK_TEST_ENABLED=ON .. && make -j4 install - run: name: test_suit command: ~/project/build/test/test_suite diff --git a/install_dependencies.sh b/install_dependencies.sh new file mode 100755 index 0000000..5521845 --- /dev/null +++ b/install_dependencies.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -e #abort with error if any command returns with something other than zero + +############ +# Install script for envire dependencies +# Run "$> sudo ./install_dependencies.sh" to install system wide +# Run "$> ./install_dependencies.sh " to install to a local prefix +############ + +function build { + + if [ -d $3 ] + then + echo "Directory $3 already exists. " + read -r -p "Do you want to delete and re-download $3? [y/N] " response + if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]] + then + rm -rf $3 + else + echo "Aborting!" + exit -1 + fi + fi + git clone --branch $2 $1 $3 + mkdir $3/build + cd $3/build + cmake .. $4 + make -j install + cd ../../ +} + + + +PREFIX="" +ABS_PREFIX="" +if [ "$#" -eq 1 ]; then +ABS_PREFIX=`readlink -f $1` +PREFIX="-DCMAKE_INSTALL_PREFIX=$ABS_PREFIX" + +echo "" > env.sh #create empty env.sh +echo "export CMAKE_PREFIX_PATH=$ABS_PREFIX" >> env.sh +echo "export PKG_CONFIG_PATH=$ABS_PREFIX/lib/pkgconfig:$ABS_PREFIX/share/pkgconfig:$ABS_PREFIX/lib64/pkgconfig:\$PKG_CONFIG_PATH" >> env.sh +echo "export LD_LIBRARY_PATH=$ABS_PREFIX/lib:$ABS_PREFIX/lib64:\$LD_LIBRARY_PATH" >> env.sh +echo "export PATH=$ABS_PREFIX/bin:\$PATH" >> env.sh + +source env.sh + +fi + +build https://github.com/rock-core/base-cmake.git master base-cmake "$PREFIX" +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" + + + + From 7e34ddd097e6de024376296e0c8e9a1662af0f5c Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 14:16:27 +0100 Subject: [PATCH 25/35] update ci image version --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7283a76..eda1394 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: ubuntu:18.04 + - image: ubuntu:22.04 steps: - run: name: apt-get From 226a374894bc299cccca87b019219918579ae715 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 6 Jan 2025 14:23:35 +0100 Subject: [PATCH 26/35] add libpoco to deps --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eda1394..4f6e22f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: 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 libtinyxml-dev librosconsole-bridge-dev + 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" From 9432c1b458bbe0132654ea5a194e9e59bf9102e0 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Fri, 21 Feb 2025 14:06:21 +0100 Subject: [PATCH 27/35] Add missing `` include --- src/graph/TreeView.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graph/TreeView.hpp b/src/graph/TreeView.hpp index 7ac1a0d..2d73e85 100644 --- a/src/graph/TreeView.hpp +++ b/src/graph/TreeView.hpp @@ -29,6 +29,7 @@ #include #include +#include namespace envire { namespace core { @@ -214,4 +215,4 @@ namespace envire { namespace core protected: TreeUpdatePublisher* publisher = nullptr;/*< Used for automatic unsubscribing in dtor */ }; -}} \ No newline at end of file +}} From 75afcb9609426d6e0c81913e2d1353c36dc6f6d8 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Mon, 24 Mar 2025 17:09:32 +0100 Subject: [PATCH 28/35] utils EnvireManager: allow recreation --- src/util/EnvireManager.cpp | 4 ++-- src/util/EnvireManager.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/EnvireManager.cpp b/src/util/EnvireManager.cpp index 77f8ed2..4d53e6c 100644 --- a/src/util/EnvireManager.cpp +++ b/src/util/EnvireManager.cpp @@ -24,9 +24,9 @@ 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()){ + if (!graph.get() || force_recreate){ //create graph = EnvireGraphPtr(new ThreadSaveEnvireGraph()); graphs[name] = 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(); From cbe5a266d1e091e33643af8eb35003ff6901f7cc Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Wed, 26 Mar 2025 17:42:02 +0100 Subject: [PATCH 29/35] don't touch shared_ptr on recreate --- src/util/EnvireManager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/EnvireManager.cpp b/src/util/EnvireManager.cpp index 4d53e6c..d061be5 100644 --- a/src/util/EnvireManager.cpp +++ b/src/util/EnvireManager.cpp @@ -26,11 +26,12 @@ EnvireManager::~EnvireManager() {} EnvireGraphPtr EnvireManager::getInstance(std::string name, bool force_recreate) { EnvireGraphPtr graph = graphs[name]; - if (!graph.get() || force_recreate){ + if (!graph.get()){ //create graph = EnvireGraphPtr(new ThreadSaveEnvireGraph()); graphs[name] = graph; - + } else if (force_recreate) { + graph.reset(new ThreadSaveEnvireGraph()); } return graph; } From 946d436e170736bd648002530dcb841a94c0912e Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Wed, 26 Mar 2025 17:46:53 +0100 Subject: [PATCH 30/35] add removeFrame and addItem to ThreadSaveGraph --- src/util/ThreadSaveEnvireGraph.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/util/ThreadSaveEnvireGraph.hpp b/src/util/ThreadSaveEnvireGraph.hpp index e6e9dad..dd56d9f 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); From 3a4be4614efcae270546cd8b00365fdbe42e2278 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Wed, 2 Apr 2025 13:57:29 +0200 Subject: [PATCH 31/35] add visitItems to Thread save graph util interface --- src/util/ThreadSaveEnvireGraph.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util/ThreadSaveEnvireGraph.hpp b/src/util/ThreadSaveEnvireGraph.hpp index dd56d9f..1e689a5 100644 --- a/src/util/ThreadSaveEnvireGraph.hpp +++ b/src/util/ThreadSaveEnvireGraph.hpp @@ -163,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 */ From 9be4b2ca11c24d596c8036c42ab5cfb55327b1d6 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Thu, 15 May 2025 17:04:37 +0200 Subject: [PATCH 32/35] add lamda callback mode to Grapheventdispatcher --- src/events/GraphEventDispatcher.cpp | 58 +++++++++++++++++++++++++++++ src/events/GraphEventDispatcher.hpp | 33 ++++++++++++---- 2 files changed, 84 insertions(+), 7 deletions(-) diff --git a/src/events/GraphEventDispatcher.cpp b/src/events/GraphEventDispatcher.cpp index fbab1d4..33427a7 100644 --- a/src/events/GraphEventDispatcher.cpp +++ b/src/events/GraphEventDispatcher.cpp @@ -77,4 +77,62 @@ void GraphEventDispatcher::notifyGraphEvent(const GraphEvent& event) } +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); + } +} diff --git a/src/events/GraphEventDispatcher.hpp b/src/events/GraphEventDispatcher.hpp index 2ee4005..3ecbfd8 100644 --- a/src/events/GraphEventDispatcher.hpp +++ b/src/events/GraphEventDispatcher.hpp @@ -26,6 +26,8 @@ #pragma once #include +#include +#include namespace envire { namespace core @@ -67,16 +69,33 @@ 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); + 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; + }; }} From 3543b6fcc361a5f9a1b62859d626df7d0b68db0f Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Tue, 26 Aug 2025 17:14:02 +0200 Subject: [PATCH 33/35] Use RockQt macros for visualisation --- viz/CMakeLists.txt | 2 ++ .../CMakeLists.txt | 35 +++++-------------- .../CMakeLists.txt | 23 ++++-------- 3 files changed, 18 insertions(+), 42 deletions(-) diff --git a/viz/CMakeLists.txt b/viz/CMakeLists.txt index 35d4879..f49a2b9 100644 --- a/viz/CMakeLists.txt +++ b/viz/CMakeLists.txt @@ -4,6 +4,8 @@ find_package(Boost COMPONENTS system thread REQUIRED) rock_find_qt4(OPTIONAL QtSvg) rock_find_qt5(OPTIONAL Svg) +include(RockQt) + add_subdirectory(EnvireGraphStructureVisualization) add_subdirectory(EnvireGraph2DStructureVisualization) diff --git a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt index e15d2ea..199d383 100644 --- a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt @@ -1,6 +1,7 @@ -if(ROCK_QT_VERSION_4) -rock_library(envire_2D_structure_widget +rock_qt_library( + TARGETPREFIX envire_2D_structure_widget + QT4_SUFFIX "" MOC EnvireGraph2DStructurWidget.hpp QZoomableGraphicsView.hpp HEADERS EnvireGraph2DStructurWidget.hpp @@ -8,35 +9,17 @@ rock_library(envire_2D_structure_widget SOURCES EnvireGraph2DStructurWidget.cpp QZoomableGraphicsView.cpp DEPS_PKGCONFIG libgvc - LIBS Qt4::QtSvg + LIBS_QT4 Qt4::QtSvg + LIBS_QT5 Qt5::Svg DEPS envire_core) -rock_vizkit_widget(EnvireGraph2DStructureVisualization +rock_qt_vizkit_widget( + TARGETPREFIX EnvireGraph2DStructureVisualization + QT4_SUFFIX "" SOURCES EnvireGraph2DStructureVisualizationPlugin.cpp HEADERS EnvireGraph2DStructureVisualization.hpp MOC EnvireGraph2DStructureVisualization.hpp EnvireGraph2DStructureVisualizationPlugin.hpp - DEPS envire_2D_structure_widget + DEPS_QT envire_2D_structure_widget ) -endif() -if(ROCK_QT_VERSION_5) -rock_library(envire_2D_structure_widget-qt5 - MOC5 EnvireGraph2DStructurWidget.hpp - QZoomableGraphicsView.hpp - HEADERS EnvireGraph2DStructurWidget.hpp - QZoomableGraphicsView.hpp - SOURCES EnvireGraph2DStructurWidget.cpp - QZoomableGraphicsView.cpp - DEPS_PKGCONFIG libgvc - LIBS Qt5::Svg - DEPS envire_core) - -rock_vizkit_widget(EnvireGraph2DStructureVisualization-qt5 - SOURCES EnvireGraph2DStructureVisualizationPlugin.cpp - HEADERS EnvireGraph2DStructureVisualization.hpp - MOC5 EnvireGraph2DStructureVisualization.hpp - EnvireGraph2DStructureVisualizationPlugin.hpp - DEPS envire_2D_structure_widget-qt5 -) -endif() diff --git a/viz/EnvireGraphStructureVisualization/CMakeLists.txt b/viz/EnvireGraphStructureVisualization/CMakeLists.txt index d1c2517..0454037 100644 --- a/viz/EnvireGraphStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraphStructureVisualization/CMakeLists.txt @@ -1,18 +1,9 @@ -if(ROCK_QT_VERSION_4) - rock_vizkit_plugin(envire_core-viz - EnvireGraphStructureVisualization.cpp - MOC EnvireGraphStructureVisualization.hpp - HEADERS EnvireGraphStructureVisualization.hpp - DEPS envire_core - LIBS Qt4::QtCore Qt4::QtGui) -endif(ROCK_QT_VERSION_4) +rock_qt_vizkit_plugin( + TARGETPREFIX envire_core-viz + QT4_SUFFIX "" + SOURCES EnvireGraphStructureVisualization.cpp + MOC EnvireGraphStructureVisualization.hpp + HEADERS EnvireGraphStructureVisualization.hpp + DEPS envire_core) -if(ROCK_QT_VERSION_5) - rock_vizkit_plugin_qt5(envire_core-viz-qt5 - EnvireGraphStructureVisualization.cpp - MOC5 EnvireGraphStructureVisualization.hpp - HEADERS EnvireGraphStructureVisualization.hpp - DEPS envire_core - LIBS Qt5::Core Qt5::Gui Qt5::Widgets) -endif(ROCK_QT_VERSION_5) From 19f3a456dd177a617a21f6818976a8b0228a9057 Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Wed, 27 Aug 2025 18:38:31 +0200 Subject: [PATCH 34/35] fix: Do not build visualization when a qt dep(vizkit3d) is missing --- viz/EnvireGraph2DStructureVisualization/CMakeLists.txt | 1 + viz/EnvireGraphStructureVisualization/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt index 199d383..797ab9e 100644 --- a/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraph2DStructureVisualization/CMakeLists.txt @@ -16,6 +16,7 @@ rock_qt_library( rock_qt_vizkit_widget( TARGETPREFIX EnvireGraph2DStructureVisualization QT4_SUFFIX "" + MISSINGQTDEPS_NOBUILD SOURCES EnvireGraph2DStructureVisualizationPlugin.cpp HEADERS EnvireGraph2DStructureVisualization.hpp MOC EnvireGraph2DStructureVisualization.hpp diff --git a/viz/EnvireGraphStructureVisualization/CMakeLists.txt b/viz/EnvireGraphStructureVisualization/CMakeLists.txt index 0454037..7f65fbd 100644 --- a/viz/EnvireGraphStructureVisualization/CMakeLists.txt +++ b/viz/EnvireGraphStructureVisualization/CMakeLists.txt @@ -2,6 +2,7 @@ rock_qt_vizkit_plugin( TARGETPREFIX envire_core-viz QT4_SUFFIX "" + MISSINGQTDEPS_NOBUILD SOURCES EnvireGraphStructureVisualization.cpp MOC EnvireGraphStructureVisualization.hpp HEADERS EnvireGraphStructureVisualization.hpp From 429f36e5d0327e2cad7959afd8542d2e9295006a Mon Sep 17 00:00:00 2001 From: Sebastian Kasperski Date: Wed, 28 Jan 2026 10:47:21 +0100 Subject: [PATCH 35/35] Missed during merge. --- viz/CMakeLists.txt | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/viz/CMakeLists.txt b/viz/CMakeLists.txt index 02c8060..8c13465 100644 --- a/viz/CMakeLists.txt +++ b/viz/CMakeLists.txt @@ -1,13 +1,4 @@ -# temporary quick fix: dont build visualisation plugins for qt4 -if (${USE_QT5}) - SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - - find_package(Boost COMPONENTS system thread REQUIRED) - rock_find_qt5(Core Gui Svg) - - add_subdirectory(EnvireGraphStructureVisualization) - add_subdirectory(EnvireGraph2DStructureVisualization) -endif (${USE_QT5}) +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") find_package(Boost COMPONENTS system thread REQUIRED) rock_find_qt4(OPTIONAL QtSvg) @@ -15,3 +6,6 @@ rock_find_qt5(OPTIONAL Svg) include(RockQt) +add_subdirectory(EnvireGraphStructureVisualization) +add_subdirectory(EnvireGraph2DStructureVisualization) +