Skip to content

Commit

Permalink
Add cmake formatting
Browse files Browse the repository at this point in the history
Flova committed Jan 20, 2024
1 parent 0ea50d2 commit 61dce4b
Showing 33 changed files with 617 additions and 655 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -13,30 +13,27 @@ jobs:
steps:
- name: Set up ROS ecosystem
uses: ros-tooling/setup-ros@v0.7

- name: Check out repository
uses: actions/checkout@v3

- name: Configure git to trust repository
run: git config --global --add safe.directory /__w/bitbots_meta/bitbots_meta
- name: Pull our software
run: make pull-init HTTPS=true
- name: Install proprietary basler drivers
run: make basler ARGS="-ci"
- name: Install packages via rosdep
run: |
rosdep update
sudo apt install -y libunwind-dev
# Small hack to make rosdep install all dependencies at once
# See https://github.com/ros-infrastructure/rosdep/issues/671
bash -c "sudo apt install -y $(rosdep check --from-paths . --ignore-src --rosdistro iron | sed -n 's/^apt\s\+//p' | tr '\n' ' ')"

- name: Pull source code for libraries and install dependencies
run: make install HTTPS=true ARGS="-ci"

- name: Set up colcon workspace
run: |
mkdir -p /colcon_ws/src
ln -s $(realpath .) /colcon_ws/src/bitbots_meta
- name: Build packages
run: |
. /opt/ros/iron/setup.sh
colcon build --symlink-install
working-directory: /colcon_ws

- name: Test packages
run: |
# Source workspace
53 changes: 29 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args:
- "--fix"
- "--exit-non-zero-on-fix"
- repo: https://github.com/psf/black
rev: 23.10.0 # keep this version for Ubuntu support
hooks:
- id: black
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args:
- "-i"
- id: cppcheck
args:
- "--suppress=missingInclude"
- "--suppress=unmatchedSuppression"
- "--suppress=unusedFunction"
- "--suppress=unusedStructMember"
- "--suppress=useStlAlgorithm"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args:
- "--fix"
- "--exit-non-zero-on-fix"
- repo: https://github.com/psf/black
rev: 23.10.0 # keep this version for Ubuntu support
hooks:
- id: black
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args:
- "-i"
- id: cppcheck
args:
- "--suppress=missingInclude"
- "--suppress=unmatchedSuppression"
- "--suppress=unusedFunction"
- "--suppress=unusedStructMember"
- "--suppress=useStlAlgorithm"
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.10
hooks:
- id: cmake-format
- id: cmake-lint
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -72,9 +72,7 @@ endif
rosdep:
# Update rosdep and install dependencies from meta directory
rosdep update
# Small hack to make rosdep install all dependencies at once
# See https://github.com/ros-infrastructure/rosdep/issues/671
bash -c "sudo apt install -y $(rosdep check --from-paths . --ignore-src --rosdistro iron | sed -n 's/^apt\s\+//p' | tr '\n' ' ')"
rosdep install --from-paths . --ignore-src --rosdistro iron -y

