From b8d46a01518ca54d4e0e6941504fd6b4a4504c27 Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Tue, 15 Nov 2022 13:48:25 +0100 Subject: [PATCH] examples: switch to cmake for symlink-install Workaround for https://github.com/colcon/colcon-core/issues/407 Fixes #87 --- crazyflie_examples/CMakeLists.txt | 19 +++++++++++++++++ crazyflie_examples/package.xml | 5 ++++- crazyflie_examples/setup.cfg | 10 +++++---- crazyflie_examples/setup.py | 35 ------------------------------- 4 files changed, 29 insertions(+), 40 deletions(-) create mode 100644 crazyflie_examples/CMakeLists.txt delete mode 100644 crazyflie_examples/setup.py diff --git a/crazyflie_examples/CMakeLists.txt b/crazyflie_examples/CMakeLists.txt new file mode 100644 index 000000000..9ea4389cd --- /dev/null +++ b/crazyflie_examples/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(crazyflie_examples) + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(ament_cmake_python REQUIRED) + +# Install Python modules +ament_python_install_package(${PROJECT_NAME} SCRIPTS_DESTINATION lib/${PROJECT_NAME}) + +# Install launch and config files. +install(DIRECTORY + config + data + launch + DESTINATION share/${PROJECT_NAME}/ +) + +ament_package() diff --git a/crazyflie_examples/package.xml b/crazyflie_examples/package.xml index c280be6ce..04015c337 100644 --- a/crazyflie_examples/package.xml +++ b/crazyflie_examples/package.xml @@ -7,6 +7,9 @@ Wolfgang Hönig, Kimberly McGuire MIT + ament_cmake + ament_cmake_python + rclpy crazyflie_py @@ -16,6 +19,6 @@ python3-pytest - ament_python + ament_cmake diff --git a/crazyflie_examples/setup.cfg b/crazyflie_examples/setup.cfg index 4ad112eaf..e2443cc06 100644 --- a/crazyflie_examples/setup.cfg +++ b/crazyflie_examples/setup.cfg @@ -1,4 +1,6 @@ -[develop] -script_dir=$base/lib/crazyflie_examples -[install] -install_scripts=$base/lib/crazyflie_examples +[options.entry_points] +console_scripts = + hello_world = crazyflie_examples.hello_world:main + nice_hover = crazyflie_examples.nice_hover:main + figure8 = crazyflie_examples.figure8:main + cmd_full_state = crazyflie_examples.cmd_full_state:main \ No newline at end of file diff --git a/crazyflie_examples/setup.py b/crazyflie_examples/setup.py deleted file mode 100644 index 71b4a20d6..000000000 --- a/crazyflie_examples/setup.py +++ /dev/null @@ -1,35 +0,0 @@ -from setuptools import setup -import os -from glob import glob - -package_name = 'crazyflie_examples' - -setup( - name=package_name, - version='2.0.0', - packages=[package_name], - package_data={'package_name': ['data/*.csv']}, - data_files=[ - ('share/ament_index/resource_index/packages', - ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), - (os.path.join('share', package_name), glob('launch/*launch.py')), - (os.path.join('share', package_name), glob('config/*')), - (os.path.join('share', package_name, 'data'), glob('data/*')) - ], - install_requires=['setuptools'], - zip_safe=True, - maintainer='Wolfgang Hönig, Kimberly McGuire', - maintainer_email='hoenig@tu-berlin.de', - description='Examples for Crayzswarm2 ROS stack', - license='MIT', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'hello_world = crazyflie_examples.hello_world:main', - 'nice_hover = crazyflie_examples.nice_hover:main', - 'figure8 = crazyflie_examples.figure8:main', - 'cmd_full_state = crazyflie_examples.cmd_full_state:main', - ], - }, -)