Skip to main content
Version: 2.0.0

ROS2 workspace profiles

Setting work-space wide configurations​

Mixin​

A mixin is a tag given to a set of parameters that you may want to pass to colcon during build (maybe used with other colcon commands).

Adding Mixins to colcon​

Add the official mixin repository to install the default mixins:

colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml

Update the mixins:

colcon mixin update

List the mixins:

colcon mixin list

Build with particular mixin:

colcon build --mixin rel-with-deb-info

Adding a custom Mixins​

  • Make a custom.mixin file that defines custom mixins(JSON format). Here we add a mixin for the MRS_ENABLE_TESTING flag.
{
"build": {
"mrs-testing": {
"cmake-args": ["-DMRS_ENABLE_TESTING=true",
"-DENABLE_TESTS=true"]
},
}
}
  • Make an index.yaml file for colcon mixin to find all the defined mixins
mixin:
- custom.mixin
  • Add the file to the mixin repository and update the mixins:
colcon mixin add mrs file://<path-to-directory-with-mixin-index-file>/index.yaml
colcon mixin update mrs

Using Mixins for build​

  • colcon uses configuration files for building, testing and installing packages. It's good practice to have a colcon_defaults.yaml in the root of your ROS2 workspace.
  • The file can have different parameters as described at https://colcon.readthedocs.io/en/released/reference/verb/build.html. For eg. using a particular mixin and limiting the threads during build would look like
build:
parallel-workers: 8
mixin:
- rel-with-deb-info
- mrs-testing