LoginSignup
1
1

More than 1 year has passed since last update.

catkinでprofileの切り替えてclang-tidyをお手軽にかける

Last updated at Posted at 2022-01-19

catkinのprofile機能

そもそものモチベーションはcatkinでビルドしているワークスペースがあり、そこでclang-tidyを手軽にかける方法を探していたのですが、catkinにprofile機能というのがあり、それを使えば簡単にできそうだったので紹介します。

catkinのprofile機能に関しては、ここに良い記事があるので参照いただければと思います。https://choreonoid.org/ja/manuals/latest/ros/catkin-profile.html
簡単に言うと、ビルド環境(ビルドオプション、ビルドターゲット、ビルド成果物の場所)等を簡単に切り替えるための機能です。

サンプル

以下のように例えば3つprofileを用意します。

catkin config --profile release --install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
catkin config --profile debug --install --cmake-args -DCMAKE_BUILD_TYPE=Debug
catkin config --profile clang-tidy --whitelist foo piyo -x _tidy --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_CLANG_TIDY:STRING="clang-tidy-12;-checks=*"

この状態で、

catkin profile set clang-tidy
catkin build

とすると、foo, piyoパッケージだけにclang-tidyがかけられます。third_partyのパッケージがワークスペースに入っていても対象から簡単に外せたりするので便利です。

catkin profile set debug
catkin build

でdebugビルドができます。

catkin build --interleave

のように、--interleave をつけるとビルド途中が確認できこれも便利です。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1