-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rosenv example * missing files * changes * add to readme * add docker ci for the example * fix * fix * Update examples/tools/ros/rosenv/workspace/consumer/CMakeLists.txt Co-authored-by: Carlos Zoido <[email protected]> * update example * Update examples/tools/ros/rosenv/workspace/consumer/CMakeLists.txt * test in github actions * use bash * fix cd * wip * Update examples/tools/README.md Co-authored-by: Carlos Zoido <[email protected]> * Update .github/workflows/ros-tests.yml * add develop2 testing * wip * wip * minor changes * wip --------- Co-authored-by: Carlos Zoido <[email protected]>
- Loading branch information
Showing
13 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: ROS and Conan Integration Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test_conan_release: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: osrf/ros:humble-desktop | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure environment and install Conan release | ||
run: | | ||
apt-get update && apt-get install -y python3 python3-pip | ||
python3 -m pip install conan | ||
chmod +x ./examples/tools/ros/rosenv/workspace/test_ros.sh | ||
- name: Run example with latest Conan release | ||
shell: bash | ||
run: | | ||
cd examples/tools/ros/rosenv/workspace | ||
./test_ros.sh | ||
test_conan_develop2: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: osrf/ros:humble-desktop | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure environment and install Conan from develop2 branch | ||
run: | | ||
apt-get update && apt-get install -y python3 python3-pip | ||
python3 -m pip install git+https://github.com/conan-io/conan.git | ||
chmod +x ./examples/tools/ros/rosenv/workspace/test_ros.sh | ||
- name: Run example with Conan from repo | ||
shell: bash | ||
run: | | ||
cd examples/tools/ros/rosenv/workspace | ||
./test_ros.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
examples/tools/ros/rosenv/workspace/consumer/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(consumer) | ||
|
||
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(str_printer REQUIRED) | ||
|
||
add_executable(main src/main.cpp) | ||
|
||
target_include_directories(main PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/consumer> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
target_compile_features(main PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17 | ||
ament_target_dependencies(main str_printer) | ||
|
||
install(TARGETS main | ||
DESTINATION lib/${PROJECT_NAME}) | ||
|
||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?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>consumer</name> | ||
<version>0.0.0</version> | ||
<description>Consumer application that prints a fancy string</description> | ||
<maintainer email="[email protected]">danimtb</maintainer> | ||
<license>MIT</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
<depend>str_printer</depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "str_printer/str_printer.h" | ||
|
||
int main(int argc, char ** argv) | ||
{ | ||
(void) argc; | ||
(void) argv; | ||
|
||
str_printer("Hi there! I am using fmt library fetched with Conan C/C++ Package Manager"); | ||
return 0; | ||
} |
38 changes: 38 additions & 0 deletions
38
examples/tools/ros/rosenv/workspace/str_printer/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(str_printer) | ||
|
||
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(fmt REQUIRED) # Retrieved with Conan C/C++ Package Manager | ||
|
||
add_library(str_printer src/str_printer.cpp) | ||
|
||
target_include_directories(str_printer PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/str_printer> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
target_compile_features(str_printer PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17 | ||
ament_target_dependencies(str_printer fmt) | ||
|
||
ament_export_targets(str_printerTargets HAS_LIBRARY_TARGET) | ||
ament_export_dependencies(fmt) | ||
|
||
install( | ||
DIRECTORY include/ | ||
DESTINATION include | ||
) | ||
|
||
install( | ||
TARGETS str_printer | ||
EXPORT str_printerTargets | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
INCLUDES DESTINATION include | ||
) | ||
|
||
ament_package() |
7 changes: 7 additions & 0 deletions
7
examples/tools/ros/rosenv/workspace/str_printer/conanfile.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[requires] | ||
fmt/11.0.2 | ||
|
||
[generators] | ||
CMakeDeps | ||
CMakeToolchain | ||
ROSEnv |
11 changes: 11 additions & 0 deletions
11
examples/tools/ros/rosenv/workspace/str_printer/include/str_printer/str_printer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#ifdef WIN32 | ||
#define FN_EXPORT __declspec(dllexport) | ||
#else | ||
#define FN_EXPORT | ||
#endif | ||
|
||
FN_EXPORT void str_printer(std::string); |
18 changes: 18 additions & 0 deletions
18
examples/tools/ros/rosenv/workspace/str_printer/package.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?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>str_printer</name> | ||
<version>0.0.0</version> | ||
<description>Library that provides a function to print a fancy string using the fmt library fetched by Conan C/C++ Package Manager</description> | ||
<maintainer email="[email protected]">danimtb</maintainer> | ||
<license>MIT</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
11 changes: 11 additions & 0 deletions
11
examples/tools/ros/rosenv/workspace/str_printer/src/str_printer.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
#include "fmt/core.h" | ||
#include "fmt/color.h" | ||
|
||
#include "str_printer.h" | ||
|
||
void str_printer(std::string str) { | ||
fmt::print(fmt::fg(fmt::color::gold) | fmt::emphasis::bold, "{}\n", str); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source /opt/ros/humble/setup.bash | ||
conan profile detect --force | ||
conan install str_printer/conanfile.txt --build=missing --output-folder install/conan | ||
source install/conan/conanrosenv.sh | ||
colcon build --packages-select str_printer | ||
colcon build --packages-select consumer | ||
source install/setup.bash | ||
ros2 run consumer main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters