Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autoware_msg): add recipe #100

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZahraBoroujeni
Copy link

Description

To make a conan packages
conan_package.zip
. After uploading the conan package to a server, we can download the binary package (lib and includes) of the ros2 packages. In this way we can easily use the autoware packages with a ros2 humble docker. (Without building them again)

Related links

add colcon build features as conan extensions

Tests performed

I have created the conan package of "autoware_perception_msgs/0.0.0" for building the tier4_perception_msgs package which has autoware_perception_msgs/0.0.0 as a dependency.

This line should be added to the Cmakelist of tier4_perception_msgs to find the conan_toolchain and include file of the conan dependencies.

include(${CMAKE_BINARY_DIR}/../../generators/conan_toolchain.cmake)
include_directories(${CMAKE_INCLUDE_PATH})

It the conanfile.py of the tier4_perception_msgs

from conan import ConanFile, tools
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
import os
from conan.tools.files import copy

class App(ConanFile):
    name = "tier4_perception_msgs"
    version = "0.0.0" 
    # Optional metadata
    license = " "  # Todo
    topics = ("Base")
    requires = [
        "autoware_perception_msgs/0.0.0"
    ]
    # Binary configuration
    settings = "os", "compiler", "build_type", "arch"
    options = {
        "shared": [True, False],
        "fPIC": [True, False],
        "enable_test": ["ON", "OFF"],
        "enable_coverage": ["ON", "OFF"]
    }
    default_options = {
        "shared": True,
        "fPIC": True,
        "enable_test": "ON",
        "enable_coverage": "ON"
    }
    generators = "CMakeToolchain", "CMakeDeps"
    graph_root = os.getcwd()
    
    def layout(self):
        build_f = self.settings.get_safe("compiler")
        cmake_layout(self, src_folder="." , build_folder= "build/"+build_f)
        self.graph_root = os.getcwd()
        self.install_folder = self.graph_root +"/build/"
        self.install_folder = self.install_folder +build_f + "/"+ self.settings.get_safe("build_type")

    def build(self):
        self.run('export CC="/usr/lib/ccache/gcc"')
        self.run('export CXX="/usr/lib/ccache/g++"')
        self.run(
            'VERBOSE=1 colcon build --continue-on-error --event-handlers console_cohesion+ --cmake-args -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON  -DBUILD_SHARED_LIBS=ON --paths="../../../../tier4_perception_msgs"')
        
    def package(self):
        # Define the source path where the headers are located after the build
        install_path = os.path.join(self.install_folder, "install", "tier4_perception_msgs")
        
        # copying headers from build_folder
        copy(self, "*", install_path, self.package_folder)
        
    def package_info(self):
        self.cpp_info.includedirs = ["include/tier4_perception_msgs"]

Notes for reviewers

I can update the conanfile for other msgs as well. But for now to make the review easier we need to agree on the format of the conan recipes.

Interface changes

Effects on system behavior

we need to add conan2 on the docker

pip install conan2

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

@ZahraBoroujeni ZahraBoroujeni changed the title add recipe for autoware_msg feat add recipe for autoware_msg Sep 12, 2024
@ZahraBoroujeni ZahraBoroujeni changed the title feat add recipe for autoware_msg feat(autoware_msg): add recipe Sep 12, 2024
@ZahraBoroujeni ZahraBoroujeni force-pushed the add-conan-recipes branch 3 times, most recently from 9967c6b to d122893 Compare September 12, 2024 11:03
Signed-off-by: Zahra Boroujeni <[email protected]>
@mitsudome-r
Copy link
Member

@ZahraBoroujeni
Thanks for the PR. However, I'm not very familiar with conan, but do you have any reasons why you want to generate conan package? We are release autoware_msgs through ROS buildfarm for the people who don't want to build from source. (e.g., sudo apt install ros-humble-autoware-perception-msgs )

@ZahraBoroujeni
Copy link
Author

ZahraBoroujeni commented Sep 13, 2024

@mitsudome-r
Do you have plan to release in ROS buildfarm for all the autoware packages?
I would like to have binary of autoware-bytetrack. Therefore, I have started to make conan packages for all its dependencies. There is a non-end discussion about conan package for ros packages.

  1. There are some external dependencies for some packages like kalman_filter, so it would be great to make the libraries separate for the nodes.
  2. I would like to make a separate conan package for each library and add them as dependencies to the node packages.
  3. The libraries can be separated from the nodes that we can use them also in another SDK like AUTOSAR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants