Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/fork_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: micro-ROS fork Update Checker
on:
workflow_dispatch:
inputs:
name:
description: "Manual trigger"
schedule:
- cron: '0 4 * * *'

jobs:
micro_ros_fork_update_check:
runs-on: ubuntu-latest
container: ubuntu:20.04
strategy:
fail-fast: false
matrix:
branches: [humble, jazzy, kilted, rolling]
steps:
- name: Check
id: check
shell: bash
run: |
apt update; apt install -y git
REPO=$(echo ${{ github.repository }} | awk '{split($0,a,"/"); print a[2]}')
git clone -b ${{ matrix.branches }} https://github.com/micro-ros/$REPO
cd $REPO
git remote add ros2 https://github.com/ros2/$REPO
git fetch ros2
git fetch origin
echo "::set-output name=merge_required::true"
CMP=$(git rev-list --left-right --count ros2/${{ matrix.branches }}...origin/${{ matrix.branches }} | awk '{print $1}')
if [ $CMP = "0" ]; then echo "::set-output name=merge_required::false"; fi

- name: Alert
if: ${{ steps.check.outputs.merge_required == 'true' }}
run: exit 1
16 changes: 16 additions & 0 deletions .github/workflows/humble-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: rcutils CI Humble

on:
push:
branches: [ humble ]
pull_request:
branches: [ humble ]

jobs:
humble-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: ${{ github.ref }}
os: ubuntu-22.04
docker-image: ubuntu:jammy
ros-distribution: humble
16 changes: 16 additions & 0 deletions .github/workflows/jazzy-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: rcutils CI Jazzy

on:
push:
branches: [ jazzy ]
pull_request:
branches: [ jazzy ]

jobs:
jazzy-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: ${{ github.ref }}
os: ubuntu-24.04
docker-image: ubuntu:noble
ros-distribution: jazzy
16 changes: 16 additions & 0 deletions .github/workflows/kilted-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: rcutils CI Kilted

on:
push:
branches: [ kilted ]
pull_request:
branches: [ kilted ]

jobs:
kilted-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: ${{ github.ref }}
os: ubuntu-24.04
docker-image: ubuntu:noble
ros-distribution: kilted
56 changes: 56 additions & 0 deletions .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Reusable rcutils CI

on:
workflow_call:
inputs:
branch:
description: "The rcutils branch to use for the workflow"
required: true
type: string
os:
description: "The OS to use for the workflow"
required: true
type: string
docker-image:
description: "The docker image to use for the workflow"
required: true
type: string
ros-distribution:
description: "The ROS distribution to use for the workflow"
required: true
type: string

jobs:
build:
runs-on: ${{ inputs.os }}
strategy:
fail-fast: false
container:
image: ${{ inputs.docker-image }}
steps:

- run: |
apt-get update && apt-get install -y git
shell: bash

- name: Sync repository
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
submodules: recursive

- name: Setup ROS 2
uses: ros-tooling/setup-ros@0.7.15
with:
required-ros-distributions: ${{ inputs.ros-distribution }}

- name : Download and install rcutils-dependencies
run: |
apt-get install ros-${{ inputs.ros-distribution }}-mimick-vendor
apt-get -y install ros-${{ inputs.ros-distribution }}-performance-test-fixture

- uses : ros-tooling/action-ros-ci@0.4.5
with:
package-name: "rcutils"
target-ros2-distro: ${{ inputs.ros-distribution }}
skip-tests: true
16 changes: 16 additions & 0 deletions .github/workflows/rolling-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: rcutils CI Rolling

on:
push:
branches: [ rolling ]
pull_request:
branches: [ rolling ]

jobs:
rolling-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: ${{ github.ref }}
os: ubuntu-24.04
docker-image: ubuntu:noble
ros-distribution: rolling
37 changes: 37 additions & 0 deletions .github/workflows/weekly-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: rcutils weekly CI (all distributions)

on:
schedule:
# Run once per week to detect broken dependencies.
- cron: '59 23 * * 0'
workflow_dispatch:

jobs:
humble-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: humble
os: ubuntu-22.04
docker-image: ubuntu:jammy
ros-distribution: humble
jazzy-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: jazzy
os: ubuntu-24.04
docker-image: ubuntu:noble
ros-distribution: jazzy
kilted-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: kilted
os: ubuntu-24.04
docker-image: ubuntu:noble
ros-distribution: kilted
rolling-ci:
uses: ./.github/workflows/reusable-ci.yml
with:
branch: rolling
os: ubuntu-24.04
docker-image: ubuntu:noble
ros-distribution: rolling
24 changes: 20 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.12)

project(rcutils)

option(RCUTILS_NO_THREAD_SUPPORT "Disable thread support." OFF)
option(RCUTILS_NO_FILESYSTEM "Disable filesystem usage." OFF)
option(RCUTILS_AVOID_DYNAMIC_ALLOCATION "Disable dynamic allocations." OFF)
option(RCUTILS_NO_64_ATOMIC "Enable alternative support for 64 bits atomic operations in platforms with no native support." OFF)
option(RCUTILS_MICROROS "Flag for building micro-ROS." ON)

# Default to C11
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 11)
Expand Down Expand Up @@ -30,7 +36,7 @@ if(UNIX AND NOT APPLE)
endif()
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(NOT RCUTILS_MICROROS AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
# enables building a static library but later link it into a dynamic library
add_compile_options(-fPIC)
endif()
Expand Down Expand Up @@ -75,6 +81,7 @@ set(rcutils_sources
src/time.c
${time_impl_c}
src/uint8_array.c
$<$<BOOL:${RCUTILS_NO_64_ATOMIC}>:src/atomic_64bits.c>
)
set_source_files_properties(
${rcutils_sources}
Expand Down Expand Up @@ -129,8 +136,14 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_BUILDING_DLL")
if(BUILD_TESTING AND NOT RCUTILS_DISABLE_FAULT_INJECTION)
target_compile_definitions(${PROJECT_NAME} PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/include/rcutils/configuration_flags.h.in"
"${PROJECT_BINARY_DIR}/include/rcutils/configuration_flags.h"
)

target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
if(NOT RCUTILS_NO_FILESYSTEM)
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
endif()

check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)

Expand Down Expand Up @@ -282,7 +295,7 @@ if(BUILD_TESTING)
)
if(TARGET test_error_handling_helpers)
target_include_directories(test_error_handling_helpers PUBLIC include)
target_link_libraries(test_error_handling_helpers osrf_testing_tools_cpp::memory_tools)
target_link_libraries(test_error_handling_helpers ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools)
endif()

rcutils_custom_add_gtest(test_split
Expand Down Expand Up @@ -587,7 +600,10 @@ endif()

# Export old-style CMake variables
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})

if(NOT RCUTILS_NO_FILESYSTEM)
ament_export_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
endif()

# Export modern CMake targets
ament_export_targets(${PROJECT_NAME})
Expand Down
15 changes: 15 additions & 0 deletions include/rcutils/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ RCUTILS_WARN_UNUSED
rcutils_allocator_t
rcutils_get_zero_initialized_allocator(void);

/// Set rcutils default allocators.
/**
* <hr>
* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | No
* Thread-Safe | Yes
* Uses Atomics | No
* Lock-Free | Yes
*/
RCUTILS_PUBLIC
RCUTILS_WARN_UNUSED
bool
rcutils_set_default_allocator(rcutils_allocator_t * allocator);

/// Return a properly initialized rcutils_allocator_t with default values.
/**
* This defaults to:
Expand Down
19 changes: 19 additions & 0 deletions include/rcutils/configuration_flags.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

#ifndef RCUTILS__CONFIGURATION_FLAGS_H_
#define RCUTILS__CONFIGURATION_FLAGS_H_

#ifdef __cplusplus
extern "C"
{
#endif

#cmakedefine RCUTILS_NO_FILESYSTEM
#cmakedefine RCUTILS_AVOID_DYNAMIC_ALLOCATION
#cmakedefine RCUTILS_NO_THREAD_SUPPORT
#cmakedefine RCUTILS_MICROROS

#ifdef __cplusplus
}
#endif

#endif // RCUTILS__CONFIGURATION_FLAGS_H_
Loading