status:
# Show status of all repositories
53 changes: 36 additions & 17 deletions bitbots_behavior/bitbots_blackboard/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -18,28 +18,47 @@ find_package(std_srvs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(bitbots_docs REQUIRED)

set(INCLUDE_DIRS ${bio_ik_msgs_INCLUDE_DIRS} ${ament_cmake_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
${rclpy_INCLUDE_DIRS} ${tf2_INCLUDE_DIRS} ${bitbots_msgs_INCLUDE_DIRS}
${std_msgs_INCLUDE_DIRS} ${tf2_geometry_msgs_INCLUDE_DIRS}
${std_srvs_INCLUDE_DIRS} ${geometry_msgs_INCLUDE_DIRS}
${bitbots_docs_INCLUDE_DIRS})
set(INCLUDE_DIRS
${bio_ik_msgs_INCLUDE_DIRS}
${ament_cmake_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
${rclpy_INCLUDE_DIRS}
${tf2_INCLUDE_DIRS}
${bitbots_msgs_INCLUDE_DIRS}
${std_msgs_INCLUDE_DIRS}
${tf2_geometry_msgs_INCLUDE_DIRS}
${std_srvs_INCLUDE_DIRS}
${geometry_msgs_INCLUDE_DIRS}
${bitbots_docs_INCLUDE_DIRS})
include_directories(${INCLUDE_DIRS})

set(LIBRARY_DIRS ${bio_ik_msgs_LIBRARY_DIRS} ${ament_cmake_LIBRARY_DIRS}
${sensor_msgs_LIBRARY_DIRS}
${rclpy_LIBRARY_DIRS} ${tf2_LIBRARY_DIRS} ${bitbots_msgs_LIBRARY_DIRS}
${std_msgs_LIBRARY_DIRS} ${tf2_geometry_msgs_LIBRARY_DIRS}
${std_srvs_LIBRARY_DIRS} ${geometry_msgs_LIBRARY_DIRS}
${bitbots_docs_LIBRARY_DIRS})
set(LIBRARY_DIRS
${bio_ik_msgs_LIBRARY_DIRS}
${ament_cmake_LIBRARY_DIRS}
${sensor_msgs_LIBRARY_DIRS}
${rclpy_LIBRARY_DIRS}
${tf2_LIBRARY_DIRS}
${bitbots_msgs_LIBRARY_DIRS}
${std_msgs_LIBRARY_DIRS}
${tf2_geometry_msgs_LIBRARY_DIRS}
${std_srvs_LIBRARY_DIRS}
${geometry_msgs_LIBRARY_DIRS}
${bitbots_docs_LIBRARY_DIRS})

link_directories(${LIBRARY_DIRS})

set(LIBS ${bio_ik_msgs_LIBRARIES} ${ament_cmake_LIBRARIES}
${sensor_msgs_LIBRARIES} ${rclpy_LIBRARIES}
${tf2_LIBRARIES} ${bitbots_msgs_LIBRARIES} ${std_msgs_LIBRARIES}
${tf2_geometry_msgs_LIBRARIES} ${std_srvs_LIBRARIES} ${geometry_msgs_LIBRARIES}
${bitbots_docs_LIBRARIES})
set(LIBS
${bio_ik_msgs_LIBRARIES}
${ament_cmake_LIBRARIES}
${sensor_msgs_LIBRARIES}
${rclpy_LIBRARIES}
${tf2_LIBRARIES}
${bitbots_msgs_LIBRARIES}
${std_msgs_LIBRARIES}
${tf2_geometry_msgs_LIBRARIES}
${std_srvs_LIBRARIES}
${geometry_msgs_LIBRARIES}
${bitbots_docs_LIBRARIES})

include(${CMAKE_BINARY_DIR}/../bitbots_docs/enable_bitbots_docs.cmake)
enable_bitbots_docs()
31 changes: 15 additions & 16 deletions bitbots_lowlevel/bitbots_buttons/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -17,22 +17,21 @@ find_package(std_srvs REQUIRED)
find_package(test_msgs REQUIRED)

add_executable(button_node src/button_node.cpp)
ament_target_dependencies(button_node
ament_cmake
backward_ros
bitbots_msgs
bitbots_localization
rclcpp
std_msgs
std_srvs
test_msgs)

#enable_bitbots_docs()


install(TARGETS button_node
DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY config DESTINATION share/${PROJECT_NAME})
ament_target_dependencies(
button_node
ament_cmake
backward_ros
bitbots_msgs
bitbots_localization
rclcpp
std_msgs
std_srvs
test_msgs)

# enable_bitbots_docs()

install(TARGETS button_node DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY config DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})

ament_export_dependencies(std_msgs)
125 changes: 61 additions & 64 deletions bitbots_lowlevel/bitbots_ros_control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.5)
project(bitbots_ros_control)

# Add support for C++17
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif ()
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

find_package(ament_cmake REQUIRED)
find_package(backward_ros REQUIRED)
@@ -26,72 +26,72 @@ find_package(tf2_ros REQUIRED)
find_package(transmission_interface REQUIRED)
find_package(yaml-cpp REQUIRED)


set(INCLUDE_DIRS include)
include_directories(${INCLUDE_DIRS})

set(CMAKE_CXX_STANDARD 17)
add_compile_options(-Wall -Werror -Wno-unused -pedantic -Wextra)


set(SOURCES
src/bitfoot_hardware_interface.cpp
src/button_hardware_interface.cpp
src/core_hardware_interface.cpp
src/dynamixel_servo_hardware_interface.cpp
src/imu_hardware_interface.cpp
src/leds_hardware_interface.cpp
src/node.cpp
src/servo_bus_interface.cpp
src/utils.cpp
src/wolfgang_hardware_interface.cpp
include/bitbots_ros_control/hardware_interface.hpp)
src/bitfoot_hardware_interface.cpp
src/button_hardware_interface.cpp
src/core_hardware_interface.cpp
src/dynamixel_servo_hardware_interface.cpp
src/imu_hardware_interface.cpp
src/leds_hardware_interface.cpp
src/node.cpp
src/servo_bus_interface.cpp
src/utils.cpp
src/wolfgang_hardware_interface.cpp
include/bitbots_ros_control/hardware_interface.hpp)

