Skip to content

Commit 09411e9

Browse files
authored
Restructure project to enable custom mavlink bindings generation (#223)
* Restructure project to enable custom mavlink bindings generation Split the project into three crates: * mavlink-core: core MAVLink types including TCP, UDP and serial connections * mavlink-bindgen: a library & CLI for generating Rust bindings for MAVLink dialects * mavlink: generated MAVLink bindings for the MAVLink dialects in the mavlink/mavlink repo * run GitHub checks * reformat * attempt to fix cross compile test * attempt to install cross * Downgrade clap to support MSRV 1.65.0 * Downgrade clap_lex to support MSRV 1.65.0 * Another downgrade * downgrade anstyle * Simplify support for MSRV 1.65.0 * Hopefully this works * fix embedded build * Fix build on MSRV * Make cli feature not default * Only build the mavlink package in tests. The mavlink-bindgen crate does not itself need to run on embedded hardware * Attempt to support no_std in mavlink again * Fix for the last GitHub action * Make the embedded example work in the cargo workspace * Remove unused import * Remove accidentally committed binary
1 parent be0bc1e commit 09411e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+555
-227
lines changed

.github/workflows/test.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ jobs:
5151
- uses: dtolnay/rust-toolchain@master
5252
with:
5353
toolchain: 1.65.0
54+
- uses: actions-rs/cargo@v1
55+
with:
56+
command: install
57+
args: cross --locked
5458
- uses: actions-rs/cargo@v1
5559
with:
5660
use-cross: true
@@ -103,7 +107,7 @@ jobs:
103107
with:
104108
use-cross: true
105109
command: build
106-
args: --verbose --release --target=${{ matrix.TARGET }} ${{ matrix.FLAGS }}
110+
args: --verbose --release --package=mavlink --target=${{ matrix.TARGET }} ${{ matrix.FLAGS }}
107111

108112
test-embedded-size:
109113
needs: build
@@ -114,7 +118,7 @@ jobs:
114118
with:
115119
target: thumbv7em-none-eabihf
116120
- name: Build
117-
run: cargo +nightly build --target thumbv7em-none-eabihf --manifest-path examples/embedded/Cargo.toml --out-dir $PWD --release -Z unstable-options
121+
run: cargo +nightly build --target thumbv7em-none-eabihf --manifest-path mavlink/examples/embedded/Cargo.toml --out-dir $PWD --release -Z unstable-options
118122

119123
docs:
120124
needs: internal-tests

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "mavlink"]
2-
path = mavlink
1+
[submodule "mavlink/mavlink"]
2+
path = mavlink/mavlink
33
url = https://github.com/mavlink/mavlink

.idea/workspace.xml

+128
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-99
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,10 @@
1+
[workspace]
2+
members = ["mavlink", "mavlink-bindgen", "mavlink-core"]
3+
resolver = "1"
14

2-
[package]
3-
name = "mavlink"
4-
version = "0.12.2"
5-
authors = ["Todd Stellanova", "Michal Podhradsky", "Kevin Mehall", "Tim Ryan", "Patrick José Pereira", "Ibiyemi Abiodun"]
6-
build = "build/main.rs"
7-
description = "Implements the MAVLink data interchange format for UAVs."
8-
readme = "README.md"
9-
license = "MIT/Apache-2.0"
10-
repository = "https://github.com/mavlink/rust-mavlink"
11-
edition = "2018"
12-
rust-version = "1.65.0"
13-
14-
[build-dependencies]
15-
crc-any = { version = "2.3.0", default-features = false }
16-
quick-xml = "0.26"
17-
quote = "1"
18-
proc-macro2 = "1.0.43"
19-
lazy_static = "1.2.0"
20-
serde = { version = "1.0.115", optional = true, features = ["derive"] }
21-
22-
[[example]]
23-
name = "mavlink-dump"
24-
path = "examples/mavlink-dump/src/main.rs"
25-
required-features = ["ardupilotmega"]
26-
27-
[dependencies]
5+
[workspace.dependencies]
286
crc-any = { version = "2.3.5", default-features = false }
297
num-traits = { version = "0.2", default-features = false }
308
num-derive = "0.3.2"
319
bitflags = "1.2.1"
32-
serial = { version = "0.4", optional = true }
33-
serde = { version = "1.0.115", optional = true, features = ["derive"] }
3410
byteorder = { version = "1.3.4", default-features = false }
35-
embedded-hal = { version = "0.2", optional = true }
36-
nb = { version = "1.0", optional = true }
37-
serde_arrays = { version = "0.1.0", optional = true }
38-
39-
[features]
40-
"all" = [
41-
"ardupilotmega",
42-
"asluav",
43-
"common",
44-
"development",
45-
"icarous",
46-
"minimal",
47-
"python_array_test",
48-
"standard",
49-
"test",
50-
"ualberta",
51-
"uavionix",
52-
"avssuas",
53-
"cubepilot",
54-
]
55-
"ardupilotmega" = ["common", "icarous", "uavionix"]
56-
"asluav" = ["common"]
57-
"avssuas" = ["common"]
58-
"development" = ["common"]
59-
"matrixpilot" = ["common"]
60-
"minimal" = []
61-
"paparazzi" = ["common"]
62-
"python_array_test" = ["common"]
63-
"slugs" = ["common"]
64-
"standard" = ["common"]
65-
"test" = []
66-
"ualberta" = ["common"]
67-
"uavionix" = ["common"]
68-
"icarous" = []
69-
"common" = []
70-
"cubepilot" = ["common"]
71-
72-
"all-dialects" = [
73-
"ardupilotmega",
74-
"asluav",
75-
"avssuas",
76-
"development",
77-
"matrixpilot",
78-
"minimal",
79-
"paparazzi",
80-
"python_array_test",
81-
"slugs",
82-
"standard",
83-
"test",
84-
"ualberta",
85-
"uavionix",
86-
"icarous",
87-
"common",
88-
"cubepilot",
89-
]
90-
91-
"format-generated-code" = []
92-
"emit-description" = []
93-
"emit-extensions" = []
94-
"std" = ["byteorder/std"]
95-
"udp" = []
96-
"tcp" = []
97-
"direct-serial" = []
98-
"embedded" = ["embedded-hal", "nb"]
99-
"serde" = ["dep:serde", "dep:serde_arrays"]
100-
default = ["std", "tcp", "udp", "direct-serial", "serial", "serde", "ardupilotmega"]
101-
102-
# build with all features on docs.rs so that users viewing documentation
103-
# can see everything
104-
[package.metadata.docs.rs]
105-
features = ["default", "all-dialects", "emit-description", "emit-extensions", "format-generated-code"]

build/main.rs

-101
This file was deleted.

0 commit comments

Comments
 (0)