From 9967c6b0d0b038a361cb69e3bd3322dab579d92b Mon Sep 17 00:00:00 2001 From: Zahra Boroujeni Date: Thu, 12 Sep 2024 10:04:49 +0000 Subject: [PATCH] add recipe Signed-off-by: Zahra Boroujeni --- README.md | 12 +++++++ autoware_perception_msgs/conanfile.py | 51 +++++++++++++++++++++++++++ profiles/arm_gcc_pf | 12 +++++++ profiles/clang_pf | 12 +++++++ profiles/gcc_pf | 12 +++++++ 5 files changed, 99 insertions(+) create mode 100644 autoware_perception_msgs/conanfile.py create mode 100644 profiles/arm_gcc_pf create mode 100644 profiles/clang_pf create mode 100644 profiles/gcc_pf diff --git a/README.md b/README.md index 8bfa7c3..77de65d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ # autoware_msgs Before contributing, review [the message guidelines](https://autowarefoundation.github.io/autoware-documentation/main/contributing/coding-guidelines/ros-nodes/message-guidelines/). + +## Add as conan packages + +```sh +pip install conan2 +mkdir ~/.conan2/profiles +touch ~/.conan2/profiles/default +cp profiles/gcc_pf ~/.conan2/profiles/default +conan install . +conan build . +conan create . +``` diff --git a/autoware_perception_msgs/conanfile.py b/autoware_perception_msgs/conanfile.py new file mode 100644 index 0000000..e49f124 --- /dev/null +++ b/autoware_perception_msgs/conanfile.py @@ -0,0 +1,51 @@ +from conan import ConanFile, tools +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import copy +import os + +class App(ConanFile): + name = "autoware_perception_msgs" + version = "0.0.0" + # Optional metadata + license = " " # Todo + topics = ("Base") + requires = [] + # 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" + + 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_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_SHARED_LIBS=ON --paths="../../../../autoware_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", "autoware_perception_msgs") + + # copying headers from build_folder + copy(self, "*", install_path, self.package_folder) + + def package_info(self): + self.cpp_info.includedirs = ["include/autoware_perception_msgs"] diff --git a/profiles/arm_gcc_pf b/profiles/arm_gcc_pf new file mode 100644 index 0000000..c0cff10 --- /dev/null +++ b/profiles/arm_gcc_pf @@ -0,0 +1,12 @@ +[settings] +os=Linux +arch=armv8 +compiler=gcc +compiler.version=11.4 +compiler.libcxx=libstdc++11 +build_type=Debug +[options] +&:enable_test=ON +[buildenv] +CC=gcc +CXX=g++ diff --git a/profiles/clang_pf b/profiles/clang_pf new file mode 100644 index 0000000..045c837 --- /dev/null +++ b/profiles/clang_pf @@ -0,0 +1,12 @@ +[settings] +os=Linux +arch=x86_64 +compiler=clang +compiler.version=18 +compiler.libcxx=libstdc++11 +build_type=Debug +[options] +&:enable_test=ON +[buildenv] +CC=clang +CXX=clang++ diff --git a/profiles/gcc_pf b/profiles/gcc_pf new file mode 100644 index 0000000..69eb72f --- /dev/null +++ b/profiles/gcc_pf @@ -0,0 +1,12 @@ +[settings] +os=Linux +arch=x86_64 +compiler=gcc +compiler.version=11.4 +compiler.libcxx=libstdc++11 +build_type=Debug +[options] +&:enable_test=ON +[buildenv] +CC=gcc +CXX=g++