-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added macos support for libcyphal_demo - UDP only transport. (#36)
- libcyphal_demo now based on CMakePresets. - added (from cherry-pick of commit 3431d35) kqueue executor, and little bit fixed incorrect implementation: a) can't combine filters (like `| EVFILT_VNODE`) b) wrong `EV_CLEAR` usage c) wrong `NOTE_xxx` usage Also cherry-pick of commit 54cee7d by Scott Dixon, plus some build fixes. > Simplifying Nunavut integration > Using Nunavut as a submodule now provides all dependencies including pydsdl, public_regulated_data_types, and cmake integration. --------- Co-authored-by: Scott Dixon <[email protected]>
- Loading branch information
1 parent
a3b7ffe
commit 69700a5
Showing
28 changed files
with
891 additions
and
739 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 |
---|---|---|
|
@@ -18,24 +18,23 @@ jobs: | |
build_libcyphal_demo: | ||
name: Build LibCyphal demo | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
build_type: [Release, Debug] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: get nunavut | ||
run: > | ||
pip install git+https://github.com/OpenCyphal/[email protected] | ||
- name: Install Ninja | ||
run: sudo apt-get install ninja-build | ||
|
||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/libcyphal_demo/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{github.workspace}}/libcyphal_demo | ||
run: cd ${{github.workspace}}/libcyphal_demo && cmake --preset Demo-Linux | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/libcyphal_demo/build --config ${{matrix.build_type}} | ||
- name: Build Debug | ||
run: cd ${{github.workspace}}/libcyphal_demo && cmake --build --preset Demo-Linux-Debug | ||
|
||
- name: Build Release | ||
run: cd ${{github.workspace}}/libcyphal_demo && cmake --build --preset Demo-Linux-Release | ||
|
||
build_libudpard_demo: | ||
name: Build LibUDPard demo | ||
|
@@ -46,10 +45,6 @@ jobs: | |
with: | ||
submodules: recursive | ||
|
||
- name: get nunavut | ||
run: > | ||
pip install git+https://github.com/OpenCyphal/[email protected] | ||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/libudpard_demo/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/libudpard_demo | ||
|
||
|
@@ -65,10 +60,6 @@ jobs: | |
with: | ||
submodules: recursive | ||
|
||
- name: get nunavut | ||
run: > | ||
pip install git+https://github.com/OpenCyphal/[email protected] | ||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/differential_pressure_sensor/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/differential_pressure_sensor | ||
|
||
|
@@ -85,10 +76,6 @@ jobs: | |
with: | ||
submodules: recursive | ||
|
||
- name: get nunavut | ||
run: > | ||
pip install git+https://github.com/OpenCyphal/[email protected] | ||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/udral_servo/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/udral_servo | ||
|
||
|
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 |
---|---|---|
|
@@ -3,10 +3,10 @@ | |
# Author: Pavel Kirienko <[email protected]> | ||
|
||
cmake_minimum_required(VERSION 3.17) | ||
project(differential_pressure_sensor C CXX) | ||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") | ||
project(differential_pressure_sensor C) | ||
|
||
set(submodules "${CMAKE_SOURCE_DIR}/../submodules") | ||
set(submodules "${CMAKE_CURRENT_SOURCE_DIR}/../submodules") | ||
set(CMAKE_PREFIX_PATH "${submodules}/nunavut") | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -pedantic -fstrict-aliasing") | ||
|
@@ -17,7 +17,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-conversion -Wcast-align -Wmissing-dec | |
# Forward the revision information to the compiler so that we could expose it at runtime. This is entirely optional. | ||
execute_process( | ||
COMMAND git rev-parse --short=16 HEAD | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE vcs_revision_id | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
@@ -29,39 +29,32 @@ add_definitions( | |
-DNODE_NAME="org.opencyphal.demos.differential_pressure" | ||
) | ||
|
||
# Transpile DSDL into C using Nunavut. Install Nunavut as follows: pip install nunavut. | ||
# Alternatively, you can invoke the transpiler manually or use https://nunaweb.opencyphal.org. | ||
find_package(nnvg REQUIRED) | ||
create_dsdl_target( # Generate the support library for generated C headers, which is "nunavut.h". | ||
"nunavut_support" | ||
c | ||
${CMAKE_BINARY_DIR}/transpiled | ||
"" | ||
OFF | ||
little | ||
"only" | ||
## Transpile DSDL into C using Nunavut. This uses this repo's built-in submodules to setup Nunavut. See | ||
# CMAKE_PREFIX_PATH above for how this is resolved to the local submodules. | ||
find_package(Nunavut 3.0 REQUIRED) | ||
|
||
set(LOCAL_PUBLIC_TYPES | ||
uavcan/node/430.GetInfo.1.0.dsdl | ||
uavcan/node/435.ExecuteCommand.1.1.dsdl | ||
uavcan/node/7509.Heartbeat.1.0.dsdl | ||
uavcan/node/port/7510.List.0.1.dsdl | ||
uavcan/pnp/8165.NodeIDAllocationData.2.0.dsdl | ||
uavcan/register/384.Access.1.0.dsdl | ||
uavcan/register/385.List.1.0.dsdl | ||
uavcan/si/unit/pressure/Scalar.1.0.dsdl | ||
uavcan/si/unit/temperature/Scalar.1.0.dsdl | ||
) | ||
set(dsdl_root_namespace_dirs # List all DSDL root namespaces to transpile here. | ||
${submodules}/public_regulated_data_types/uavcan | ||
${submodules}/public_regulated_data_types/reg | ||
|
||
add_cyphal_library( | ||
NAME dsdl_uavcan | ||
EXACT_NAME | ||
LANGUAGE c | ||
LANGUAGE_STANDARD c${CMAKE_C_STANDARD} | ||
DSDL_FILES ${LOCAL_PUBLIC_TYPES} | ||
SERIALIZATION_ASSERT assert | ||
EXPORT_MANIFEST | ||
OUT_LIBRARY_TARGET LOCAL_TYPES_C_LIBRARY | ||
) | ||
foreach (ns_dir ${dsdl_root_namespace_dirs}) | ||
get_filename_component(ns ${ns_dir} NAME) | ||
message(STATUS "DSDL namespace ${ns} at ${ns_dir}") | ||
create_dsdl_target( | ||
"dsdl_${ns}" # CMake target name | ||
c # Target language to transpile into | ||
${CMAKE_BINARY_DIR}/transpiled # Destination directory (add it to the includes) | ||
${ns_dir} # Source directory | ||
OFF # Disable variable array capacity override | ||
little # Endianness of the target platform (alternatives: "big", "any") | ||
"never" # Support files are generated once in the nunavut_support target (above) | ||
${dsdl_root_namespace_dirs} # Look-up DSDL namespaces | ||
) | ||
add_dependencies("dsdl_${ns}" nunavut_support) | ||
endforeach () | ||
include_directories(SYSTEM ${CMAKE_BINARY_DIR}/transpiled) # Make the transpiled headers available for inclusion. | ||
add_definitions(-DNUNAVUT_ASSERT=assert) | ||
|
||
# Build libcanard. | ||
add_library(canard STATIC ${submodules}/libcanard/libcanard/canard.c) | ||
|
@@ -71,12 +64,21 @@ include_directories(SYSTEM ${submodules}/libcanard/libcanard) | |
add_library(o1heap STATIC ${submodules}/o1heap/o1heap/o1heap.c) | ||
include_directories(SYSTEM ${submodules}/o1heap/o1heap/) | ||
|
||
include(${CMAKE_SOURCE_DIR}/../shared/register/register.cmake) | ||
include(${CMAKE_SOURCE_DIR}/../shared/socketcan/socketcan.cmake) | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/../shared/register/register.cmake) | ||
target_link_libraries(shared_register | ||
PRIVATE ${LOCAL_TYPES_C_LIBRARY} | ||
) | ||
|
||
include(${CMAKE_CURRENT_SOURCE_DIR}/../shared/socketcan/socketcan.cmake) | ||
|
||
# Build the application. | ||
add_executable(differential_pressure_sensor | ||
src/main.c | ||
) | ||
add_dependencies(differential_pressure_sensor dsdl_uavcan dsdl_reg) | ||
target_link_libraries(differential_pressure_sensor canard o1heap shared_register shared_socketcan) | ||
target_link_libraries(differential_pressure_sensor | ||
${LOCAL_TYPES_C_LIBRARY} | ||
canard | ||
o1heap | ||
shared_register | ||
shared_socketcan | ||
) |
113 changes: 0 additions & 113 deletions
113
differential_pressure_sensor/cmake/modules/Findnnvg.cmake
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.