enable_bitbots_docs()

add_executable(ros_control ${SOURCES})
ament_target_dependencies(ros_control
ament_cmake
backward_ros
bitbots_buttons
bitbots_docs
bitbots_msgs
controller_interface
controller_manager
diagnostic_msgs
dynamixel_workbench_toolbox
hardware_interface
pluginlib
rclcpp
realtime_tools
rosidl_typesupport_cpp
std_msgs
std_srvs
tf2_ros
transmission_interface
yaml-cpp)
ament_target_dependencies(
ros_control
ament_cmake
backward_ros
bitbots_buttons
bitbots_docs
bitbots_msgs
controller_interface
controller_manager
diagnostic_msgs
dynamixel_workbench_toolbox
hardware_interface
pluginlib
rclcpp
realtime_tools
rosidl_typesupport_cpp
std_msgs
std_srvs
tf2_ros
transmission_interface
yaml-cpp)

add_executable(pressure_converter src/pressure_converter.cpp)
ament_target_dependencies(pressure_converter
ament_cmake
backward_ros
bitbots_buttons
bitbots_docs
bitbots_msgs
controller_interface
controller_manager
diagnostic_msgs
dynamixel_workbench_toolbox
hardware_interface
pluginlib
rclcpp
realtime_tools
rosidl_typesupport_cpp
std_msgs
std_srvs
tf2_ros
transmission_interface
yaml-cpp)
ament_target_dependencies(
pressure_converter
ament_cmake
backward_ros
bitbots_buttons
bitbots_docs
bitbots_msgs
controller_interface
controller_manager
diagnostic_msgs
dynamixel_workbench_toolbox
hardware_interface
pluginlib
rclcpp
realtime_tools
rosidl_typesupport_cpp
std_msgs
std_srvs
tf2_ros
transmission_interface
yaml-cpp)
target_link_libraries(pressure_converter yaml-cpp)

ament_export_dependencies(ament_cmake)
@@ -108,14 +108,11 @@ ament_export_dependencies(std_msgs)
ament_export_dependencies(tf2_ros)
ament_export_dependencies(transmission_interface)

install(TARGETS ros_control
DESTINATION lib/${PROJECT_NAME})
install(TARGETS pressure_converter
install(TARGETS ros_control DESTINATION lib/${PROJECT_NAME})
install(TARGETS pressure_converter DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY config DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY scripts/ USE_SOURCE_PERMISSIONS
DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY config
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY scripts/ USE_SOURCE_PERMISSIONS DESTINATION lib/${PROJECT_NAME})

ament_package()
6 changes: 2 additions & 4 deletions bitbots_misc/bitbots_basler_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -6,10 +6,8 @@ find_package(ament_cmake REQUIRED)

enable_bitbots_docs()

install(DIRECTORY config
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY config DESTINATION share/${PROJECT_NAME})

install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})

ament_package()
3 changes: 1 addition & 2 deletions bitbots_misc/bitbots_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ find_package(ament_cmake_python REQUIRED)

enable_bitbots_docs()

install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})

ament_package()
Loading

0 comments on commit 61dce4b

Please sign in to comment.