Skip to content

Commit

Permalink
Add restored mavlink contents as static library
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjAA committed Jun 11, 2024
1 parent 0a35838 commit a131ec3
Show file tree
Hide file tree
Showing 302 changed files with 91,474 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/modules/mavlink/mavlink/.github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: false
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
122 changes: 122 additions & 0 deletions src/modules/mavlink/mavlink/.github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Test and deploy

on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'

# paths:
# - "*"
# - "!README.md" <-- don't rebuild on doc change

permissions:
contents: read

jobs:
format:
name: Formatting check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: |
sudo apt update
sudo apt install -y libxml2-dev libxml2-utils
- name: Check formatting
run: |
./scripts/test.sh format
python-tests:
name: Python ${{ matrix.python-version }} tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install future lxml
- name : Test Python generator
run: |
./scripts/test.sh py
build-cmake-c-example:
name: Build cmake C example
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y python3 python3-pip
- name: Install MAVLink headers
run: |
cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=install
cmake --build build --target install
- name: Build example
run: |
cd examples/c
cmake -Bbuild -H. -DCMAKE_PREFIX_PATH=$(pwd)/../../install
cmake --build build
node-tests:
name: Node ${{ matrix.node-version }} test
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
node-version: ['12', '14'] # 15 fails for some weird reason
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install future lxml
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name : Test mavlink
run: |
./scripts/test.sh node
deploy:
name: Generate and push C headers
needs: [format, python-tests, node-tests]
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master'
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install future lxml
- name: Run deploy script
run: |
./scripts/update_generated_repos.sh
32 changes: 32 additions & 0 deletions src/modules/mavlink/mavlink/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*~
tags
doc/html
doc/messages
doc/*.log
.DS_Store
build*
install*
.nfs*
share/
__pycache__
pymavlink/generator/C/
pymavlink/generator/C/
pymavlink/generator/python/
pymavlink/generator/python/
apidocs/
pymavlink/generator/message_definitions
*.swp
pymavlink/dialects/
pymavlink/MANIFEST
pymavlink/dist
pymavlink.egg-info/
.pydevproject
.project
.ropeproject
*.cproject
include/
.tags*
*.pyc
include/mavlink/v1.0
.idea
/.vscode
3 changes: 3 additions & 0 deletions src/modules/mavlink/mavlink/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pymavlink"]
path = pymavlink
url = https://github.com/ardupilot/pymavlink.git
87 changes: 87 additions & 0 deletions src/modules/mavlink/mavlink/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.13)

project(mavlink)

find_package(Python COMPONENTS Interpreter REQUIRED)

# We automatically install the pip dependencies locally below.
# Therefore, we check whether pip is available here.
execute_process(
COMMAND ${Python_EXECUTABLE} -m pip -V
RESULT_VARIABLE EXIT_CODE
OUTPUT_QUIET
)
if (NOT ${EXIT_CODE} EQUAL 0)
message(FATAL_ERROR "Python pip not found, pip is required")
endif()

if (NOT MAVLINK_DIALECT)
set(MAVLINK_DIALECT common)
endif()
message(STATUS "MAVLink dialect: ${MAVLINK_DIALECT}")

if (NOT MAVLINK_VERSION)
set(MAVLINK_VERSION 2.0)
endif()
message(STATUS "MAVLink version: ${MAVLINK_VERSION}")

set(EXAMPLE_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/mavlink/${MAVLINK_DIALECT}/mavlink.h)

add_custom_command(OUTPUT ${EXAMPLE_HEADER}
COMMAND ${Python_EXECUTABLE}
-m pip install -r pymavlink/requirements.txt --upgrade -t ${CMAKE_CURRENT_BINARY_DIR}/pip-dependencies/
COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/pip-dependencies/" ${Python_EXECUTABLE}
-m pymavlink.tools.mavgen
--lang=C
--wire-protocol=${MAVLINK_VERSION}
--output ${CMAKE_CURRENT_BINARY_DIR}/include/mavlink/
message_definitions/v1.0/${MAVLINK_DIALECT}.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS message_definitions/v1.0/${MAVLINK_DIALECT}.xml
COMMENT "Generating C headers")

# Unfortunately, the dependencies don't work for INTERFACE libraries.
# The only way I could make it work is to add ALL which means it
# will do the file generation every time even when nothing has changed.
add_custom_target(generate_c_headers
ALL
DEPENDS ${EXAMPLE_HEADER})

add_library(mavlink INTERFACE)

add_dependencies(mavlink generate_c_headers)

include(GNUInstallDirs)

target_include_directories(mavlink
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

install(TARGETS mavlink
EXPORT MAVLinkTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/mavlink"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING PATTERN "*.h"
)

install(EXPORT MAVLinkTargets
FILE MAVLinkTargets.cmake
NAMESPACE MAVLink::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MAVLink
)

# For the build tree
configure_file(MAVLinkConfig.cmake.in
"${PROJECT_BINARY_DIR}/MAVLinkConfig.cmake" @ONLY)
# For the install tree
configure_file(MAVLinkConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/MAVLinkConfig.cmake" @ONLY)

install(FILES
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/MAVLinkConfig.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MAVLink
)
3 changes: 3 additions & 0 deletions src/modules/mavlink/mavlink/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing to MAVLink

See [Contributing](https://mavlink.io/en/contributing/contributing.html) (MAVLink Developer Guide).
Loading

0 comments on commit a131ec3

Please sign in to comment.