-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Imported upstream version '2.0.0' of 'upstream'
- Loading branch information
Showing
17 changed files
with
652 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
BasedOnStyle: Google | ||
ColumnLimit: 120 | ||
MaxEmptyLinesToKeep: 1 | ||
SortIncludes: false | ||
|
||
Standard: Auto | ||
IndentWidth: 2 | ||
TabWidth: 2 | ||
UseTab: Never | ||
AccessModifierOffset: -2 | ||
ConstructorInitializerIndentWidth: 2 | ||
NamespaceIndentation: None | ||
ContinuationIndentWidth: 4 | ||
IndentCaseLabels: true | ||
IndentFunctionDeclarationAfterType: false | ||
|
||
AlignEscapedNewlinesLeft: false | ||
AlignTrailingComments: true | ||
|
||
AllowAllParametersOfDeclarationOnNextLine: false | ||
ExperimentalAutoDetectBinPacking: false | ||
ObjCSpaceBeforeProtocolList: true | ||
Cpp11BracedListStyle: false | ||
|
||
AllowShortBlocksOnASingleLine: true | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortCaseLabelsOnASingleLine: false | ||
|
||
AlwaysBreakTemplateDeclarations: true | ||
AlwaysBreakBeforeMultilineStrings: false | ||
BreakBeforeBinaryOperators: false | ||
BreakBeforeTernaryOperators: false | ||
BreakConstructorInitializersBeforeComma: true | ||
|
||
BinPackParameters: true | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
DerivePointerBinding: false | ||
PointerBindsToType: true | ||
|
||
PenaltyExcessCharacter: 50 | ||
PenaltyBreakBeforeFirstCallParameter: 30 | ||
PenaltyBreakComment: 1000 | ||
PenaltyBreakFirstLessLess: 10 | ||
PenaltyBreakString: 100 | ||
PenaltyReturnTypeOnItsOwnLine: 50 | ||
|
||
SpacesBeforeTrailingComments: 2 | ||
SpacesInParentheses: false | ||
SpacesInAngles: false | ||
SpaceInEmptyParentheses: false | ||
SpacesInCStyleCastParentheses: false | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterControlStatementKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
|
||
# Configure each individual brace in BraceWrapping | ||
BreakBeforeBraces: Custom | ||
|
||
# Control of individual brace wrapping cases | ||
BraceWrapping: | ||
AfterCaseLabel: true | ||
AfterClass: true | ||
AfterControlStatement: true | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). | ||
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) | ||
|
||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
ici: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
distro: [humble, rolling] | ||
include: | ||
- distro: humble | ||
env: | ||
CLANG_TIDY: true | ||
TARGET_CMAKE_ARGS: >- | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wold-style-cast" | ||
env: | ||
ROS_DISTRO: ${{ matrix.distro }} | ||
CLANG_TIDY_ARGS: -quiet -export-fixes ${{ github.workspace }}/.work/clang-tidy-fixes.yaml | ||
CCACHE_DIR: ${{ github.workspace }}/.ccache | ||
BASEDIR: ${{ github.workspace }}/.work | ||
CACHE_PREFIX: "${{ matrix.distro }}${{ contains(matrix.env.TARGET_CMAKE_ARGS, '--coverage') && '-ccov' || '' }}" | ||
# perform full clang-tidy check only on manual trigger (workflow_dispatch), PRs do check changed files, otherwise nothing | ||
CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }} | ||
CC: ${{ matrix.env.CLANG_TIDY && 'clang' }} | ||
CXX: ${{ matrix.env.CLANG_TIDY && 'clang++' }} | ||
ADDITIONAL_DEBS: ${{ matrix.env.CLANG_TIDY && 'clang' }} | ||
CLANG_TIDY: ${{ matrix.env.CLANG_TIDY }} | ||
TARGET_CMAKE_ARGS: ${{ matrix.env.TARGET_CMAKE_ARGS }} | ||
|
||
name: "${{ matrix.distro }}${{ matrix.env.NAME && ' • ' || ''}}${{ matrix.env.NAME }}${{ matrix.env.CLANG_TIDY && ' • clang-tidy' || '' }}" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache ccache | ||
uses: rhaschke/cache@main | ||
with: | ||
path: ${{ env.CCACHE_DIR }} | ||
key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }} | ||
restore-keys: | | ||
ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }} | ||
ccache-${{ env.CACHE_PREFIX }} | ||
env: | ||
GHA_CACHE_SAVE: always | ||
|
||
- id: ici | ||
name: Run industrial_ci | ||
uses: rhaschke/industrial_ci@master | ||
|
||
- name: Upload clang-tidy fixes (on failure) | ||
uses: actions/upload-artifact@v4 | ||
if: failure() && steps.ici.outputs.clang_tidy_checks | ||
with: | ||
name: clang-tidy-fixes.yaml | ||
path: ${{ env.BASEDIR }}/clang-tidy-fixes.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This is a format job. Pre-commit has a first-party GitHub action, so we use | ||
# that: https://github.com/pre-commit/action | ||
|
||
name: Format | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
pre-commit: | ||
name: pre-commit | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Install clang-format | ||
run: sudo apt-get install clang-format | ||
- uses: pre-commit/action@v3.0.1 | ||
id: precommit | ||
- name: Upload pre-commit changes | ||
if: failure() && steps.precommit.outcome == 'failure' | ||
uses: rhaschke/upload-git-patch-action@main | ||
with: | ||
name: pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# To use: | ||
# | ||
# pre-commit run -a | ||
# | ||
# Or: | ||
# | ||
# pre-commit install # (runs every time you commit in git) | ||
# | ||
# To update this file: | ||
# | ||
# pre-commit autoupdate | ||
# | ||
# See https://github.com/pre-commit/pre-commit | ||
|
||
repos: | ||
# Standard hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.4.2 | ||
hooks: | ||
- id: black | ||
args: ["--line-length", "100"] | ||
|
||
- repo: local | ||
hooks: | ||
- id: clang-format | ||
name: clang-format | ||
description: Format files with ClangFormat. | ||
entry: clang-format | ||
language: system | ||
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$ | ||
args: ["-fallback-style=none", "-i"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,56 @@ | ||
cmake_minimum_required(VERSION 3.0.2) | ||
cmake_minimum_required(VERSION 3.5) | ||
project(py_binding_tools) | ||
|
||
find_package(catkin REQUIRED | ||
COMPONENTS | ||
geometry_msgs | ||
pybind11_catkin | ||
roscpp | ||
) | ||
|
||
# catkin_python_setup() | ||
|
||
catkin_package( | ||
INCLUDE_DIRS include | ||
LIBRARIES ${PROJECT_NAME} | ||
CATKIN_DEPENDS geometry_msgs roscpp | ||
) | ||
|
||
include_directories(include ${catkin_INCLUDE_DIRS}) | ||
find_package(ament_cmake REQUIRED) | ||
find_package(ament_cmake_python REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(geometry_msgs REQUIRED) | ||
find_package(Python3 REQUIRED COMPONENTS Interpreter Development) | ||
find_package(pybind11_vendor REQUIRED) | ||
find_package(pybind11 REQUIRED) | ||
|
||
add_library(${PROJECT_NAME} | ||
add_library(${PROJECT_NAME} SHARED | ||
src/ros_msg_typecasters.cpp | ||
src/roscpp_initializer.cpp | ||
src/initializer.cpp | ||
) | ||
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS}) | ||
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${PYTHON_LIBRARIES}) | ||
target_include_directories(${PROJECT_NAME} | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>) | ||
ament_target_dependencies(${PROJECT_NAME} rclcpp geometry_msgs pybind11) | ||
|
||
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET) | ||
|
||
install( | ||
TARGETS ${PROJECT_NAME} | ||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} | ||
EXPORT ${PROJECT_NAME}Targets | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
) | ||
|
||
install(DIRECTORY include/${PROJECT_NAME}/ | ||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} | ||
install( | ||
DIRECTORY include/ | ||
DESTINATION include/${PROJECT_NAME} | ||
) | ||
|
||
#catkin_lint cannot detect target declarations in functions, here in pybind11_add_module | ||
#catkin_lint: ignore undefined_target | ||
_ament_cmake_python_register_environment_hook() | ||
|
||
pybind11_add_module(rclcpp src/rclcpp.cpp) | ||
target_link_libraries(rclcpp PRIVATE ${PROJECT_NAME}) | ||
install(TARGETS rclcpp LIBRARY DESTINATION "${PYTHON_INSTALL_DIR}") | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_cmake_pytest REQUIRED) | ||
find_package(std_msgs REQUIRED) | ||
|
||
pybind11_add_module(${PROJECT_NAME}_test test/test.cpp) | ||
target_link_libraries(${PROJECT_NAME}_test PRIVATE ${PROJECT_NAME} ${std_msgs_TARGETS}) | ||
install(TARGETS ${PROJECT_NAME}_test LIBRARY DESTINATION "${PYTHON_INSTALL_DIR}") | ||
|
||
pybind_add_module(${PROJECT_NAME}_module src/${PROJECT_NAME}.cpp) | ||
set_target_properties(${PROJECT_NAME}_module PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) | ||
target_link_libraries(${PROJECT_NAME}_module PRIVATE ${PROJECT_NAME}) | ||
ament_add_pytest_test(basic test/test_basic.py) | ||
endif() | ||
|
||
install(TARGETS ${PROJECT_NAME}_module | ||
LIBRARY DESTINATION ${CATKIN_GLOBAL_PYTHON_DESTINATION}) | ||
ament_export_dependencies(rclcpp) | ||
ament_export_dependencies(geometry_msgs) | ||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.