fix(build): check submodules once per configure, never reset changes

Every px4_add_git_submodule call ran check_submodules.sh twice, at
configure and build time, and with CI=true force-updated each submodule
every time, a 2017 workaround for an interactive prompt that is gone.
VS Code and CLion force-updated too, resetting submodule changes under
development.

The check now runs once per configure. A missing submodule is fetched;
one at another commit is kept as it is, with a warning locally and an
error in CI.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche committed 2026-09-28 11:50:38 -07:00
1 parent b8d4f0b637
commit 14cf29bb31
6 files changed
+197 -85

No files matched your search

+21
View File
@@ -170,6 +170,27 @@ You can also list all configuration targets using the command:
make list_config_targets
```
## Submodules
PX4 pulls a number of libraries (NuttX, MAVLink, and others) in as git submodules.
Each build checks them once when it configures:
| Submodule state | Local build | CI (`CI=true`) |
| --------------------------------------- | ------------------------- | -------------------- |
| At the commit PX4 records | Builds | Builds |
| Missing | Fetched, then builds | Fetched, then builds |
| At another commit (e.g. you changed it) | Warns, builds it as it is | Fails |
A submodule at another commit is never reset, so you can develop and test changes to a submodule (for example a NuttX upgrade) in place.
The build warns about it every time, and you are responsible for keeping it in the state you want.
To check out the commits PX4 records (for example after switching branches), run:
```sh
git submodule sync --recursive && git submodule update --init --recursive
```
Set `GIT_SUBMODULES_ARE_EVIL=1` to skip the check entirely and manage submodules yourself.
## Compiling in a Graphical IDE
[VSCode](../dev_setup/vscode.md) is the officially supported (and recommended) IDE for PX4 development.