Introduction
Colcon Mixins can be used to apply a group of arguments under onw name. Example:
1
colcon build --mixin debug clang
This might apply a group of flags related to debug builds, such as:
1
--cmake-args -DCMAKE_BUILD_TYPE=Debug
- Note: mixins are applied in the order listed. If two mixins set the same option, the later one can override the earlier one.
To download:
1
sudo apt install python3-colcon-mixin
How To Use Mixins
-
Define yaml file for mixins:
-
File structure:
1 2 3 4
my_mixins/ ├── index.yaml ├── debug.yaml └── clang.yaml
-
index.yaml
1 2 3
build: debug: debug.yaml clang: clang.yaml
-
debug.yaml
:1 2 3
arguments: cmake-args: - -DCMAKE_BUILD_TYPE=Debug
-
clang.yaml
1 2 3 4
arguments: cmake-args: - -DCMAKE_C_COMPILER=clang - -DCMAKE_CXX_COMPILER=clang++
-
-
Register the mixins:
1
2
colcon mixin add my_mixins /path/to/my_mixins/index.yaml
colcon mixin update
- To check:
1
colcon mixin show
- Use mixins:
1
colcon build --mixin debug clang