Skip to content

Commit da5bd39

Browse files
David-LP99pablogs9jamoralpbjsowa4ntn
committed
micro-ROS Lyrical patch
* micro-ROS changes over dashing * Added and updated security directory (#1) * RCUTILS_NO_FILESYSTEM and RCUTILS_AVOID_DYNAMIC_ALLOCATION (#2) - No filesystem options; default allocators write access - Avoid dynamic allocation and no filesystem on error handling - Error handling template; new allocator approach * Add test_security_directory test from rcl (#3) * Zephyr fixes (#4) * CMake refactor (#5) * Update approach (#6) - Remove target_compile_definitions and refactor flags install - Added RCUTILS_NO_FILESYSTEM on new functions * Updates 17092020 * Fix atomics 64bits (#9) - Add hashing and lock pool * Updates 09102020 * Release micro-ROS Foxy (#8) - Update filesystem; adjust logger level; cleaning * Remove build warning (#10) - avoid not used warnings * Reduce error handling static size (#14) (#15) * Revert "Revert "Install headers to include/${PROJECT_NAME} (ros2#351)"" * Fix atomic 64 b description (#17) (#18) * Add fork checker for humble * Don't link dl library when not needed (#28) * Revert "Set hints to find the python version we actually want. (ros2#451)" * Fix struct tm init * Add PRId64 * Don't export dl library when not used (#33) (#34) * Remove unnecessary folder (#42) * Update CI (backport #43) (#46) - Add CI and nightly for each distro; update git version; skip tests - Change nightly to weekly; change master to rolling in fork checker * Add RCUTILS_NO_PROCESS_SUPPORT option to build without fork/exec/wait (#50) * Update CI (#51) Dropped during the rebase as superseded by upstream: * Don't export dl library when not used (#33) (#34) Co-authored-by: Pablo Garrido <pablogs9@gmail.com> Co-authored-by: Jose Antonio Moral <joseantoniomoralparras@gmail.com> Co-authored-by: Blazej Sowa <bsowa123@gmail.com> Co-authored-by: Anton Casas <antoncasas@eprosima.com> Co-authored-by: Eugenio Collado <eugeniocollado@eprosima.com> Co-authored-by: Carlos Espinoza Curto <148376273+Carlosespicur@users.noreply.github.com> Co-authored-by: Jimmy McElwain <jimmy.mcelwain@motoman.com> Signed-off-by: David Laseca <davidlaseca@eprosima.com>
1 parent 71406a1 commit da5bd39

25 files changed

Lines changed: 711 additions & 27 deletions

‎.github/workflows/fork_checker.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: micro-ROS fork Update Checker
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
name:
6+
description: "Manual trigger"
7+
schedule:
8+
- cron: '0 4 * * *'
9+
10+
jobs:
11+
micro_ros_fork_update_check:
12+
runs-on: ubuntu-latest
13+
container: ubuntu:20.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
branches: [humble, jazzy, kilted, lyrical, rolling]
18+
steps:
19+
- name: Check
20+
id: check
21+
shell: bash
22+
run: |
23+
apt update; apt install -y git
24+
REPO=$(echo ${{ github.repository }} | awk '{split($0,a,"/"); print a[2]}')
25+
git clone -b ${{ matrix.branches }} https://github.com/micro-ros/$REPO
26+
cd $REPO
27+
git remote add ros2 https://github.com/ros2/$REPO
28+
git fetch ros2
29+
git fetch origin
30+
echo "::set-output name=merge_required::true"
31+
CMP=$(git rev-list --left-right --count ros2/${{ matrix.branches }}...origin/${{ matrix.branches }} | awk '{print $1}')
32+
if [ $CMP = "0" ]; then echo "::set-output name=merge_required::false"; fi
33+
34+
- name: Alert
35+
if: ${{ steps.check.outputs.merge_required == 'true' }}
36+
run: exit 1

‎.github/workflows/humble-ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Humble
2+
3+
on:
4+
push:
5+
branches: [ humble ]
6+
pull_request:
7+
branches: [ humble ]
8+
9+
jobs:
10+
humble-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-22.04
15+
docker-image: ubuntu:jammy
16+
ros-distribution: humble

‎.github/workflows/jazzy-ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Jazzy
2+
3+
on:
4+
push:
5+
branches: [ jazzy ]
6+
pull_request:
7+
branches: [ jazzy ]
8+
9+
jobs:
10+
jazzy-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-24.04
15+
docker-image: ubuntu:noble
16+
ros-distribution: jazzy

‎.github/workflows/kilted-ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Kilted
2+
3+
on:
4+
push:
5+
branches: [ kilted ]
6+
pull_request:
7+
branches: [ kilted ]
8+
9+
jobs:
10+
kilted-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-24.04
15+
docker-image: ubuntu:noble
16+
ros-distribution: kilted

‎.github/workflows/lyrical-ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Lyrical
2+
3+
on:
4+
push:
5+
branches: [ lyrical ]
6+
pull_request:
7+
branches: [ lyrical ]
8+
9+
jobs:
10+
lyrical-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-26.04
15+
docker-image: ubuntu:resolute
16+
ros-distribution: lyrical

‎.github/workflows/reusable-ci.yml‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Reusable rcutils CI
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
branch:
7+
description: "The rcutils branch to use for the workflow"
8+
required: true
9+
type: string
10+
os:
11+
description: "The OS to use for the workflow"
12+
required: true
13+
type: string
14+
docker-image:
15+
description: "The docker image to use for the workflow"
16+
required: true
17+
type: string
18+
ros-distribution:
19+
description: "The ROS distribution to use for the workflow"
20+
required: true
21+
type: string
22+
23+
jobs:
24+
build:
25+
runs-on: ${{ inputs.os }}
26+
strategy:
27+
fail-fast: false
28+
container:
29+
image: ${{ inputs.docker-image }}
30+
steps:
31+
32+
- run: |
33+
apt-get update && apt-get install -y git
34+
shell: bash
35+
36+
- name: Sync repository
37+
uses: actions/checkout@v5
38+
with:
39+
ref: ${{ inputs.branch }}
40+
submodules: recursive
41+
42+
- name: Setup ROS 2
43+
uses: ros-tooling/setup-ros@0.7.19
44+
with:
45+
required-ros-distributions: ${{ inputs.ros-distribution }}
46+
47+
- name : Download and install rcutils-dependencies
48+
run: |
49+
apt-get install ros-${{ inputs.ros-distribution }}-mimick-vendor
50+
apt-get -y install ros-${{ inputs.ros-distribution }}-performance-test-fixture
51+
52+
- uses : ros-tooling/action-ros-ci@0.4.8
53+
with:
54+
package-name: "rcutils"
55+
target-ros2-distro: ${{ inputs.ros-distribution }}
56+
skip-tests: true

‎.github/workflows/rolling-ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Rolling
2+
3+
on:
4+
push:
5+
branches: [ rolling ]
6+
pull_request:
7+
branches: [ rolling ]
8+
9+
jobs:
10+
rolling-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-24.04
15+
docker-image: ubuntu:noble
16+
ros-distribution: rolling

‎.github/workflows/weekly-ci.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: rcutils weekly CI (all distributions)
2+
3+
on:
4+
schedule:
5+
# Run once per week to detect broken dependencies.
6+
- cron: '59 23 * * 0'
7+
workflow_dispatch:
8+
9+
jobs:
10+
humble-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: humble
14+
os: ubuntu-22.04
15+
docker-image: ubuntu:jammy
16+
ros-distribution: humble
17+
jazzy-ci:
18+
uses: ./.github/workflows/reusable-ci.yml
19+
with:
20+
branch: jazzy
21+
os: ubuntu-24.04
22+
docker-image: ubuntu:noble
23+
ros-distribution: jazzy
24+
kilted-ci:
25+
uses: ./.github/workflows/reusable-ci.yml
26+
with:
27+
branch: kilted
28+
os: ubuntu-24.04
29+
docker-image: ubuntu:noble
30+
ros-distribution: kilted
31+
lyrical-ci:
32+
uses: ./.github/workflows/reusable-ci.yml
33+
with:
34+
branch: lyrical
35+
os: ubuntu-26.04
36+
docker-image: ubuntu:resolute
37+
ros-distribution: lyrical
38+
rolling-ci:
39+
uses: ./.github/workflows/reusable-ci.yml
40+
with:
41+
branch: rolling
42+
os: ubuntu-24.04
43+
docker-image: ubuntu:noble
44+
ros-distribution: rolling

‎CMakeLists.txt‎

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
cmake_minimum_required(VERSION 3.20)
1+
cmake_minimum_required(VERSION 3.12)
22

33
project(rcutils)
44

5+
option(RCUTILS_NO_THREAD_SUPPORT "Disable thread support." OFF)
6+
option(RCUTILS_NO_FILESYSTEM "Disable filesystem usage." OFF)
7+
option(RCUTILS_NO_PROCESS_SUPPORT "Disable process support." OFF)
8+
option(RCUTILS_AVOID_DYNAMIC_ALLOCATION "Disable dynamic allocations." OFF)
9+
option(RCUTILS_NO_64_ATOMIC "Enable alternative support for 64 bits atomic operations in platforms with no native support." OFF)
10+
option(RCUTILS_MICROROS "Flag for building micro-ROS." ON)
11+
512
include(CheckLibraryExists)
613

714
find_package(ament_cmake REQUIRED)
@@ -17,7 +24,7 @@ if(UNIX AND NOT APPLE)
1724
endif()
1825
endif()
1926

20-
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
27+
if(NOT RCUTILS_MICROROS AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
2128
# enables building a static library but later link it into a dynamic library
2229
add_compile_options(-fPIC)
2330
endif()
@@ -66,6 +73,7 @@ set(rcutils_sources
6673
src/time.c
6774
${time_impl_c}
6875
src/uint8_array.c
76+
$<$<BOOL:${RCUTILS_NO_64_ATOMIC}>:src/atomic_64bits.c>
6977
)
7078
set_source_files_properties(
7179
${rcutils_sources}
@@ -76,6 +84,7 @@ add_library(
7684
${rcutils_sources})
7785
target_include_directories(${PROJECT_NAME} PUBLIC
7886
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
87+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
7988
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
8089

8190
# Causes the visibility macros to use dllexport rather than dllimport,
@@ -85,11 +94,18 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_BUILDING_DLL")
8594
if(BUILD_TESTING AND NOT RCUTILS_DISABLE_FAULT_INJECTION)
8695
target_compile_definitions(${PROJECT_NAME} PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
8796
endif()
97+
configure_file(
98+
"${PROJECT_SOURCE_DIR}/include/rcutils/configuration_flags.h.in"
99+
"${PROJECT_BINARY_DIR}/include/rcutils/configuration_flags.h"
100+
)
88101

89102
target_link_libraries(${PROJECT_NAME}
90103
${CMAKE_DL_LIBS}
91104
ament_cmake_ros_core::ament_ros_defaults
92105
)
106+
if(NOT RCUTILS_NO_FILESYSTEM)
107+
target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS})
108+
endif()
93109

94110
check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)
95111

@@ -549,17 +565,19 @@ if(BUILD_TESTING)
549565
)
550566
endif()
551567

552-
ament_add_gtest(test_process
553-
test/test_process.cpp
554-
)
555-
if(TARGET test_process)
556-
target_link_libraries(test_process
557-
${PROJECT_NAME}
558-
ament_cmake_ros_core::ament_ros_defaults
568+
if(NOT RCUTILS_NO_PROCESS_SUPPORT)
569+
ament_add_gtest(test_process
570+
test/test_process.cpp
559571
)
560-
target_compile_definitions(test_process PRIVATE
561-
"CMAKE_COMMAND=${CMAKE_COMMAND}")
562-
file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/file with space.txt")
572+
if(TARGET test_process)
573+
target_link_libraries(test_process
574+
${PROJECT_NAME}
575+
ament_cmake_ros_core::ament_ros_defaults
576+
)
577+
target_compile_definitions(test_process PRIVATE
578+
"CMAKE_COMMAND=${CMAKE_COMMAND}")
579+
file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/file with space.txt")
580+
endif()
563581
endif()
564582

565583
ament_add_gtest(test_logging_custom_env test/test_logging_custom_env.cpp
@@ -696,5 +714,5 @@ ament_export_dependencies(ament_cmake ament_cmake_ros_core)
696714
ament_package()
697715

698716
install(
699-
DIRECTORY include/
717+
DIRECTORY include/ ${CMAKE_CURRENT_BINARY_DIR}/include/
700718
DESTINATION include/${PROJECT_NAME})

‎include/rcutils/allocator.h‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ RCUTILS_WARN_UNUSED
8585
rcutils_allocator_t
8686
rcutils_get_zero_initialized_allocator(void);
8787

88+
/// Set rcutils default allocators.
89+
/**
90+
* <hr>
91+
* Attribute | Adherence
92+
* ------------------ | -------------
93+
* Allocates Memory | No
94+
* Thread-Safe | Yes
95+
* Uses Atomics | No
96+
* Lock-Free | Yes
97+
*/
98+
RCUTILS_PUBLIC
99+
RCUTILS_WARN_UNUSED
100+
bool
101+
rcutils_set_default_allocator(rcutils_allocator_t * allocator);
102+
88103
/// Return a properly initialized rcutils_allocator_t with default values.
89104
/**
90105
* This defaults to:

0 commit comments

Comments
 (0)