diff --git a/.gitignore b/.gitignore index 5e3cbff..7564cd1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,15 @@ # Compiled Object files from SCons *.os -# Generated for current Godot +# Generated by tooling extension_api.json compile_commands.json # clangd cache .cache/ -# Generated MAVLink headers -/include/mavlink - -# Created by https://www.toptal.com/developers/gitignore/api/c++,godot,scons,python -# Edit at https://www.toptal.com/developers/gitignore?templates=c++,godot,scons,python +# Created by https://www.toptal.com/developers/gitignore/api/c++,godot,scons +# Edit at https://www.toptal.com/developers/gitignore?templates=c++,godot,scons ### C++ ### # Prerequisites @@ -65,177 +62,6 @@ export_presets.cfg data_*/ mono_crash.*.json -### Python ### -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ - -### Python Patch ### -# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration -poetry.toml - -# ruff -.ruff_cache/ - -# LSP config files -pyrightconfig.json - ### SCons ### # for projects that use SCons for building: http://http://www.scons.org/ .sconsign.dblite @@ -244,4 +70,4 @@ pyrightconfig.json config.log .sconf_temp -# End of https://www.toptal.com/developers/gitignore/api/c++,godot,scons,python +# End of https://www.toptal.com/developers/gitignore/api/c++,godot,scons diff --git a/.gitmodules b/.gitmodules index 223680a..29bd727 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "godot-cpp"] - path = modules/godot-cpp + path = godot-cpp url = https://github.com/godotengine/godot-cpp.git -[submodule "modules/mavlink"] - path = modules/mavlink - url = https://github.com/marsh-sim/mavlink.git diff --git a/README.md b/README.md index c10c2e8..92539c9 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,19 @@ Named in this order so not everything starts with the same word ## Development -This repository uses [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules), to get all the code you need to run either: - -```sh -git clone --recurse-submodules
-# Or at any later point -git submodule update --init --recursive -``` - -Using Godot v4.4.beta1.official [d33da79d3](https://github.com/godotengine/godot/commit/d33da79d3f8fe84be2521d25b9ba8e440cf25a88). +Using Godot v4.4.beta1.official [d33da79d3]. Install SCons with `pipx install scons`. -For updating MAVLink generator, you additionally `pip install future`. -It is recommended to install any packages in a [virtual environment](https://docs.python.org/3/library/venv.html), for example: + +To generate files for build tooling, run the following: ```sh -python3 -m venv venv -source venv/bin/activate -pip install future -``` - -Some files are generated, run the following commands on first setup and when dependencies change: - -```sh -godot --dump-extension-api # after updating Godot -scons compile_commands # after modifying SConstruct -python update_mavlink.py # after updating MAVLink dialect +godot --dump-extension-api +scons compile_commands ``` ### Build -To build the GDExtension binary run SCons in the repository root, the default arguments have been added to the file. +To build the extension run SCons in the repository root, the default arguments have been added to the file. ```sh scons diff --git a/SConstruct b/SConstruct index c6ca843..d526839 100644 --- a/SConstruct +++ b/SConstruct @@ -2,7 +2,7 @@ import os import sys -env = SConscript("modules/godot-cpp/SConstruct") +env = SConscript("godot-cpp/SConstruct") # For reference: # - CCFLAGS are compilation flags shared between C and C++ diff --git a/modules/godot-cpp b/godot-cpp similarity index 100% rename from modules/godot-cpp rename to godot-cpp diff --git a/modules/mavlink b/modules/mavlink deleted file mode 160000 index 153d474..0000000 --- a/modules/mavlink +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 153d474873a461f1554c2c34aaa864f818509eef diff --git a/update_mavlink.py b/update_mavlink.py deleted file mode 100644 index 3d96869..0000000 --- a/update_mavlink.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python3 - -""" -Generates required libraries based on the message definitions in mavlink submodule. -Doesn't accept any arguments by design. - -Requires future package, example of installation: -``` -pip install future -``` -""" - -from os import path, makedirs -from shutil import copytree -import sys - -# add repository root path to import local module regardless of location -root_path = path.abspath(path.dirname(__file__)) -sys.path.insert(1, root_path) -# fmt: off - don't move import to top of file -from modules.mavlink.pymavlink.generator import mavgen -from modules.mavlink.pymavlink.generator.mavparse import PROTOCOL_2_0 -# fmt: on - -definitions_path = path.join(root_path, 'modules', 'mavlink', - 'message_definitions', 'v1.0') -dialect_file = 'all.xml' -out_path = path.join(root_path, 'include', 'mavlink') - -# generate C library -opts = mavgen.Opts(out_path, wire_protocol=PROTOCOL_2_0, - language='C', validate=True, strict_units=True) -mavgen.mavgen(opts, [path.join(definitions_path, dialect_file)]) - -out_definitions_path = path.join(out_path, 'message_definitions') -print("Copying message definitions to", out_definitions_path) -makedirs(out_definitions_path, exist_ok=True) -copytree(definitions_path, out_definitions_path, dirs_exist_ok=True) - -# generate Python library -out_path = path.join(root_path, 'dist', 'all_marsh') -makedirs(path.dirname(out_path), exist_ok=True) -opts.output = out_path -opts.language = 'Python3' -mavgen.mavgen(opts, [path.join(definitions_path, dialect_file)])