-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from 107-systems/fix-176
Support compilation for x86 as a static library using CMake.
- Loading branch information
Showing
46 changed files
with
1,252 additions
and
205 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,28 @@ | ||
name: Build | ||
|
||
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
# Run every Tuesday at 8 AM UTC | ||
- cron: "0 8 * * TUE" | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
smoke-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install CMake | ||
run: sudo apt-get install cmake | ||
|
||
- name: Create build directory, run CMake and Make | ||
run: mkdir build && cd build && cmake -DBUILD_EXAMPLES=ON .. && make |
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,2 +1,4 @@ | ||
.vscode/ | ||
.idea/ | ||
build/ | ||
cmake-build-debug/ |
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,33 @@ | ||
########################################################################## | ||
cmake_minimum_required(VERSION 3.15) | ||
########################################################################## | ||
project("cyphal++") | ||
########################################################################## | ||
set(CMAKE_VERBOSE_MAKEFILE OFF) | ||
########################################################################## | ||
option(BUILD_EXAMPLES "Build all examples provided with this library" OFF) | ||
########################################################################## | ||
add_subdirectory(src/libcanard) | ||
add_subdirectory(src/libo1heap) | ||
add_subdirectory(extras/cyphal++/libsocketcan) | ||
########################################################################## | ||
add_library(${PROJECT_NAME} STATIC | ||
src/nodeinfo/NodeInfo.cpp | ||
src/register/util/ListResponse.cpp | ||
src/register/RegisterBase.cpp | ||
src/register/RegisterList.cpp | ||
src/Node.cpp | ||
) | ||
########################################################################## | ||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror) | ||
endif() | ||
########################################################################## | ||
target_include_directories(${PROJECT_NAME} PUBLIC src extras/cyphal++/include) | ||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) | ||
target_link_libraries(${PROJECT_NAME} canard o1heap socketcan) | ||
########################################################################## | ||
if(BUILD_EXAMPLES) | ||
add_subdirectory(extras/cyphal++/examples/example-01-opencyphal-basic-node) | ||
endif() | ||
########################################################################## |
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
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
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
8 changes: 8 additions & 0 deletions
8
extras/cyphal++/examples/example-01-opencyphal-basic-node/CMakeLists.txt
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,8 @@ | ||
########################################################################## | ||
cmake_minimum_required(VERSION 3.15) | ||
########################################################################## | ||
set(EXAMPLE_01_TARGET example-01-basic-cyphal-node) | ||
########################################################################## | ||
add_executable(${EXAMPLE_01_TARGET} example-01-opencyphal-basic-node.cpp) | ||
target_link_libraries(${EXAMPLE_01_TARGET} cyphal++ pthread) | ||
########################################################################## |
34 changes: 34 additions & 0 deletions
34
extras/cyphal++/examples/example-01-opencyphal-basic-node/README.md
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,34 @@ | ||
<a href="https://opencyphal.org/"><img align="right" src="https://raw.githubusercontent.com/107-systems/.github/main/logo/opencyphal.svg" width="25%"></a> | ||
:floppy_disk: `example-01-opencyphal-basic-node` | ||
================================================ | ||
* Setup a virtual CAN interface (`vcan0`) | ||
```bash | ||
sudo ./setup_vcan.sh | ||
``` | ||
You can observe the frames on the virtual CAN bus using `candump` | ||
```bash | ||
candump vcan0 | ||
``` | ||
* Install `yakut` | ||
```bash | ||
python3 -m pip install yakut | ||
``` | ||
* Compile OpenCyphal DSDL | ||
```bash | ||
yakut compile https://github.com/OpenCyphal/public_regulated_data_types/archive/refs/heads/master.zip | ||
``` | ||
* Setup `yakut` | ||
```bash | ||
. setup_yakut.sh | ||
``` | ||
* Start `yakut` | ||
```bash | ||
yakut monitor | ||
``` | ||
* Use `yakut` | ||
|
||
Read the register list of the node. | ||
```bash | ||
yakut rl 42 | ||
[cyphal.node.description, cyphal.node.id, cyphal.pub.temperature.id, cyphal.pub.temperature.type] | ||
``` |
Oops, something went wrong.