Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libboost-dev lcov

- name: Build
run: make build

- name: Test
run: make test

- name: Generate coverage report
run: make coverage

- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: build/coverage/
retention-days: 30
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set(dependencies Boost::boost spdlog::spdlog nlohmann_json::nlohmann_json)
#
project(motion_control)

enable_testing()
find_package(Boost REQUIRED)

add_executable(motion_control src/main.cpp)
Expand Down
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Motion Control Makefile
# Wraps CMake build system for convenience

BUILD_DIR := build
CMAKE := cmake
CTEST := ctest

.PHONY: all build test coverage clean rebuild

all: build

# Configure and build with CMake
build:
@mkdir -p $(BUILD_DIR)
$(CMAKE) -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage"
$(CMAKE) --build $(BUILD_DIR) --parallel

# Run unit tests
test: build
cd $(BUILD_DIR) && $(CTEST) --output-on-failure

# Generate coverage report (requires lcov/gcov)
coverage: test
@mkdir -p $(BUILD_DIR)/coverage
lcov --capture --directory $(BUILD_DIR) --output-file $(BUILD_DIR)/coverage/coverage.info --ignore-errors mismatch,empty || true
lcov --remove $(BUILD_DIR)/coverage/coverage.info '/usr/*' '*/test/*' '*/_deps/*' --output-file $(BUILD_DIR)/coverage/coverage.info --ignore-errors unused,empty || true
genhtml $(BUILD_DIR)/coverage/coverage.info --output-directory $(BUILD_DIR)/coverage/html --ignore-errors empty || true
@echo "Coverage report: $(BUILD_DIR)/coverage/html/index.html"

# Clean build artifacts
clean:
rm -rf $(BUILD_DIR)

# Full rebuild
rebuild: clean build
55 changes: 44 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,49 @@
High level network library
===
# Motion Control

skeleton project to send udp packets
A cross-platform C++ UDP networking library for motion control applications. Built on Boost.Asio, it provides asynchronous packet transmission for real-time motion data streaming to simulators and control systems.

future consideration: implement protocol
## Quick Start

build instructions
---
```bash
make build # Configure and build with CMake
make test # Run unit tests
make coverage # Generate coverage report
```

The header may be included in another program, and uses boost asio header only library to communicate with the network on multiple platforms. [Boost header project](https://github.com/jvishnefske/boost-headers) may be added in a subdirectory for easier dependency resolution.
## Features

python3 -m pip install meson ninja
meson setup build
cd build
ninja
- Asynchronous UDP client with configurable server endpoint
- Packet handler callbacks for incoming data
- Vector data transmission for motion coordinates
- Cross-platform support (Linux, Windows via MinGW)

## Dependencies

- C++17 compiler
- CMake 3.25+
- Boost (asio headers)
- GoogleTest (fetched automatically)
- Google Benchmark (fetched automatically)

## Build Options

### CMake (Recommended)

```bash
mkdir build && cd build
cmake ..
cmake --build .
```

### Meson (Alternative)

```bash
python3 -m pip install meson ninja
meson setup build
cd build
ninja
```

## License

See LICENSE file for details.
Loading
Loading