Setup initial qt plugin demo
This commit is contained in:
17
.vscode/c_cpp_properties.json
vendored
Normal file
17
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"browse": {
|
||||||
|
"databaseFilename": "${default}",
|
||||||
|
"limitSymbolsToIncludedHeaders": true
|
||||||
|
},
|
||||||
|
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||||
|
"name": "ROS",
|
||||||
|
"intelliSenseMode": "gcc-x64",
|
||||||
|
"compilerPath": "/usr/bin/g++",
|
||||||
|
"cStandard": "gnu11",
|
||||||
|
"cppStandard": "c++17"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"llvm-vs-code-extensions.vscode-clangd",
|
||||||
|
"ms-vscode.cpptools"
|
||||||
|
]
|
||||||
|
}
|
||||||
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "C++ Debugger",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"miDebuggerServerAddress": "localhost:3000",
|
||||||
|
"miDebuggerPath": "/usr/bin/gdb",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"program": "${workspaceFolder}/install/mg_navigation/lib/mg_navigation/mg_nav_server"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
72
CMakeLists.txt
Normal file
72
CMakeLists.txt
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
project(rqt_demo_plugin)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# find dependencies
|
||||||
|
find_package(ament_cmake REQUIRED)
|
||||||
|
find_package(rclcpp REQUIRED)
|
||||||
|
find_package(pluginlib REQUIRED)
|
||||||
|
pluginlib_export_plugin_description_file(rqt_gui "plugin.xml")
|
||||||
|
find_package(rqt_gui_cpp REQUIRED)
|
||||||
|
find_package(qt_gui_cpp REQUIRED)
|
||||||
|
find_package(Qt5 COMPONENTS Core REQUIRED)
|
||||||
|
find_package(Qt5 COMPONENTS Widgets REQUIRED)
|
||||||
|
find_package(Qt5 COMPONENTS Qml REQUIRED)
|
||||||
|
find_package(Qt5 COMPONENTS Quick REQUIRED)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
qt_wrap_cpp(MOC_FILES include/rqt_demo_plugin/rqt_demo_plugin.hpp)
|
||||||
|
qt5_add_resources(RCC_SOURCES "resources/res.qrc")
|
||||||
|
|
||||||
|
|
||||||
|
add_library(
|
||||||
|
rqt_demo_plugin
|
||||||
|
SHARED
|
||||||
|
src/rqt_demo_plugin.cpp
|
||||||
|
${RCC_SOURCES}
|
||||||
|
${MOC_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(
|
||||||
|
rqt_demo_plugin
|
||||||
|
PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
|
)
|
||||||
|
|
||||||
|
ament_target_dependencies(
|
||||||
|
rqt_demo_plugin
|
||||||
|
rclcpp
|
||||||
|
pluginlib
|
||||||
|
rqt_gui_cpp
|
||||||
|
qt_gui_cpp
|
||||||
|
Qt5Core
|
||||||
|
Qt5Widgets
|
||||||
|
Qt5Qml
|
||||||
|
Qt5Quick
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS rqt_demo_plugin
|
||||||
|
EXPORT export_${PROJECT_NAME}
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
)
|
||||||
|
|
||||||
|
ament_export_libraries(
|
||||||
|
rqt_demo_plugin
|
||||||
|
)
|
||||||
|
ament_export_targets(
|
||||||
|
export_${PROJECT_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
target_compile_features(rqt_demo_plugin PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
|
||||||
|
|
||||||
|
ament_package()
|
||||||
6
colcon_defaults.yaml
Normal file
6
colcon_defaults.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"cmake-args": ["-DCMAKE_EXPORT_COMPILE_COMMANDS=1"],
|
||||||
|
"symlink-install": true
|
||||||
|
}
|
||||||
|
}
|
||||||
41
include/rqt_demo_plugin/rqt_demo_plugin.hpp
Normal file
41
include/rqt_demo_plugin/rqt_demo_plugin.hpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "rqt_gui_cpp/plugin.h"
|
||||||
|
#include <QtGui>
|
||||||
|
#include <QtQuick>
|
||||||
|
#include <QtWidgets>
|
||||||
|
#include <qfileinfo.h>
|
||||||
|
#include <qobjectdefs.h>
|
||||||
|
#include <qpushbutton.h>
|
||||||
|
#include <qquickview.h>
|
||||||
|
#include <qquickwindow.h>
|
||||||
|
#include <qresource.h>
|
||||||
|
#include <qurl.h>
|
||||||
|
#include <qwidget.h>
|
||||||
|
|
||||||
|
inline void initResources() { Q_INIT_RESOURCE(res); }
|
||||||
|
inline void cleanupResources() { Q_CLEANUP_RESOURCE(res); }
|
||||||
|
|
||||||
|
namespace mg {
|
||||||
|
|
||||||
|
class DemoPluginMg : public rqt_gui_cpp::Plugin {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DemoPluginMg();
|
||||||
|
~DemoPluginMg();
|
||||||
|
|
||||||
|
virtual void shutdownPlugin() {
|
||||||
|
RCLCPP_INFO(node_->get_logger(), "The plugin has been shutdown");
|
||||||
|
}
|
||||||
|
virtual void initPlugin(qt_gui_cpp::PluginContext &);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void DemoPluginMg::initPlugin(qt_gui_cpp::PluginContext &pc) {
|
||||||
|
QQuickView *qv = new QQuickView(QUrl("qrc:/qml/helloworld.qml"));
|
||||||
|
qv->setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
|
||||||
|
QWidget *qw = QWidget::createWindowContainer(qv);
|
||||||
|
pc.addWidget(qw);
|
||||||
|
|
||||||
|
RCLCPP_INFO(node_->get_logger(), "The plugin has been initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // namespace mg
|
||||||
1
install/.colcon_install_layout
Normal file
1
install/.colcon_install_layout
Normal file
@ -0,0 +1 @@
|
|||||||
|
isolated
|
||||||
0
install/COLCON_IGNORE
Normal file
0
install/COLCON_IGNORE
Normal file
407
install/_local_setup_util_ps1.py
Normal file
407
install/_local_setup_util_ps1.py
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
# Copyright 2016-2019 Dirk Thomas
|
||||||
|
# Licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from collections import OrderedDict
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
FORMAT_STR_COMMENT_LINE = '# {comment}'
|
||||||
|
FORMAT_STR_SET_ENV_VAR = 'Set-Item -Path "Env:{name}" -Value "{value}"'
|
||||||
|
FORMAT_STR_USE_ENV_VAR = '$env:{name}'
|
||||||
|
FORMAT_STR_INVOKE_SCRIPT = '_colcon_prefix_powershell_source_script "{script_path}"' # noqa: E501
|
||||||
|
FORMAT_STR_REMOVE_LEADING_SEPARATOR = '' # noqa: E501
|
||||||
|
FORMAT_STR_REMOVE_TRAILING_SEPARATOR = '' # noqa: E501
|
||||||
|
|
||||||
|
DSV_TYPE_APPEND_NON_DUPLICATE = 'append-non-duplicate'
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE = 'prepend-non-duplicate'
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS = 'prepend-non-duplicate-if-exists'
|
||||||
|
DSV_TYPE_SET = 'set'
|
||||||
|
DSV_TYPE_SET_IF_UNSET = 'set-if-unset'
|
||||||
|
DSV_TYPE_SOURCE = 'source'
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=sys.argv[1:]): # noqa: D103
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='Output shell commands for the packages in topological '
|
||||||
|
'order')
|
||||||
|
parser.add_argument(
|
||||||
|
'primary_extension',
|
||||||
|
help='The file extension of the primary shell')
|
||||||
|
parser.add_argument(
|
||||||
|
'additional_extension', nargs='?',
|
||||||
|
help='The additional file extension to be considered')
|
||||||
|
parser.add_argument(
|
||||||
|
'--merged-install', action='store_true',
|
||||||
|
help='All install prefixes are merged into a single location')
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
|
packages = get_packages(Path(__file__).parent, args.merged_install)
|
||||||
|
|
||||||
|
ordered_packages = order_packages(packages)
|
||||||
|
for pkg_name in ordered_packages:
|
||||||
|
if _include_comments():
|
||||||
|
print(
|
||||||
|
FORMAT_STR_COMMENT_LINE.format_map(
|
||||||
|
{'comment': 'Package: ' + pkg_name}))
|
||||||
|
prefix = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
if not args.merged_install:
|
||||||
|
prefix = os.path.join(prefix, pkg_name)
|
||||||
|
for line in get_commands(
|
||||||
|
pkg_name, prefix, args.primary_extension,
|
||||||
|
args.additional_extension
|
||||||
|
):
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
for line in _remove_ending_separators():
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
|
||||||
|
def get_packages(prefix_path, merged_install):
|
||||||
|
"""
|
||||||
|
Find packages based on colcon-specific files created during installation.
|
||||||
|
|
||||||
|
:param Path prefix_path: The install prefix path of all packages
|
||||||
|
:param bool merged_install: The flag if the packages are all installed
|
||||||
|
directly in the prefix or if each package is installed in a subdirectory
|
||||||
|
named after the package
|
||||||
|
:returns: A mapping from the package name to the set of runtime
|
||||||
|
dependencies
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
|
packages = {}
|
||||||
|
# since importing colcon_core isn't feasible here the following constant
|
||||||
|
# must match colcon_core.location.get_relative_package_index_path()
|
||||||
|
subdirectory = 'share/colcon-core/packages'
|
||||||
|
if merged_install:
|
||||||
|
# return if workspace is empty
|
||||||
|
if not (prefix_path / subdirectory).is_dir():
|
||||||
|
return packages
|
||||||
|
# find all files in the subdirectory
|
||||||
|
for p in (prefix_path / subdirectory).iterdir():
|
||||||
|
if not p.is_file():
|
||||||
|
continue
|
||||||
|
if p.name.startswith('.'):
|
||||||
|
continue
|
||||||
|
add_package_runtime_dependencies(p, packages)
|
||||||
|
else:
|
||||||
|
# for each subdirectory look for the package specific file
|
||||||
|
for p in prefix_path.iterdir():
|
||||||
|
if not p.is_dir():
|
||||||
|
continue
|
||||||
|
if p.name.startswith('.'):
|
||||||
|
continue
|
||||||
|
p = p / subdirectory / p.name
|
||||||
|
if p.is_file():
|
||||||
|
add_package_runtime_dependencies(p, packages)
|
||||||
|
|
||||||
|
# remove unknown dependencies
|
||||||
|
pkg_names = set(packages.keys())
|
||||||
|
for k in packages.keys():
|
||||||
|
packages[k] = {d for d in packages[k] if d in pkg_names}
|
||||||
|
|
||||||
|
return packages
|
||||||
|
|
||||||
|
|
||||||
|
def add_package_runtime_dependencies(path, packages):
|
||||||
|
"""
|
||||||
|
Check the path and if it exists extract the packages runtime dependencies.
|
||||||
|
|
||||||
|
:param Path path: The resource file containing the runtime dependencies
|
||||||
|
:param dict packages: A mapping from package names to the sets of runtime
|
||||||
|
dependencies to add to
|
||||||
|
"""
|
||||||
|
content = path.read_text()
|
||||||
|
dependencies = set(content.split(os.pathsep) if content else [])
|
||||||
|
packages[path.name] = dependencies
|
||||||
|
|
||||||
|
|
||||||
|
def order_packages(packages):
|
||||||
|
"""
|
||||||
|
Order packages topologically.
|
||||||
|
|
||||||
|
:param dict packages: A mapping from package name to the set of runtime
|
||||||
|
dependencies
|
||||||
|
:returns: The package names
|
||||||
|
:rtype: list
|
||||||
|
"""
|
||||||
|
# select packages with no dependencies in alphabetical order
|
||||||
|
to_be_ordered = list(packages.keys())
|
||||||
|
ordered = []
|
||||||
|
while to_be_ordered:
|
||||||
|
pkg_names_without_deps = [
|
||||||
|
name for name in to_be_ordered if not packages[name]]
|
||||||
|
if not pkg_names_without_deps:
|
||||||
|
reduce_cycle_set(packages)
|
||||||
|
raise RuntimeError(
|
||||||
|
'Circular dependency between: ' + ', '.join(sorted(packages)))
|
||||||
|
pkg_names_without_deps.sort()
|
||||||
|
pkg_name = pkg_names_without_deps[0]
|
||||||
|
to_be_ordered.remove(pkg_name)
|
||||||
|
ordered.append(pkg_name)
|
||||||
|
# remove item from dependency lists
|
||||||
|
for k in list(packages.keys()):
|
||||||
|
if pkg_name in packages[k]:
|
||||||
|
packages[k].remove(pkg_name)
|
||||||
|
return ordered
|
||||||
|
|
||||||
|
|
||||||
|
def reduce_cycle_set(packages):
|
||||||
|
"""
|
||||||
|
Reduce the set of packages to the ones part of the circular dependency.
|
||||||
|
|
||||||
|
:param dict packages: A mapping from package name to the set of runtime
|
||||||
|
dependencies which is modified in place
|
||||||
|
"""
|
||||||
|
last_depended = None
|
||||||
|
while len(packages) > 0:
|
||||||
|
# get all remaining dependencies
|
||||||
|
depended = set()
|
||||||
|
for pkg_name, dependencies in packages.items():
|
||||||
|
depended = depended.union(dependencies)
|
||||||
|
# remove all packages which are not dependent on
|
||||||
|
for name in list(packages.keys()):
|
||||||
|
if name not in depended:
|
||||||
|
del packages[name]
|
||||||
|
if last_depended:
|
||||||
|
# if remaining packages haven't changed return them
|
||||||
|
if last_depended == depended:
|
||||||
|
return packages.keys()
|
||||||
|
# otherwise reduce again
|
||||||
|
last_depended = depended
|
||||||
|
|
||||||
|
|
||||||
|
def _include_comments():
|
||||||
|
# skipping comment lines when COLCON_TRACE is not set speeds up the
|
||||||
|
# processing especially on Windows
|
||||||
|
return bool(os.environ.get('COLCON_TRACE'))
|
||||||
|
|
||||||
|
|
||||||
|
def get_commands(pkg_name, prefix, primary_extension, additional_extension):
|
||||||
|
commands = []
|
||||||
|
package_dsv_path = os.path.join(prefix, 'share', pkg_name, 'package.dsv')
|
||||||
|
if os.path.exists(package_dsv_path):
|
||||||
|
commands += process_dsv_file(
|
||||||
|
package_dsv_path, prefix, primary_extension, additional_extension)
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
def process_dsv_file(
|
||||||
|
dsv_path, prefix, primary_extension=None, additional_extension=None
|
||||||
|
):
|
||||||
|
commands = []
|
||||||
|
if _include_comments():
|
||||||
|
commands.append(FORMAT_STR_COMMENT_LINE.format_map({'comment': dsv_path}))
|
||||||
|
with open(dsv_path, 'r') as h:
|
||||||
|
content = h.read()
|
||||||
|
lines = content.splitlines()
|
||||||
|
|
||||||
|
basenames = OrderedDict()
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
# skip over empty or whitespace-only lines
|
||||||
|
if not line.strip():
|
||||||
|
continue
|
||||||
|
# skip over comments
|
||||||
|
if line.startswith('#'):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
type_, remainder = line.split(';', 1)
|
||||||
|
except ValueError:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Line %d in '%s' doesn't contain a semicolon separating the "
|
||||||
|
'type from the arguments' % (i + 1, dsv_path))
|
||||||
|
if type_ != DSV_TYPE_SOURCE:
|
||||||
|
# handle non-source lines
|
||||||
|
try:
|
||||||
|
commands += handle_dsv_types_except_source(
|
||||||
|
type_, remainder, prefix)
|
||||||
|
except RuntimeError as e:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Line %d in '%s' %s" % (i + 1, dsv_path, e)) from e
|
||||||
|
else:
|
||||||
|
# group remaining source lines by basename
|
||||||
|
path_without_ext, ext = os.path.splitext(remainder)
|
||||||
|
if path_without_ext not in basenames:
|
||||||
|
basenames[path_without_ext] = set()
|
||||||
|
assert ext.startswith('.')
|
||||||
|
ext = ext[1:]
|
||||||
|
if ext in (primary_extension, additional_extension):
|
||||||
|
basenames[path_without_ext].add(ext)
|
||||||
|
|
||||||
|
# add the dsv extension to each basename if the file exists
|
||||||
|
for basename, extensions in basenames.items():
|
||||||
|
if not os.path.isabs(basename):
|
||||||
|
basename = os.path.join(prefix, basename)
|
||||||
|
if os.path.exists(basename + '.dsv'):
|
||||||
|
extensions.add('dsv')
|
||||||
|
|
||||||
|
for basename, extensions in basenames.items():
|
||||||
|
if not os.path.isabs(basename):
|
||||||
|
basename = os.path.join(prefix, basename)
|
||||||
|
if 'dsv' in extensions:
|
||||||
|
# process dsv files recursively
|
||||||
|
commands += process_dsv_file(
|
||||||
|
basename + '.dsv', prefix, primary_extension=primary_extension,
|
||||||
|
additional_extension=additional_extension)
|
||||||
|
elif primary_extension in extensions and len(extensions) == 1:
|
||||||
|
# source primary-only files
|
||||||
|
commands += [
|
||||||
|
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||||
|
'prefix': prefix,
|
||||||
|
'script_path': basename + '.' + primary_extension})]
|
||||||
|
elif additional_extension in extensions:
|
||||||
|
# source non-primary files
|
||||||
|
commands += [
|
||||||
|
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||||
|
'prefix': prefix,
|
||||||
|
'script_path': basename + '.' + additional_extension})]
|
||||||
|
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
def handle_dsv_types_except_source(type_, remainder, prefix):
|
||||||
|
commands = []
|
||||||
|
if type_ in (DSV_TYPE_SET, DSV_TYPE_SET_IF_UNSET):
|
||||||
|
try:
|
||||||
|
env_name, value = remainder.split(';', 1)
|
||||||
|
except ValueError:
|
||||||
|
raise RuntimeError(
|
||||||
|
"doesn't contain a semicolon separating the environment name "
|
||||||
|
'from the value')
|
||||||
|
try_prefixed_value = os.path.join(prefix, value) if value else prefix
|
||||||
|
if os.path.exists(try_prefixed_value):
|
||||||
|
value = try_prefixed_value
|
||||||
|
if type_ == DSV_TYPE_SET:
|
||||||
|
commands += _set(env_name, value)
|
||||||
|
elif type_ == DSV_TYPE_SET_IF_UNSET:
|
||||||
|
commands += _set_if_unset(env_name, value)
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
|
elif type_ in (
|
||||||
|
DSV_TYPE_APPEND_NON_DUPLICATE,
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE,
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
env_name_and_values = remainder.split(';')
|
||||||
|
except ValueError:
|
||||||
|
raise RuntimeError(
|
||||||
|
"doesn't contain a semicolon separating the environment name "
|
||||||
|
'from the values')
|
||||||
|
env_name = env_name_and_values[0]
|
||||||
|
values = env_name_and_values[1:]
|
||||||
|
for value in values:
|
||||||
|
if not value:
|
||||||
|
value = prefix
|
||||||
|
elif not os.path.isabs(value):
|
||||||
|
value = os.path.join(prefix, value)
|
||||||
|
if (
|
||||||
|
type_ == DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS and
|
||||||
|
not os.path.exists(value)
|
||||||
|
):
|
||||||
|
comment = f'skip extending {env_name} with not existing ' \
|
||||||
|
f'path: {value}'
|
||||||
|
if _include_comments():
|
||||||
|
commands.append(
|
||||||
|
FORMAT_STR_COMMENT_LINE.format_map({'comment': comment}))
|
||||||
|
elif type_ == DSV_TYPE_APPEND_NON_DUPLICATE:
|
||||||
|
commands += _append_unique_value(env_name, value)
|
||||||
|
else:
|
||||||
|
commands += _prepend_unique_value(env_name, value)
|
||||||
|
else:
|
||||||
|
raise RuntimeError(
|
||||||
|
'contains an unknown environment hook type: ' + type_)
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
env_state = {}
|
||||||
|
|
||||||
|
|
||||||
|
def _append_unique_value(name, value):
|
||||||
|
global env_state
|
||||||
|
if name not in env_state:
|
||||||
|
if os.environ.get(name):
|
||||||
|
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||||
|
else:
|
||||||
|
env_state[name] = set()
|
||||||
|
# append even if the variable has not been set yet, in case a shell script sets the
|
||||||
|
# same variable without the knowledge of this Python script.
|
||||||
|
# later _remove_ending_separators() will cleanup any unintentional leading separator
|
||||||
|
extend = FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) + os.pathsep
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': extend + value})
|
||||||
|
if value not in env_state[name]:
|
||||||
|
env_state[name].add(value)
|
||||||
|
else:
|
||||||
|
if not _include_comments():
|
||||||
|
return []
|
||||||
|
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
def _prepend_unique_value(name, value):
|
||||||
|
global env_state
|
||||||
|
if name not in env_state:
|
||||||
|
if os.environ.get(name):
|
||||||
|
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||||
|
else:
|
||||||
|
env_state[name] = set()
|
||||||
|
# prepend even if the variable has not been set yet, in case a shell script sets the
|
||||||
|
# same variable without the knowledge of this Python script.
|
||||||
|
# later _remove_ending_separators() will cleanup any unintentional trailing separator
|
||||||
|
extend = os.pathsep + FORMAT_STR_USE_ENV_VAR.format_map({'name': name})
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': value + extend})
|
||||||
|
if value not in env_state[name]:
|
||||||
|
env_state[name].add(value)
|
||||||
|
else:
|
||||||
|
if not _include_comments():
|
||||||
|
return []
|
||||||
|
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
# generate commands for removing prepended underscores
|
||||||
|
def _remove_ending_separators():
|
||||||
|
# do nothing if the shell extension does not implement the logic
|
||||||
|
if FORMAT_STR_REMOVE_TRAILING_SEPARATOR is None:
|
||||||
|
return []
|
||||||
|
|
||||||
|
global env_state
|
||||||
|
commands = []
|
||||||
|
for name in env_state:
|
||||||
|
# skip variables that already had values before this script started prepending
|
||||||
|
if name in os.environ:
|
||||||
|
continue
|
||||||
|
commands += [
|
||||||
|
FORMAT_STR_REMOVE_LEADING_SEPARATOR.format_map({'name': name}),
|
||||||
|
FORMAT_STR_REMOVE_TRAILING_SEPARATOR.format_map({'name': name})]
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
def _set(name, value):
|
||||||
|
global env_state
|
||||||
|
env_state[name] = value
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': value})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
def _set_if_unset(name, value):
|
||||||
|
global env_state
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': value})
|
||||||
|
if env_state.get(name, os.environ.get(name)):
|
||||||
|
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__': # pragma: no cover
|
||||||
|
try:
|
||||||
|
rc = main()
|
||||||
|
except RuntimeError as e:
|
||||||
|
print(str(e), file=sys.stderr)
|
||||||
|
rc = 1
|
||||||
|
sys.exit(rc)
|
||||||
407
install/_local_setup_util_sh.py
Normal file
407
install/_local_setup_util_sh.py
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
# Copyright 2016-2019 Dirk Thomas
|
||||||
|
# Licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from collections import OrderedDict
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
FORMAT_STR_COMMENT_LINE = '# {comment}'
|
||||||
|
FORMAT_STR_SET_ENV_VAR = 'export {name}="{value}"'
|
||||||
|
FORMAT_STR_USE_ENV_VAR = '${name}'
|
||||||
|
FORMAT_STR_INVOKE_SCRIPT = 'COLCON_CURRENT_PREFIX="{prefix}" _colcon_prefix_sh_source_script "{script_path}"' # noqa: E501
|
||||||
|
FORMAT_STR_REMOVE_LEADING_SEPARATOR = 'if [ "$(echo -n ${name} | head -c 1)" = ":" ]; then export {name}=${{{name}#?}} ; fi' # noqa: E501
|
||||||
|
FORMAT_STR_REMOVE_TRAILING_SEPARATOR = 'if [ "$(echo -n ${name} | tail -c 1)" = ":" ]; then export {name}=${{{name}%?}} ; fi' # noqa: E501
|
||||||
|
|
||||||
|
DSV_TYPE_APPEND_NON_DUPLICATE = 'append-non-duplicate'
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE = 'prepend-non-duplicate'
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS = 'prepend-non-duplicate-if-exists'
|
||||||
|
DSV_TYPE_SET = 'set'
|
||||||
|
DSV_TYPE_SET_IF_UNSET = 'set-if-unset'
|
||||||
|
DSV_TYPE_SOURCE = 'source'
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=sys.argv[1:]): # noqa: D103
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='Output shell commands for the packages in topological '
|
||||||
|
'order')
|
||||||
|
parser.add_argument(
|
||||||
|
'primary_extension',
|
||||||
|
help='The file extension of the primary shell')
|
||||||
|
parser.add_argument(
|
||||||
|
'additional_extension', nargs='?',
|
||||||
|
help='The additional file extension to be considered')
|
||||||
|
parser.add_argument(
|
||||||
|
'--merged-install', action='store_true',
|
||||||
|
help='All install prefixes are merged into a single location')
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
|
packages = get_packages(Path(__file__).parent, args.merged_install)
|
||||||
|
|
||||||
|
ordered_packages = order_packages(packages)
|
||||||
|
for pkg_name in ordered_packages:
|
||||||
|
if _include_comments():
|
||||||
|
print(
|
||||||
|
FORMAT_STR_COMMENT_LINE.format_map(
|
||||||
|
{'comment': 'Package: ' + pkg_name}))
|
||||||
|
prefix = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
if not args.merged_install:
|
||||||
|
prefix = os.path.join(prefix, pkg_name)
|
||||||
|
for line in get_commands(
|
||||||
|
pkg_name, prefix, args.primary_extension,
|
||||||
|
args.additional_extension
|
||||||
|
):
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
for line in _remove_ending_separators():
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
|
||||||
|
def get_packages(prefix_path, merged_install):
|
||||||
|
"""
|
||||||
|
Find packages based on colcon-specific files created during installation.
|
||||||
|
|
||||||
|
:param Path prefix_path: The install prefix path of all packages
|
||||||
|
:param bool merged_install: The flag if the packages are all installed
|
||||||
|
directly in the prefix or if each package is installed in a subdirectory
|
||||||
|
named after the package
|
||||||
|
:returns: A mapping from the package name to the set of runtime
|
||||||
|
dependencies
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
|
packages = {}
|
||||||
|
# since importing colcon_core isn't feasible here the following constant
|
||||||
|
# must match colcon_core.location.get_relative_package_index_path()
|
||||||
|
subdirectory = 'share/colcon-core/packages'
|
||||||
|
if merged_install:
|
||||||
|
# return if workspace is empty
|
||||||
|
if not (prefix_path / subdirectory).is_dir():
|
||||||
|
return packages
|
||||||
|
# find all files in the subdirectory
|
||||||
|
for p in (prefix_path / subdirectory).iterdir():
|
||||||
|
if not p.is_file():
|
||||||
|
continue
|
||||||
|
if p.name.startswith('.'):
|
||||||
|
continue
|
||||||
|
add_package_runtime_dependencies(p, packages)
|
||||||
|
else:
|
||||||
|
# for each subdirectory look for the package specific file
|
||||||
|
for p in prefix_path.iterdir():
|
||||||
|
if not p.is_dir():
|
||||||
|
continue
|
||||||
|
if p.name.startswith('.'):
|
||||||
|
continue
|
||||||
|
p = p / subdirectory / p.name
|
||||||
|
if p.is_file():
|
||||||
|
add_package_runtime_dependencies(p, packages)
|
||||||
|
|
||||||
|
# remove unknown dependencies
|
||||||
|
pkg_names = set(packages.keys())
|
||||||
|
for k in packages.keys():
|
||||||
|
packages[k] = {d for d in packages[k] if d in pkg_names}
|
||||||
|
|
||||||
|
return packages
|
||||||
|
|
||||||
|
|
||||||
|
def add_package_runtime_dependencies(path, packages):
|
||||||
|
"""
|
||||||
|
Check the path and if it exists extract the packages runtime dependencies.
|
||||||
|
|
||||||
|
:param Path path: The resource file containing the runtime dependencies
|
||||||
|
:param dict packages: A mapping from package names to the sets of runtime
|
||||||
|
dependencies to add to
|
||||||
|
"""
|
||||||
|
content = path.read_text()
|
||||||
|
dependencies = set(content.split(os.pathsep) if content else [])
|
||||||
|
packages[path.name] = dependencies
|
||||||
|
|
||||||
|
|
||||||
|
def order_packages(packages):
|
||||||
|
"""
|
||||||
|
Order packages topologically.
|
||||||
|
|
||||||
|
:param dict packages: A mapping from package name to the set of runtime
|
||||||
|
dependencies
|
||||||
|
:returns: The package names
|
||||||
|
:rtype: list
|
||||||
|
"""
|
||||||
|
# select packages with no dependencies in alphabetical order
|
||||||
|
to_be_ordered = list(packages.keys())
|
||||||
|
ordered = []
|
||||||
|
while to_be_ordered:
|
||||||
|
pkg_names_without_deps = [
|
||||||
|
name for name in to_be_ordered if not packages[name]]
|
||||||
|
if not pkg_names_without_deps:
|
||||||
|
reduce_cycle_set(packages)
|
||||||
|
raise RuntimeError(
|
||||||
|
'Circular dependency between: ' + ', '.join(sorted(packages)))
|
||||||
|
pkg_names_without_deps.sort()
|
||||||
|
pkg_name = pkg_names_without_deps[0]
|
||||||
|
to_be_ordered.remove(pkg_name)
|
||||||
|
ordered.append(pkg_name)
|
||||||
|
# remove item from dependency lists
|
||||||
|
for k in list(packages.keys()):
|
||||||
|
if pkg_name in packages[k]:
|
||||||
|
packages[k].remove(pkg_name)
|
||||||
|
return ordered
|
||||||
|
|
||||||
|
|
||||||
|
def reduce_cycle_set(packages):
|
||||||
|
"""
|
||||||
|
Reduce the set of packages to the ones part of the circular dependency.
|
||||||
|
|
||||||
|
:param dict packages: A mapping from package name to the set of runtime
|
||||||
|
dependencies which is modified in place
|
||||||
|
"""
|
||||||
|
last_depended = None
|
||||||
|
while len(packages) > 0:
|
||||||
|
# get all remaining dependencies
|
||||||
|
depended = set()
|
||||||
|
for pkg_name, dependencies in packages.items():
|
||||||
|
depended = depended.union(dependencies)
|
||||||
|
# remove all packages which are not dependent on
|
||||||
|
for name in list(packages.keys()):
|
||||||
|
if name not in depended:
|
||||||
|
del packages[name]
|
||||||
|
if last_depended:
|
||||||
|
# if remaining packages haven't changed return them
|
||||||
|
if last_depended == depended:
|
||||||
|
return packages.keys()
|
||||||
|
# otherwise reduce again
|
||||||
|
last_depended = depended
|
||||||
|
|
||||||
|
|
||||||
|
def _include_comments():
|
||||||
|
# skipping comment lines when COLCON_TRACE is not set speeds up the
|
||||||
|
# processing especially on Windows
|
||||||
|
return bool(os.environ.get('COLCON_TRACE'))
|
||||||
|
|
||||||
|
|
||||||
|
def get_commands(pkg_name, prefix, primary_extension, additional_extension):
|
||||||
|
commands = []
|
||||||
|
package_dsv_path = os.path.join(prefix, 'share', pkg_name, 'package.dsv')
|
||||||
|
if os.path.exists(package_dsv_path):
|
||||||
|
commands += process_dsv_file(
|
||||||
|
package_dsv_path, prefix, primary_extension, additional_extension)
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
def process_dsv_file(
|
||||||
|
dsv_path, prefix, primary_extension=None, additional_extension=None
|
||||||
|
):
|
||||||
|
commands = []
|
||||||
|
if _include_comments():
|
||||||
|
commands.append(FORMAT_STR_COMMENT_LINE.format_map({'comment': dsv_path}))
|
||||||
|
with open(dsv_path, 'r') as h:
|
||||||
|
content = h.read()
|
||||||
|
lines = content.splitlines()
|
||||||
|
|
||||||
|
basenames = OrderedDict()
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
# skip over empty or whitespace-only lines
|
||||||
|
if not line.strip():
|
||||||
|
continue
|
||||||
|
# skip over comments
|
||||||
|
if line.startswith('#'):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
type_, remainder = line.split(';', 1)
|
||||||
|
except ValueError:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Line %d in '%s' doesn't contain a semicolon separating the "
|
||||||
|
'type from the arguments' % (i + 1, dsv_path))
|
||||||
|
if type_ != DSV_TYPE_SOURCE:
|
||||||
|
# handle non-source lines
|
||||||
|
try:
|
||||||
|
commands += handle_dsv_types_except_source(
|
||||||
|
type_, remainder, prefix)
|
||||||
|
except RuntimeError as e:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Line %d in '%s' %s" % (i + 1, dsv_path, e)) from e
|
||||||
|
else:
|
||||||
|
# group remaining source lines by basename
|
||||||
|
path_without_ext, ext = os.path.splitext(remainder)
|
||||||
|
if path_without_ext not in basenames:
|
||||||
|
basenames[path_without_ext] = set()
|
||||||
|
assert ext.startswith('.')
|
||||||
|
ext = ext[1:]
|
||||||
|
if ext in (primary_extension, additional_extension):
|
||||||
|
basenames[path_without_ext].add(ext)
|
||||||
|
|
||||||
|
# add the dsv extension to each basename if the file exists
|
||||||
|
for basename, extensions in basenames.items():
|
||||||
|
if not os.path.isabs(basename):
|
||||||
|
basename = os.path.join(prefix, basename)
|
||||||
|
if os.path.exists(basename + '.dsv'):
|
||||||
|
extensions.add('dsv')
|
||||||
|
|
||||||
|
for basename, extensions in basenames.items():
|
||||||
|
if not os.path.isabs(basename):
|
||||||
|
basename = os.path.join(prefix, basename)
|
||||||
|
if 'dsv' in extensions:
|
||||||
|
# process dsv files recursively
|
||||||
|
commands += process_dsv_file(
|
||||||
|
basename + '.dsv', prefix, primary_extension=primary_extension,
|
||||||
|
additional_extension=additional_extension)
|
||||||
|
elif primary_extension in extensions and len(extensions) == 1:
|
||||||
|
# source primary-only files
|
||||||
|
commands += [
|
||||||
|
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||||
|
'prefix': prefix,
|
||||||
|
'script_path': basename + '.' + primary_extension})]
|
||||||
|
elif additional_extension in extensions:
|
||||||
|
# source non-primary files
|
||||||
|
commands += [
|
||||||
|
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||||
|
'prefix': prefix,
|
||||||
|
'script_path': basename + '.' + additional_extension})]
|
||||||
|
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
def handle_dsv_types_except_source(type_, remainder, prefix):
|
||||||
|
commands = []
|
||||||
|
if type_ in (DSV_TYPE_SET, DSV_TYPE_SET_IF_UNSET):
|
||||||
|
try:
|
||||||
|
env_name, value = remainder.split(';', 1)
|
||||||
|
except ValueError:
|
||||||
|
raise RuntimeError(
|
||||||
|
"doesn't contain a semicolon separating the environment name "
|
||||||
|
'from the value')
|
||||||
|
try_prefixed_value = os.path.join(prefix, value) if value else prefix
|
||||||
|
if os.path.exists(try_prefixed_value):
|
||||||
|
value = try_prefixed_value
|
||||||
|
if type_ == DSV_TYPE_SET:
|
||||||
|
commands += _set(env_name, value)
|
||||||
|
elif type_ == DSV_TYPE_SET_IF_UNSET:
|
||||||
|
commands += _set_if_unset(env_name, value)
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
|
elif type_ in (
|
||||||
|
DSV_TYPE_APPEND_NON_DUPLICATE,
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE,
|
||||||
|
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
env_name_and_values = remainder.split(';')
|
||||||
|
except ValueError:
|
||||||
|
raise RuntimeError(
|
||||||
|
"doesn't contain a semicolon separating the environment name "
|
||||||
|
'from the values')
|
||||||
|
env_name = env_name_and_values[0]
|
||||||
|
values = env_name_and_values[1:]
|
||||||
|
for value in values:
|
||||||
|
if not value:
|
||||||
|
value = prefix
|
||||||
|
elif not os.path.isabs(value):
|
||||||
|
value = os.path.join(prefix, value)
|
||||||
|
if (
|
||||||
|
type_ == DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS and
|
||||||
|
not os.path.exists(value)
|
||||||
|
):
|
||||||
|
comment = f'skip extending {env_name} with not existing ' \
|
||||||
|
f'path: {value}'
|
||||||
|
if _include_comments():
|
||||||
|
commands.append(
|
||||||
|
FORMAT_STR_COMMENT_LINE.format_map({'comment': comment}))
|
||||||
|
elif type_ == DSV_TYPE_APPEND_NON_DUPLICATE:
|
||||||
|
commands += _append_unique_value(env_name, value)
|
||||||
|
else:
|
||||||
|
commands += _prepend_unique_value(env_name, value)
|
||||||
|
else:
|
||||||
|
raise RuntimeError(
|
||||||
|
'contains an unknown environment hook type: ' + type_)
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
env_state = {}
|
||||||
|
|
||||||
|
|
||||||
|
def _append_unique_value(name, value):
|
||||||
|
global env_state
|
||||||
|
if name not in env_state:
|
||||||
|
if os.environ.get(name):
|
||||||
|
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||||
|
else:
|
||||||
|
env_state[name] = set()
|
||||||
|
# append even if the variable has not been set yet, in case a shell script sets the
|
||||||
|
# same variable without the knowledge of this Python script.
|
||||||
|
# later _remove_ending_separators() will cleanup any unintentional leading separator
|
||||||
|
extend = FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) + os.pathsep
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': extend + value})
|
||||||
|
if value not in env_state[name]:
|
||||||
|
env_state[name].add(value)
|
||||||
|
else:
|
||||||
|
if not _include_comments():
|
||||||
|
return []
|
||||||
|
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
def _prepend_unique_value(name, value):
|
||||||
|
global env_state
|
||||||
|
if name not in env_state:
|
||||||
|
if os.environ.get(name):
|
||||||
|
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||||
|
else:
|
||||||
|
env_state[name] = set()
|
||||||
|
# prepend even if the variable has not been set yet, in case a shell script sets the
|
||||||
|
# same variable without the knowledge of this Python script.
|
||||||
|
# later _remove_ending_separators() will cleanup any unintentional trailing separator
|
||||||
|
extend = os.pathsep + FORMAT_STR_USE_ENV_VAR.format_map({'name': name})
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': value + extend})
|
||||||
|
if value not in env_state[name]:
|
||||||
|
env_state[name].add(value)
|
||||||
|
else:
|
||||||
|
if not _include_comments():
|
||||||
|
return []
|
||||||
|
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
# generate commands for removing prepended underscores
|
||||||
|
def _remove_ending_separators():
|
||||||
|
# do nothing if the shell extension does not implement the logic
|
||||||
|
if FORMAT_STR_REMOVE_TRAILING_SEPARATOR is None:
|
||||||
|
return []
|
||||||
|
|
||||||
|
global env_state
|
||||||
|
commands = []
|
||||||
|
for name in env_state:
|
||||||
|
# skip variables that already had values before this script started prepending
|
||||||
|
if name in os.environ:
|
||||||
|
continue
|
||||||
|
commands += [
|
||||||
|
FORMAT_STR_REMOVE_LEADING_SEPARATOR.format_map({'name': name}),
|
||||||
|
FORMAT_STR_REMOVE_TRAILING_SEPARATOR.format_map({'name': name})]
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
def _set(name, value):
|
||||||
|
global env_state
|
||||||
|
env_state[name] = value
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': value})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
def _set_if_unset(name, value):
|
||||||
|
global env_state
|
||||||
|
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||||
|
{'name': name, 'value': value})
|
||||||
|
if env_state.get(name, os.environ.get(name)):
|
||||||
|
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||||
|
return [line]
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__': # pragma: no cover
|
||||||
|
try:
|
||||||
|
rc = main()
|
||||||
|
except RuntimeError as e:
|
||||||
|
print(str(e), file=sys.stderr)
|
||||||
|
rc = 1
|
||||||
|
sys.exit(rc)
|
||||||
121
install/local_setup.bash
Normal file
121
install/local_setup.bash
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# generated from colcon_bash/shell/template/prefix.bash.em
|
||||||
|
|
||||||
|
# This script extends the environment with all packages contained in this
|
||||||
|
# prefix path.
|
||||||
|
|
||||||
|
# a bash script is able to determine its own path if necessary
|
||||||
|
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
_colcon_prefix_bash_COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)"
|
||||||
|
else
|
||||||
|
_colcon_prefix_bash_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to prepend a value to a variable
|
||||||
|
# which uses colons as separators
|
||||||
|
# duplicates as well as trailing separators are avoided
|
||||||
|
# first argument: the name of the result variable
|
||||||
|
# second argument: the value to be prepended
|
||||||
|
_colcon_prefix_bash_prepend_unique_value() {
|
||||||
|
# arguments
|
||||||
|
_listname="$1"
|
||||||
|
_value="$2"
|
||||||
|
|
||||||
|
# get values from variable
|
||||||
|
eval _values=\"\$$_listname\"
|
||||||
|
# backup the field separator
|
||||||
|
_colcon_prefix_bash_prepend_unique_value_IFS="$IFS"
|
||||||
|
IFS=":"
|
||||||
|
# start with the new value
|
||||||
|
_all_values="$_value"
|
||||||
|
_contained_value=""
|
||||||
|
# iterate over existing values in the variable
|
||||||
|
for _item in $_values; do
|
||||||
|
# ignore empty strings
|
||||||
|
if [ -z "$_item" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# ignore duplicates of _value
|
||||||
|
if [ "$_item" = "$_value" ]; then
|
||||||
|
_contained_value=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# keep non-duplicate values
|
||||||
|
_all_values="$_all_values:$_item"
|
||||||
|
done
|
||||||
|
unset _item
|
||||||
|
if [ -z "$_contained_value" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
if [ "$_all_values" = "$_value" ]; then
|
||||||
|
echo "export $_listname=$_value"
|
||||||
|
else
|
||||||
|
echo "export $_listname=$_value:\$$_listname"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset _contained_value
|
||||||
|
# restore the field separator
|
||||||
|
IFS="$_colcon_prefix_bash_prepend_unique_value_IFS"
|
||||||
|
unset _colcon_prefix_bash_prepend_unique_value_IFS
|
||||||
|
# export the updated variable
|
||||||
|
eval export $_listname=\"$_all_values\"
|
||||||
|
unset _all_values
|
||||||
|
unset _values
|
||||||
|
|
||||||
|
unset _value
|
||||||
|
unset _listname
|
||||||
|
}
|
||||||
|
|
||||||
|
# add this prefix to the COLCON_PREFIX_PATH
|
||||||
|
_colcon_prefix_bash_prepend_unique_value COLCON_PREFIX_PATH "$_colcon_prefix_bash_COLCON_CURRENT_PREFIX"
|
||||||
|
unset _colcon_prefix_bash_prepend_unique_value
|
||||||
|
|
||||||
|
# check environment variable for custom Python executable
|
||||||
|
if [ -n "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||||
|
if [ ! -f "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||||
|
echo "error: COLCON_PYTHON_EXECUTABLE '$COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_colcon_python_executable="$COLCON_PYTHON_EXECUTABLE"
|
||||||
|
else
|
||||||
|
# try the Python executable known at configure time
|
||||||
|
_colcon_python_executable="/usr/bin/python3"
|
||||||
|
# if it doesn't exist try a fall back
|
||||||
|
if [ ! -f "$_colcon_python_executable" ]; then
|
||||||
|
if ! /usr/bin/env python3 --version > /dev/null 2> /dev/null; then
|
||||||
|
echo "error: unable to find python3 executable"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_colcon_python_executable=`/usr/bin/env python3 -c "import sys; print(sys.executable)"`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
_colcon_prefix_sh_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$1"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# get all commands in topological order
|
||||||
|
_colcon_ordered_commands="$($_colcon_python_executable "$_colcon_prefix_bash_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" sh bash)"
|
||||||
|
unset _colcon_python_executable
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "$(declare -f _colcon_prefix_sh_source_script)"
|
||||||
|
echo "# Execute generated script:"
|
||||||
|
echo "# <<<"
|
||||||
|
echo "${_colcon_ordered_commands}"
|
||||||
|
echo "# >>>"
|
||||||
|
echo "unset _colcon_prefix_sh_source_script"
|
||||||
|
fi
|
||||||
|
eval "${_colcon_ordered_commands}"
|
||||||
|
unset _colcon_ordered_commands
|
||||||
|
|
||||||
|
unset _colcon_prefix_sh_source_script
|
||||||
|
|
||||||
|
unset _colcon_prefix_bash_COLCON_CURRENT_PREFIX
|
||||||
55
install/local_setup.ps1
Normal file
55
install/local_setup.ps1
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# generated from colcon_powershell/shell/template/prefix.ps1.em
|
||||||
|
|
||||||
|
# This script extends the environment with all packages contained in this
|
||||||
|
# prefix path.
|
||||||
|
|
||||||
|
# check environment variable for custom Python executable
|
||||||
|
if ($env:COLCON_PYTHON_EXECUTABLE) {
|
||||||
|
if (!(Test-Path "$env:COLCON_PYTHON_EXECUTABLE" -PathType Leaf)) {
|
||||||
|
echo "error: COLCON_PYTHON_EXECUTABLE '$env:COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
$_colcon_python_executable="$env:COLCON_PYTHON_EXECUTABLE"
|
||||||
|
} else {
|
||||||
|
# use the Python executable known at configure time
|
||||||
|
$_colcon_python_executable="/usr/bin/python3"
|
||||||
|
# if it doesn't exist try a fall back
|
||||||
|
if (!(Test-Path "$_colcon_python_executable" -PathType Leaf)) {
|
||||||
|
if (!(Get-Command "python3" -ErrorAction SilentlyContinue)) {
|
||||||
|
echo "error: unable to find python3 executable"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
$_colcon_python_executable="python3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
function _colcon_prefix_powershell_source_script {
|
||||||
|
param (
|
||||||
|
$_colcon_prefix_powershell_source_script_param
|
||||||
|
)
|
||||||
|
# source script with conditional trace output
|
||||||
|
if (Test-Path $_colcon_prefix_powershell_source_script_param) {
|
||||||
|
if ($env:COLCON_TRACE) {
|
||||||
|
echo ". '$_colcon_prefix_powershell_source_script_param'"
|
||||||
|
}
|
||||||
|
. "$_colcon_prefix_powershell_source_script_param"
|
||||||
|
} else {
|
||||||
|
Write-Error "not found: '$_colcon_prefix_powershell_source_script_param'"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# get all commands in topological order
|
||||||
|
$_colcon_ordered_commands = & "$_colcon_python_executable" "$(Split-Path $PSCommandPath -Parent)/_local_setup_util_ps1.py" ps1
|
||||||
|
|
||||||
|
# execute all commands in topological order
|
||||||
|
if ($env:COLCON_TRACE) {
|
||||||
|
echo "Execute generated script:"
|
||||||
|
echo "<<<"
|
||||||
|
$_colcon_ordered_commands.Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries) | Write-Output
|
||||||
|
echo ">>>"
|
||||||
|
}
|
||||||
|
if ($_colcon_ordered_commands) {
|
||||||
|
$_colcon_ordered_commands.Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries) | Invoke-Expression
|
||||||
|
}
|
||||||
137
install/local_setup.sh
Normal file
137
install/local_setup.sh
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
# generated from colcon_core/shell/template/prefix.sh.em
|
||||||
|
|
||||||
|
# This script extends the environment with all packages contained in this
|
||||||
|
# prefix path.
|
||||||
|
|
||||||
|
# since a plain shell script can't determine its own path when being sourced
|
||||||
|
# either use the provided COLCON_CURRENT_PREFIX
|
||||||
|
# or fall back to the build time prefix (if it exists)
|
||||||
|
_colcon_prefix_sh_COLCON_CURRENT_PREFIX="/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/install"
|
||||||
|
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
if [ ! -d "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
echo "The build time path \"$_colcon_prefix_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2
|
||||||
|
unset _colcon_prefix_sh_COLCON_CURRENT_PREFIX
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
_colcon_prefix_sh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to prepend a value to a variable
|
||||||
|
# which uses colons as separators
|
||||||
|
# duplicates as well as trailing separators are avoided
|
||||||
|
# first argument: the name of the result variable
|
||||||
|
# second argument: the value to be prepended
|
||||||
|
_colcon_prefix_sh_prepend_unique_value() {
|
||||||
|
# arguments
|
||||||
|
_listname="$1"
|
||||||
|
_value="$2"
|
||||||
|
|
||||||
|
# get values from variable
|
||||||
|
eval _values=\"\$$_listname\"
|
||||||
|
# backup the field separator
|
||||||
|
_colcon_prefix_sh_prepend_unique_value_IFS="$IFS"
|
||||||
|
IFS=":"
|
||||||
|
# start with the new value
|
||||||
|
_all_values="$_value"
|
||||||
|
_contained_value=""
|
||||||
|
# iterate over existing values in the variable
|
||||||
|
for _item in $_values; do
|
||||||
|
# ignore empty strings
|
||||||
|
if [ -z "$_item" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# ignore duplicates of _value
|
||||||
|
if [ "$_item" = "$_value" ]; then
|
||||||
|
_contained_value=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# keep non-duplicate values
|
||||||
|
_all_values="$_all_values:$_item"
|
||||||
|
done
|
||||||
|
unset _item
|
||||||
|
if [ -z "$_contained_value" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
if [ "$_all_values" = "$_value" ]; then
|
||||||
|
echo "export $_listname=$_value"
|
||||||
|
else
|
||||||
|
echo "export $_listname=$_value:\$$_listname"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset _contained_value
|
||||||
|
# restore the field separator
|
||||||
|
IFS="$_colcon_prefix_sh_prepend_unique_value_IFS"
|
||||||
|
unset _colcon_prefix_sh_prepend_unique_value_IFS
|
||||||
|
# export the updated variable
|
||||||
|
eval export $_listname=\"$_all_values\"
|
||||||
|
unset _all_values
|
||||||
|
unset _values
|
||||||
|
|
||||||
|
unset _value
|
||||||
|
unset _listname
|
||||||
|
}
|
||||||
|
|
||||||
|
# add this prefix to the COLCON_PREFIX_PATH
|
||||||
|
_colcon_prefix_sh_prepend_unique_value COLCON_PREFIX_PATH "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX"
|
||||||
|
unset _colcon_prefix_sh_prepend_unique_value
|
||||||
|
|
||||||
|
# check environment variable for custom Python executable
|
||||||
|
if [ -n "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||||
|
if [ ! -f "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||||
|
echo "error: COLCON_PYTHON_EXECUTABLE '$COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_colcon_python_executable="$COLCON_PYTHON_EXECUTABLE"
|
||||||
|
else
|
||||||
|
# try the Python executable known at configure time
|
||||||
|
_colcon_python_executable="/usr/bin/python3"
|
||||||
|
# if it doesn't exist try a fall back
|
||||||
|
if [ ! -f "$_colcon_python_executable" ]; then
|
||||||
|
if ! /usr/bin/env python3 --version > /dev/null 2> /dev/null; then
|
||||||
|
echo "error: unable to find python3 executable"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_colcon_python_executable=`/usr/bin/env python3 -c "import sys; print(sys.executable)"`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
_colcon_prefix_sh_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$1"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# get all commands in topological order
|
||||||
|
_colcon_ordered_commands="$($_colcon_python_executable "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" sh)"
|
||||||
|
unset _colcon_python_executable
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "_colcon_prefix_sh_source_script() {
|
||||||
|
if [ -f \"\$1\" ]; then
|
||||||
|
if [ -n \"\$COLCON_TRACE\" ]; then
|
||||||
|
echo \"# . \\\"\$1\\\"\"
|
||||||
|
fi
|
||||||
|
. \"\$1\"
|
||||||
|
else
|
||||||
|
echo \"not found: \\\"\$1\\\"\" 1>&2
|
||||||
|
fi
|
||||||
|
}"
|
||||||
|
echo "# Execute generated script:"
|
||||||
|
echo "# <<<"
|
||||||
|
echo "${_colcon_ordered_commands}"
|
||||||
|
echo "# >>>"
|
||||||
|
echo "unset _colcon_prefix_sh_source_script"
|
||||||
|
fi
|
||||||
|
eval "${_colcon_ordered_commands}"
|
||||||
|
unset _colcon_ordered_commands
|
||||||
|
|
||||||
|
unset _colcon_prefix_sh_source_script
|
||||||
|
|
||||||
|
unset _colcon_prefix_sh_COLCON_CURRENT_PREFIX
|
||||||
134
install/local_setup.zsh
Normal file
134
install/local_setup.zsh
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
# generated from colcon_zsh/shell/template/prefix.zsh.em
|
||||||
|
|
||||||
|
# This script extends the environment with all packages contained in this
|
||||||
|
# prefix path.
|
||||||
|
|
||||||
|
# a zsh script is able to determine its own path if necessary
|
||||||
|
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
_colcon_prefix_zsh_COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`" > /dev/null && pwd)"
|
||||||
|
else
|
||||||
|
_colcon_prefix_zsh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to convert array-like strings into arrays
|
||||||
|
# to workaround SH_WORD_SPLIT not being set
|
||||||
|
_colcon_prefix_zsh_convert_to_array() {
|
||||||
|
local _listname=$1
|
||||||
|
local _dollar="$"
|
||||||
|
local _split="{="
|
||||||
|
local _to_array="(\"$_dollar$_split$_listname}\")"
|
||||||
|
eval $_listname=$_to_array
|
||||||
|
}
|
||||||
|
|
||||||
|
# function to prepend a value to a variable
|
||||||
|
# which uses colons as separators
|
||||||
|
# duplicates as well as trailing separators are avoided
|
||||||
|
# first argument: the name of the result variable
|
||||||
|
# second argument: the value to be prepended
|
||||||
|
_colcon_prefix_zsh_prepend_unique_value() {
|
||||||
|
# arguments
|
||||||
|
_listname="$1"
|
||||||
|
_value="$2"
|
||||||
|
|
||||||
|
# get values from variable
|
||||||
|
eval _values=\"\$$_listname\"
|
||||||
|
# backup the field separator
|
||||||
|
_colcon_prefix_zsh_prepend_unique_value_IFS="$IFS"
|
||||||
|
IFS=":"
|
||||||
|
# start with the new value
|
||||||
|
_all_values="$_value"
|
||||||
|
_contained_value=""
|
||||||
|
# workaround SH_WORD_SPLIT not being set
|
||||||
|
_colcon_prefix_zsh_convert_to_array _values
|
||||||
|
# iterate over existing values in the variable
|
||||||
|
for _item in $_values; do
|
||||||
|
# ignore empty strings
|
||||||
|
if [ -z "$_item" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# ignore duplicates of _value
|
||||||
|
if [ "$_item" = "$_value" ]; then
|
||||||
|
_contained_value=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# keep non-duplicate values
|
||||||
|
_all_values="$_all_values:$_item"
|
||||||
|
done
|
||||||
|
unset _item
|
||||||
|
if [ -z "$_contained_value" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
if [ "$_all_values" = "$_value" ]; then
|
||||||
|
echo "export $_listname=$_value"
|
||||||
|
else
|
||||||
|
echo "export $_listname=$_value:\$$_listname"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset _contained_value
|
||||||
|
# restore the field separator
|
||||||
|
IFS="$_colcon_prefix_zsh_prepend_unique_value_IFS"
|
||||||
|
unset _colcon_prefix_zsh_prepend_unique_value_IFS
|
||||||
|
# export the updated variable
|
||||||
|
eval export $_listname=\"$_all_values\"
|
||||||
|
unset _all_values
|
||||||
|
unset _values
|
||||||
|
|
||||||
|
unset _value
|
||||||
|
unset _listname
|
||||||
|
}
|
||||||
|
|
||||||
|
# add this prefix to the COLCON_PREFIX_PATH
|
||||||
|
_colcon_prefix_zsh_prepend_unique_value COLCON_PREFIX_PATH "$_colcon_prefix_zsh_COLCON_CURRENT_PREFIX"
|
||||||
|
unset _colcon_prefix_zsh_prepend_unique_value
|
||||||
|
unset _colcon_prefix_zsh_convert_to_array
|
||||||
|
|
||||||
|
# check environment variable for custom Python executable
|
||||||
|
if [ -n "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||||
|
if [ ! -f "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||||
|
echo "error: COLCON_PYTHON_EXECUTABLE '$COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_colcon_python_executable="$COLCON_PYTHON_EXECUTABLE"
|
||||||
|
else
|
||||||
|
# try the Python executable known at configure time
|
||||||
|
_colcon_python_executable="/usr/bin/python3"
|
||||||
|
# if it doesn't exist try a fall back
|
||||||
|
if [ ! -f "$_colcon_python_executable" ]; then
|
||||||
|
if ! /usr/bin/env python3 --version > /dev/null 2> /dev/null; then
|
||||||
|
echo "error: unable to find python3 executable"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_colcon_python_executable=`/usr/bin/env python3 -c "import sys; print(sys.executable)"`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
_colcon_prefix_sh_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$1"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# get all commands in topological order
|
||||||
|
_colcon_ordered_commands="$($_colcon_python_executable "$_colcon_prefix_zsh_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" sh zsh)"
|
||||||
|
unset _colcon_python_executable
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "$(declare -f _colcon_prefix_sh_source_script)"
|
||||||
|
echo "# Execute generated script:"
|
||||||
|
echo "# <<<"
|
||||||
|
echo "${_colcon_ordered_commands}"
|
||||||
|
echo "# >>>"
|
||||||
|
echo "unset _colcon_prefix_sh_source_script"
|
||||||
|
fi
|
||||||
|
eval "${_colcon_ordered_commands}"
|
||||||
|
unset _colcon_ordered_commands
|
||||||
|
|
||||||
|
unset _colcon_prefix_sh_source_script
|
||||||
|
|
||||||
|
unset _colcon_prefix_zsh_COLCON_CURRENT_PREFIX
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_index/share/ament_index/resource_index/package_run_dependencies/rqt_demo_plugin
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_index/share/ament_index/resource_index/packages/rqt_demo_plugin
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_index/share/ament_index/resource_index/parent_prefix_path/rqt_demo_plugin
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_index/share/ament_index/resource_index/rqt_gui__pluginlib__plugin/rqt_demo_plugin
|
||||||
@ -0,0 +1 @@
|
|||||||
|
pluginlib:rclcpp:rqt:rqt_gui_cpp
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_export_libraries/ament_cmake_export_libraries-extras.cmake
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_export_targets/ament_cmake_export_targets-extras.cmake
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#----------------------------------------------------------------
|
||||||
|
# Generated CMake target import file.
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
|
||||||
|
# Commands may need to know the format version.
|
||||||
|
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||||
|
|
||||||
|
# Import target "rqt_demo_plugin::rqt_demo_plugin" for configuration ""
|
||||||
|
set_property(TARGET rqt_demo_plugin::rqt_demo_plugin APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
|
||||||
|
set_target_properties(rqt_demo_plugin::rqt_demo_plugin PROPERTIES
|
||||||
|
IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/lib/librqt_demo_plugin.so"
|
||||||
|
IMPORTED_SONAME_NOCONFIG "librqt_demo_plugin.so"
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND _cmake_import_check_targets rqt_demo_plugin::rqt_demo_plugin )
|
||||||
|
list(APPEND _cmake_import_check_files_for_rqt_demo_plugin::rqt_demo_plugin "${_IMPORT_PREFIX}/lib/librqt_demo_plugin.so" )
|
||||||
|
|
||||||
|
# Commands beyond this point should not need to know the version.
|
||||||
|
set(CMAKE_IMPORT_FILE_VERSION)
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
# Generated by CMake
|
||||||
|
|
||||||
|
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||||
|
message(FATAL_ERROR "CMake >= 2.8.0 required")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||||
|
message(FATAL_ERROR "CMake >= 2.8.3 required")
|
||||||
|
endif()
|
||||||
|
cmake_policy(PUSH)
|
||||||
|
cmake_policy(VERSION 2.8.3...3.26)
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
# Generated CMake target import file.
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
|
||||||
|
# Commands may need to know the format version.
|
||||||
|
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||||
|
|
||||||
|
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||||
|
set(_cmake_targets_defined "")
|
||||||
|
set(_cmake_targets_not_defined "")
|
||||||
|
set(_cmake_expected_targets "")
|
||||||
|
foreach(_cmake_expected_target IN ITEMS rqt_demo_plugin::rqt_demo_plugin)
|
||||||
|
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||||
|
if(TARGET "${_cmake_expected_target}")
|
||||||
|
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||||
|
else()
|
||||||
|
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
unset(_cmake_expected_target)
|
||||||
|
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||||
|
unset(_cmake_targets_defined)
|
||||||
|
unset(_cmake_targets_not_defined)
|
||||||
|
unset(_cmake_expected_targets)
|
||||||
|
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||||
|
cmake_policy(POP)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
if(NOT _cmake_targets_defined STREQUAL "")
|
||||||
|
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||||
|
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||||
|
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||||
|
endif()
|
||||||
|
unset(_cmake_targets_defined)
|
||||||
|
unset(_cmake_targets_not_defined)
|
||||||
|
unset(_cmake_expected_targets)
|
||||||
|
|
||||||
|
|
||||||
|
# Compute the installation prefix relative to this file.
|
||||||
|
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||||
|
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||||
|
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||||
|
if(_IMPORT_PREFIX STREQUAL "/")
|
||||||
|
set(_IMPORT_PREFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Create imported target rqt_demo_plugin::rqt_demo_plugin
|
||||||
|
add_library(rqt_demo_plugin::rqt_demo_plugin SHARED IMPORTED)
|
||||||
|
|
||||||
|
set_target_properties(rqt_demo_plugin::rqt_demo_plugin PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "QT_CORE_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_QML_LIB;QT_NETWORK_LIB;QT_QUICK_LIB;QT_QMLMODELS_LIB"
|
||||||
|
INTERFACE_COMPILE_FEATURES "c_std_99;cxx_std_17"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;/usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtCore;/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++;/usr/include/x86_64-linux-gnu/qt5/QtWidgets;/usr/include/x86_64-linux-gnu/qt5/QtGui;/usr/include/x86_64-linux-gnu/qt5/QtQml;/usr/include/x86_64-linux-gnu/qt5/QtNetwork;/usr/include/x86_64-linux-gnu/qt5/QtQuick;/usr/include/x86_64-linux-gnu/qt5/QtQmlModels"
|
||||||
|
INTERFACE_LINK_LIBRARIES "rclcpp::rclcpp;pluginlib::pluginlib;rqt_gui_cpp::rqt_gui_cpp;qt_gui_cpp::qt_gui_cpp;Qt5::Core;Qt5::Widgets;Qt5::Qml;Qt5::Quick"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||||
|
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Load information for each installed configuration.
|
||||||
|
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/export_rqt_demo_pluginExport-*.cmake")
|
||||||
|
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||||
|
include("${_cmake_config_file}")
|
||||||
|
endforeach()
|
||||||
|
unset(_cmake_config_file)
|
||||||
|
unset(_cmake_config_files)
|
||||||
|
|
||||||
|
# Cleanup temporary variables.
|
||||||
|
set(_IMPORT_PREFIX)
|
||||||
|
|
||||||
|
# Loop over all imported files and verify that they actually exist
|
||||||
|
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||||
|
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||||
|
if(NOT EXISTS "${_cmake_file}")
|
||||||
|
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||||
|
\"${_cmake_file}\"
|
||||||
|
but this file does not exist. Possible reasons include:
|
||||||
|
* The file was deleted, renamed, or moved to another location.
|
||||||
|
* An install or uninstall procedure did not complete successfully.
|
||||||
|
* The installation package was faulty and contained
|
||||||
|
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||||
|
but not all the files it references.
|
||||||
|
")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
unset(_cmake_file)
|
||||||
|
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||||
|
endforeach()
|
||||||
|
unset(_cmake_target)
|
||||||
|
unset(_cmake_import_check_targets)
|
||||||
|
|
||||||
|
# This file does not depend on other imported targets which have
|
||||||
|
# been exported from the same project but in a separate export set.
|
||||||
|
|
||||||
|
# Commands beyond this point should not need to know the version.
|
||||||
|
set(CMAKE_IMPORT_FILE_VERSION)
|
||||||
|
cmake_policy(POP)
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_core/rqt_demo_pluginConfig-version.cmake
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_core/rqt_demo_pluginConfig.cmake
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_environment_hooks/ament_prefix_path.dsv
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/opt/ros/jazzy/share/ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.sh
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_environment_hooks/library_path.dsv
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/opt/ros/jazzy/lib/python3.12/site-packages/ament_package/template/environment_hook/library_path.sh
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_environment_hooks/path.dsv
|
||||||
@ -0,0 +1 @@
|
|||||||
|
/opt/ros/jazzy/share/ament_cmake_core/cmake/environment_hooks/environment/path.sh
|
||||||
@ -0,0 +1 @@
|
|||||||
|
prepend-non-duplicate;CMAKE_PREFIX_PATH;
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em
|
||||||
|
|
||||||
|
colcon_prepend_unique_value CMAKE_PREFIX_PATH "$env:COLCON_CURRENT_PREFIX"
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
# generated from colcon_core/shell/template/hook_prepend_value.sh.em
|
||||||
|
|
||||||
|
_colcon_prepend_unique_value CMAKE_PREFIX_PATH "$COLCON_CURRENT_PREFIX"
|
||||||
@ -0,0 +1 @@
|
|||||||
|
prepend-non-duplicate;LD_LIBRARY_PATH;lib
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em
|
||||||
|
|
||||||
|
colcon_prepend_unique_value LD_LIBRARY_PATH "$env:COLCON_CURRENT_PREFIX\lib"
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
# generated from colcon_core/shell/template/hook_prepend_value.sh.em
|
||||||
|
|
||||||
|
_colcon_prepend_unique_value LD_LIBRARY_PATH "$COLCON_CURRENT_PREFIX/lib"
|
||||||
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.bash
Symbolic link
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.bash
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_environment_hooks/local_setup.bash
|
||||||
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.dsv
Symbolic link
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.dsv
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_environment_hooks/local_setup.dsv
|
||||||
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.sh
Symbolic link
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_environment_hooks/local_setup.sh
|
||||||
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.zsh
Symbolic link
1
install/rqt_demo_plugin/share/rqt_demo_plugin/local_setup.zsh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/build/rqt_demo_plugin/ament_cmake_environment_hooks/local_setup.zsh
|
||||||
39
install/rqt_demo_plugin/share/rqt_demo_plugin/package.bash
Normal file
39
install/rqt_demo_plugin/share/rqt_demo_plugin/package.bash
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# generated from colcon_bash/shell/template/package.bash.em
|
||||||
|
|
||||||
|
# This script extends the environment for this package.
|
||||||
|
|
||||||
|
# a bash script is able to determine its own path if necessary
|
||||||
|
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
# the prefix is two levels up from the package specific share directory
|
||||||
|
_colcon_package_bash_COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`/../.." > /dev/null && pwd)"
|
||||||
|
else
|
||||||
|
_colcon_package_bash_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
# additional arguments: arguments to the script
|
||||||
|
_colcon_package_bash_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$@"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# source sh script of this package
|
||||||
|
_colcon_package_bash_source_script "$_colcon_package_bash_COLCON_CURRENT_PREFIX/share/rqt_demo_plugin/package.sh"
|
||||||
|
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced scripts
|
||||||
|
COLCON_CURRENT_PREFIX="$_colcon_package_bash_COLCON_CURRENT_PREFIX"
|
||||||
|
|
||||||
|
# source bash hooks
|
||||||
|
_colcon_package_bash_source_script "$COLCON_CURRENT_PREFIX/share/rqt_demo_plugin/local_setup.bash"
|
||||||
|
|
||||||
|
unset COLCON_CURRENT_PREFIX
|
||||||
|
|
||||||
|
unset _colcon_package_bash_source_script
|
||||||
|
unset _colcon_package_bash_COLCON_CURRENT_PREFIX
|
||||||
11
install/rqt_demo_plugin/share/rqt_demo_plugin/package.dsv
Normal file
11
install/rqt_demo_plugin/share/rqt_demo_plugin/package.dsv
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
source;share/rqt_demo_plugin/hook/cmake_prefix_path.ps1
|
||||||
|
source;share/rqt_demo_plugin/hook/cmake_prefix_path.dsv
|
||||||
|
source;share/rqt_demo_plugin/hook/cmake_prefix_path.sh
|
||||||
|
source;share/rqt_demo_plugin/hook/ld_library_path_lib.ps1
|
||||||
|
source;share/rqt_demo_plugin/hook/ld_library_path_lib.dsv
|
||||||
|
source;share/rqt_demo_plugin/hook/ld_library_path_lib.sh
|
||||||
|
source;share/rqt_demo_plugin/local_setup.bash
|
||||||
|
source;share/rqt_demo_plugin/local_setup.dsv
|
||||||
|
source;share/rqt_demo_plugin/local_setup.ps1
|
||||||
|
source;share/rqt_demo_plugin/local_setup.sh
|
||||||
|
source;share/rqt_demo_plugin/local_setup.zsh
|
||||||
117
install/rqt_demo_plugin/share/rqt_demo_plugin/package.ps1
Normal file
117
install/rqt_demo_plugin/share/rqt_demo_plugin/package.ps1
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
# generated from colcon_powershell/shell/template/package.ps1.em
|
||||||
|
|
||||||
|
# function to append a value to a variable
|
||||||
|
# which uses colons as separators
|
||||||
|
# duplicates as well as leading separators are avoided
|
||||||
|
# first argument: the name of the result variable
|
||||||
|
# second argument: the value to be prepended
|
||||||
|
function colcon_append_unique_value {
|
||||||
|
param (
|
||||||
|
$_listname,
|
||||||
|
$_value
|
||||||
|
)
|
||||||
|
|
||||||
|
# get values from variable
|
||||||
|
if (Test-Path Env:$_listname) {
|
||||||
|
$_values=(Get-Item env:$_listname).Value
|
||||||
|
} else {
|
||||||
|
$_values=""
|
||||||
|
}
|
||||||
|
$_duplicate=""
|
||||||
|
# start with no values
|
||||||
|
$_all_values=""
|
||||||
|
# iterate over existing values in the variable
|
||||||
|
if ($_values) {
|
||||||
|
$_values.Split(";") | ForEach {
|
||||||
|
# not an empty string
|
||||||
|
if ($_) {
|
||||||
|
# not a duplicate of _value
|
||||||
|
if ($_ -eq $_value) {
|
||||||
|
$_duplicate="1"
|
||||||
|
}
|
||||||
|
if ($_all_values) {
|
||||||
|
$_all_values="${_all_values};$_"
|
||||||
|
} else {
|
||||||
|
$_all_values="$_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# append only non-duplicates
|
||||||
|
if (!$_duplicate) {
|
||||||
|
# avoid leading separator
|
||||||
|
if ($_all_values) {
|
||||||
|
$_all_values="${_all_values};${_value}"
|
||||||
|
} else {
|
||||||
|
$_all_values="${_value}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# export the updated variable
|
||||||
|
Set-Item env:\$_listname -Value "$_all_values"
|
||||||
|
}
|
||||||
|
|
||||||
|
# function to prepend a value to a variable
|
||||||
|
# which uses colons as separators
|
||||||
|
# duplicates as well as trailing separators are avoided
|
||||||
|
# first argument: the name of the result variable
|
||||||
|
# second argument: the value to be prepended
|
||||||
|
function colcon_prepend_unique_value {
|
||||||
|
param (
|
||||||
|
$_listname,
|
||||||
|
$_value
|
||||||
|
)
|
||||||
|
|
||||||
|
# get values from variable
|
||||||
|
if (Test-Path Env:$_listname) {
|
||||||
|
$_values=(Get-Item env:$_listname).Value
|
||||||
|
} else {
|
||||||
|
$_values=""
|
||||||
|
}
|
||||||
|
# start with the new value
|
||||||
|
$_all_values="$_value"
|
||||||
|
# iterate over existing values in the variable
|
||||||
|
if ($_values) {
|
||||||
|
$_values.Split(";") | ForEach {
|
||||||
|
# not an empty string
|
||||||
|
if ($_) {
|
||||||
|
# not a duplicate of _value
|
||||||
|
if ($_ -ne $_value) {
|
||||||
|
# keep non-duplicate values
|
||||||
|
$_all_values="${_all_values};$_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# export the updated variable
|
||||||
|
Set-Item env:\$_listname -Value "$_all_values"
|
||||||
|
}
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
# additional arguments: arguments to the script
|
||||||
|
function colcon_package_source_powershell_script {
|
||||||
|
param (
|
||||||
|
$_colcon_package_source_powershell_script
|
||||||
|
)
|
||||||
|
# source script with conditional trace output
|
||||||
|
if (Test-Path $_colcon_package_source_powershell_script) {
|
||||||
|
if ($env:COLCON_TRACE) {
|
||||||
|
echo ". '$_colcon_package_source_powershell_script'"
|
||||||
|
}
|
||||||
|
. "$_colcon_package_source_powershell_script"
|
||||||
|
} else {
|
||||||
|
Write-Error "not found: '$_colcon_package_source_powershell_script'"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# a powershell script is able to determine its own path
|
||||||
|
# the prefix is two levels up from the package specific share directory
|
||||||
|
$env:COLCON_CURRENT_PREFIX=(Get-Item $PSCommandPath).Directory.Parent.Parent.FullName
|
||||||
|
|
||||||
|
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/rqt_demo_plugin/hook/cmake_prefix_path.ps1"
|
||||||
|
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/rqt_demo_plugin/hook/ld_library_path_lib.ps1"
|
||||||
|
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/rqt_demo_plugin/local_setup.ps1"
|
||||||
|
|
||||||
|
Remove-Item Env:\COLCON_CURRENT_PREFIX
|
||||||
88
install/rqt_demo_plugin/share/rqt_demo_plugin/package.sh
Normal file
88
install/rqt_demo_plugin/share/rqt_demo_plugin/package.sh
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
# generated from colcon_core/shell/template/package.sh.em
|
||||||
|
|
||||||
|
# This script extends the environment for this package.
|
||||||
|
|
||||||
|
# function to prepend a value to a variable
|
||||||
|
# which uses colons as separators
|
||||||
|
# duplicates as well as trailing separators are avoided
|
||||||
|
# first argument: the name of the result variable
|
||||||
|
# second argument: the value to be prepended
|
||||||
|
_colcon_prepend_unique_value() {
|
||||||
|
# arguments
|
||||||
|
_listname="$1"
|
||||||
|
_value="$2"
|
||||||
|
|
||||||
|
# get values from variable
|
||||||
|
eval _values=\"\$$_listname\"
|
||||||
|
# backup the field separator
|
||||||
|
_colcon_prepend_unique_value_IFS=$IFS
|
||||||
|
IFS=":"
|
||||||
|
# start with the new value
|
||||||
|
_all_values="$_value"
|
||||||
|
# workaround SH_WORD_SPLIT not being set in zsh
|
||||||
|
if [ "$(command -v colcon_zsh_convert_to_array)" ]; then
|
||||||
|
colcon_zsh_convert_to_array _values
|
||||||
|
fi
|
||||||
|
# iterate over existing values in the variable
|
||||||
|
for _item in $_values; do
|
||||||
|
# ignore empty strings
|
||||||
|
if [ -z "$_item" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# ignore duplicates of _value
|
||||||
|
if [ "$_item" = "$_value" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# keep non-duplicate values
|
||||||
|
_all_values="$_all_values:$_item"
|
||||||
|
done
|
||||||
|
unset _item
|
||||||
|
# restore the field separator
|
||||||
|
IFS=$_colcon_prepend_unique_value_IFS
|
||||||
|
unset _colcon_prepend_unique_value_IFS
|
||||||
|
# export the updated variable
|
||||||
|
eval export $_listname=\"$_all_values\"
|
||||||
|
unset _all_values
|
||||||
|
unset _values
|
||||||
|
|
||||||
|
unset _value
|
||||||
|
unset _listname
|
||||||
|
}
|
||||||
|
|
||||||
|
# since a plain shell script can't determine its own path when being sourced
|
||||||
|
# either use the provided COLCON_CURRENT_PREFIX
|
||||||
|
# or fall back to the build time prefix (if it exists)
|
||||||
|
_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/install/rqt_demo_plugin"
|
||||||
|
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2
|
||||||
|
unset _colcon_package_sh_COLCON_CURRENT_PREFIX
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
COLCON_CURRENT_PREFIX="$_colcon_package_sh_COLCON_CURRENT_PREFIX"
|
||||||
|
fi
|
||||||
|
unset _colcon_package_sh_COLCON_CURRENT_PREFIX
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
# additional arguments: arguments to the script
|
||||||
|
_colcon_package_sh_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$@"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# source sh hooks
|
||||||
|
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/rqt_demo_plugin/hook/cmake_prefix_path.sh"
|
||||||
|
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/rqt_demo_plugin/hook/ld_library_path_lib.sh"
|
||||||
|
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/rqt_demo_plugin/local_setup.sh"
|
||||||
|
|
||||||
|
unset _colcon_package_sh_source_script
|
||||||
|
unset COLCON_CURRENT_PREFIX
|
||||||
|
|
||||||
|
# do not unset _colcon_prepend_unique_value since it might be used by non-primary shell hooks
|
||||||
1
install/rqt_demo_plugin/share/rqt_demo_plugin/package.xml
Symbolic link
1
install/rqt_demo_plugin/share/rqt_demo_plugin/package.xml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/package.xml
|
||||||
50
install/rqt_demo_plugin/share/rqt_demo_plugin/package.zsh
Normal file
50
install/rqt_demo_plugin/share/rqt_demo_plugin/package.zsh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# generated from colcon_zsh/shell/template/package.zsh.em
|
||||||
|
|
||||||
|
# This script extends the environment for this package.
|
||||||
|
|
||||||
|
# a zsh script is able to determine its own path if necessary
|
||||||
|
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
# the prefix is two levels up from the package specific share directory
|
||||||
|
_colcon_package_zsh_COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`/../.." > /dev/null && pwd)"
|
||||||
|
else
|
||||||
|
_colcon_package_zsh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
# additional arguments: arguments to the script
|
||||||
|
_colcon_package_zsh_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$@"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# function to convert array-like strings into arrays
|
||||||
|
# to workaround SH_WORD_SPLIT not being set
|
||||||
|
colcon_zsh_convert_to_array() {
|
||||||
|
local _listname=$1
|
||||||
|
local _dollar="$"
|
||||||
|
local _split="{="
|
||||||
|
local _to_array="(\"$_dollar$_split$_listname}\")"
|
||||||
|
eval $_listname=$_to_array
|
||||||
|
}
|
||||||
|
|
||||||
|
# source sh script of this package
|
||||||
|
_colcon_package_zsh_source_script "$_colcon_package_zsh_COLCON_CURRENT_PREFIX/share/rqt_demo_plugin/package.sh"
|
||||||
|
unset convert_zsh_to_array
|
||||||
|
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced scripts
|
||||||
|
COLCON_CURRENT_PREFIX="$_colcon_package_zsh_COLCON_CURRENT_PREFIX"
|
||||||
|
|
||||||
|
# source zsh hooks
|
||||||
|
_colcon_package_zsh_source_script "$COLCON_CURRENT_PREFIX/share/rqt_demo_plugin/local_setup.zsh"
|
||||||
|
|
||||||
|
unset COLCON_CURRENT_PREFIX
|
||||||
|
|
||||||
|
unset _colcon_package_zsh_source_script
|
||||||
|
unset _colcon_package_zsh_COLCON_CURRENT_PREFIX
|
||||||
1
install/rqt_demo_plugin/share/rqt_demo_plugin/plugin.xml
Symbolic link
1
install/rqt_demo_plugin/share/rqt_demo_plugin/plugin.xml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/plugin.xml
|
||||||
31
install/setup.bash
Normal file
31
install/setup.bash
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# generated from colcon_bash/shell/template/prefix_chain.bash.em
|
||||||
|
|
||||||
|
# This script extends the environment with the environment of other prefix
|
||||||
|
# paths which were sourced when this file was generated as well as all packages
|
||||||
|
# contained in this prefix path.
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
_colcon_prefix_chain_bash_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$1"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# source chained prefixes
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||||
|
COLCON_CURRENT_PREFIX="/opt/ros/jazzy"
|
||||||
|
_colcon_prefix_chain_bash_source_script "$COLCON_CURRENT_PREFIX/local_setup.bash"
|
||||||
|
|
||||||
|
# source this prefix
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||||
|
COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)"
|
||||||
|
_colcon_prefix_chain_bash_source_script "$COLCON_CURRENT_PREFIX/local_setup.bash"
|
||||||
|
|
||||||
|
unset COLCON_CURRENT_PREFIX
|
||||||
|
unset _colcon_prefix_chain_bash_source_script
|
||||||
29
install/setup.ps1
Normal file
29
install/setup.ps1
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# generated from colcon_powershell/shell/template/prefix_chain.ps1.em
|
||||||
|
|
||||||
|
# This script extends the environment with the environment of other prefix
|
||||||
|
# paths which were sourced when this file was generated as well as all packages
|
||||||
|
# contained in this prefix path.
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
function _colcon_prefix_chain_powershell_source_script {
|
||||||
|
param (
|
||||||
|
$_colcon_prefix_chain_powershell_source_script_param
|
||||||
|
)
|
||||||
|
# source script with conditional trace output
|
||||||
|
if (Test-Path $_colcon_prefix_chain_powershell_source_script_param) {
|
||||||
|
if ($env:COLCON_TRACE) {
|
||||||
|
echo ". '$_colcon_prefix_chain_powershell_source_script_param'"
|
||||||
|
}
|
||||||
|
. "$_colcon_prefix_chain_powershell_source_script_param"
|
||||||
|
} else {
|
||||||
|
Write-Error "not found: '$_colcon_prefix_chain_powershell_source_script_param'"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# source chained prefixes
|
||||||
|
_colcon_prefix_chain_powershell_source_script "/opt/ros/jazzy\local_setup.ps1"
|
||||||
|
|
||||||
|
# source this prefix
|
||||||
|
$env:COLCON_CURRENT_PREFIX=(Split-Path $PSCommandPath -Parent)
|
||||||
|
_colcon_prefix_chain_powershell_source_script "$env:COLCON_CURRENT_PREFIX\local_setup.ps1"
|
||||||
45
install/setup.sh
Normal file
45
install/setup.sh
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# generated from colcon_core/shell/template/prefix_chain.sh.em
|
||||||
|
|
||||||
|
# This script extends the environment with the environment of other prefix
|
||||||
|
# paths which were sourced when this file was generated as well as all packages
|
||||||
|
# contained in this prefix path.
|
||||||
|
|
||||||
|
# since a plain shell script can't determine its own path when being sourced
|
||||||
|
# either use the provided COLCON_CURRENT_PREFIX
|
||||||
|
# or fall back to the build time prefix (if it exists)
|
||||||
|
_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX=/home/petar/Documents/Coding/2025-Eurobot/Rviz-Plugin-Demo/install
|
||||||
|
if [ ! -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||||
|
elif [ ! -d "$_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX" ]; then
|
||||||
|
echo "The build time path \"$_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2
|
||||||
|
unset _colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
_colcon_prefix_chain_sh_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$1"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# source chained prefixes
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids relying on the build time prefix of the sourced script
|
||||||
|
COLCON_CURRENT_PREFIX="/opt/ros/jazzy"
|
||||||
|
_colcon_prefix_chain_sh_source_script "$COLCON_CURRENT_PREFIX/local_setup.sh"
|
||||||
|
|
||||||
|
|
||||||
|
# source this prefix
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids relying on the build time prefix of the sourced script
|
||||||
|
COLCON_CURRENT_PREFIX="$_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX"
|
||||||
|
_colcon_prefix_chain_sh_source_script "$COLCON_CURRENT_PREFIX/local_setup.sh"
|
||||||
|
|
||||||
|
unset _colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX
|
||||||
|
unset _colcon_prefix_chain_sh_source_script
|
||||||
|
unset COLCON_CURRENT_PREFIX
|
||||||
31
install/setup.zsh
Normal file
31
install/setup.zsh
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# generated from colcon_zsh/shell/template/prefix_chain.zsh.em
|
||||||
|
|
||||||
|
# This script extends the environment with the environment of other prefix
|
||||||
|
# paths which were sourced when this file was generated as well as all packages
|
||||||
|
# contained in this prefix path.
|
||||||
|
|
||||||
|
# function to source another script with conditional trace output
|
||||||
|
# first argument: the path of the script
|
||||||
|
_colcon_prefix_chain_zsh_source_script() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if [ -n "$COLCON_TRACE" ]; then
|
||||||
|
echo "# . \"$1\""
|
||||||
|
fi
|
||||||
|
. "$1"
|
||||||
|
else
|
||||||
|
echo "not found: \"$1\"" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# source chained prefixes
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||||
|
COLCON_CURRENT_PREFIX="/opt/ros/jazzy"
|
||||||
|
_colcon_prefix_chain_zsh_source_script "$COLCON_CURRENT_PREFIX/local_setup.zsh"
|
||||||
|
|
||||||
|
# source this prefix
|
||||||
|
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||||
|
COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`" > /dev/null && pwd)"
|
||||||
|
_colcon_prefix_chain_zsh_source_script "$COLCON_CURRENT_PREFIX/local_setup.zsh"
|
||||||
|
|
||||||
|
unset COLCON_CURRENT_PREFIX
|
||||||
|
unset _colcon_prefix_chain_zsh_source_script
|
||||||
0
log/COLCON_IGNORE
Normal file
0
log/COLCON_IGNORE
Normal file
1
log/latest
Symbolic link
1
log/latest
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
latest_build
|
||||||
1
log/latest_build
Symbolic link
1
log/latest_build
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
build_2025-03-06_23-45-20
|
||||||
21
package.xml
Normal file
21
package.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||||
|
<package format="3">
|
||||||
|
<name>rqt_demo_plugin</name>
|
||||||
|
<version>0.0.0</version>
|
||||||
|
<description>TODO: Package description</description>
|
||||||
|
<maintainer email="82343504+Pimpest@users.noreply.github.com">petar</maintainer>
|
||||||
|
<license>TODO: License declaration</license>
|
||||||
|
|
||||||
|
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||||
|
|
||||||
|
<depend>rclcpp</depend>
|
||||||
|
<depend>pluginlib</depend>
|
||||||
|
<depend>rqt</depend>
|
||||||
|
<depend>rqt_gui_cpp</depend>
|
||||||
|
|
||||||
|
|
||||||
|
<export>
|
||||||
|
<build_type>ament_cmake</build_type>
|
||||||
|
</export>
|
||||||
|
</package>
|
||||||
13
plugin.xml
Normal file
13
plugin.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<library path="rqt_demo_plugin">
|
||||||
|
<class
|
||||||
|
name="DemoPluginMg"
|
||||||
|
type="mg::DemoPluginMg"
|
||||||
|
base_class_type="rqt_gui_cpp::Plugin"
|
||||||
|
>
|
||||||
|
<qtgui>
|
||||||
|
<label>DemoPlugin</label>
|
||||||
|
<icon type="theme">system-search</icon>
|
||||||
|
<statustip>HOoow Does this work if at all?</statustip>
|
||||||
|
</qtgui>
|
||||||
|
</class>
|
||||||
|
</library>
|
||||||
23
resources/qml/helloworld.qml
Normal file
23
resources/qml/helloworld.qml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import QtQuick 2.3
|
||||||
|
Item {
|
||||||
|
Row {
|
||||||
|
anchors.right: parent.right
|
||||||
|
spacing: 4
|
||||||
|
Rectangle {
|
||||||
|
height: 100
|
||||||
|
width: 100
|
||||||
|
color: "green"
|
||||||
|
Text {
|
||||||
|
text: "Hello, World!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
height: 100
|
||||||
|
width: 100
|
||||||
|
color: "red"
|
||||||
|
Text {
|
||||||
|
text: "Hello, World!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
resources/res.qrc
Normal file
5
resources/res.qrc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource>
|
||||||
|
<file>qml/helloworld.qml</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
15
src/rqt_demo_plugin.cpp
Normal file
15
src/rqt_demo_plugin.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "rqt_demo_plugin/rqt_demo_plugin.hpp"
|
||||||
|
|
||||||
|
#include "pluginlib/class_list_macros.hpp"
|
||||||
|
#include <qnamespace.h>
|
||||||
|
#include <qsurfaceformat.h>
|
||||||
|
PLUGINLIB_EXPORT_CLASS(mg::DemoPluginMg, rqt_gui_cpp::Plugin)
|
||||||
|
|
||||||
|
mg::DemoPluginMg::DemoPluginMg() : Plugin() {
|
||||||
|
initResources();
|
||||||
|
QSurfaceFormat fmt;
|
||||||
|
fmt.setSwapInterval(0);
|
||||||
|
fmt.setRenderableType(QSurfaceFormat::OpenGLES);
|
||||||
|
QSurfaceFormat::setDefaultFormat(fmt);
|
||||||
|
}
|
||||||
|
mg::DemoPluginMg::~DemoPluginMg() { cleanupResources(); }
|
||||||
Reference in New Issue
Block a user