Skip to content

Improve SDL2 bundling and add SDL3 support for macOS#7549

Open
Tozapid wants to merge 6 commits into
EdgeTX:mainfrom
Tozapid:main
Open

Improve SDL2 bundling and add SDL3 support for macOS#7549
Tozapid wants to merge 6 commits into
EdgeTX:mainfrom
Tozapid:main

Conversation

@Tozapid

@Tozapid Tozapid commented Jul 13, 2026

Copy link
Copy Markdown

Summary of changes:

I ran into some issues building EdgeTX Companion for macOS Tahoe, so I updated the documentation a bit. Now the build works if you simply follow the instructions.
I also added a section on building the .dmg package.

Summary by CodeRabbit

  • Bug Fixes

    • Improved macOS Companion app packaging to correctly bundle the required SDL2 dylib and, when available, the SDL3 dylib into the app’s Frameworks folder, using accurate resolved library paths and updating their runtime install IDs.
  • Documentation

    • Refreshed macOS build instructions for Sequoia/Tahoe with more explicit Terminal steps, clearer Homebrew/toolchain guidance (including Apple Silicon vs Intel), updated uv-based Python setup, and reworked build and DMG packaging workflow details.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 98d9495f-c05e-4cbd-be10-1e4aa449bddd

📥 Commits

Reviewing files that changed from the base of the PR and between 891dc20 and 6186df5.

📒 Files selected for processing (1)
  • docs/building/macos-sequoia.md

📝 Walkthrough

Walkthrough

The macOS Companion packaging now bundles SDL2 and optionally SDL3 with corrected embedded paths. The macOS build guide updates Homebrew, toolchain, SDL, Python environment, CMake configuration, build, runtime, and packaging instructions.

Changes

MacOS Build Support

Layer / File(s) Summary
SDL framework bundling
companion/src/CMakeLists.txt
SDL2 is resolved and installed explicitly, SDL3 is discovered and bundled when available, and install_name_tool updates embedded library identifiers.
macOS toolchain and environment
docs/building/macos-sequoia.md
Homebrew, architecture-specific toolchain links, SDL requirements, and uv virtual-environment setup are revised.
CMake build and packaging workflow
docs/building/macos-sequoia.md
CMake configuration, firmware and Companion builds, runtime setup, native .dmg packaging instructions, and related terminal formatting are updated.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CMake
  participant SDL2SDL3
  participant Frameworks
  participant InstallNameTool
  CMake->>SDL2SDL3: Resolve imported targets or dylib paths
  SDL2SDL3->>Frameworks: Install SDL2 and optional SDL3 dylibs
  CMake->>InstallNameTool: Rewrite packaged dylib identifiers
  InstallNameTool->>Frameworks: Update SDL2 and SDL3 -id values
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: macOS SDL2 bundling improvements and SDL3 support.
Description check ✅ Passed The description includes the required summary section and gives a reasonable overview of the doc and build updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
companion/src/CMakeLists.txt (1)

597-610: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Brew-prefix candidate path is structurally wrong due to REALPATH symlink resolution.

_sdl2_real was resolved via REALPATH (line 582), which follows Homebrew's opt/<pkg> symlink into the underlying Cellar/<pkg>/<version> directory. Walking up three directories from that resolved path (lines 598-600) lands on Cellar/sdl2, not the actual Homebrew prefix (e.g. /opt/homebrew). The resulting candidate ${_brew_prefix}/sdl3/lib/libSDL3.0.dylib will therefore never exist, and only the two hardcoded fallback paths (which assume default Homebrew locations) can ever succeed — meaning custom Homebrew --prefix installs get no working candidate at all. Combined with the target-name casing bug above, SDL3 discovery here is effectively 100% reliant on the two hardcoded, version-suffix-pinned fallback strings.

Consider using find_library() with Homebrew's actual prefix (e.g. via execute_process(COMMAND brew --prefix sdl3 ...) or HINTS ENV HOMEBREW_PREFIX) instead of manually reconstructing paths from a resolved symlink target.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@companion/src/CMakeLists.txt` around lines 597 - 610, Fix SDL3 discovery in
the NOT _sdl3_real branch without deriving the Homebrew prefix from the
REALPATH-resolved _sdl2_real path. Use find_library() with a Homebrew prefix
obtained from brew --prefix sdl3 or an equivalent HOMEBREW_PREFIX hint, while
preserving the existing fallback candidates and assigning the resolved result to
_sdl3_real.
docs/building/macos-sequoia.md (1)

7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add language identifiers to fenced code blocks.

markdownlint (MD040) flags these shell code fences as missing a language tag.

📝 Proposed fix
-```
+```bash
 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(apply the same `bash` tag to the fences at lines 43, 73, 82, 88, and 94)
</details>






Also applies to: 43-43, 73-73, 82-82, 88-88, 94-94

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @docs/building/macos-sequoia.md at line 7, Update every shell command fenced
code block in macos-sequoia.md, including the blocks near the Homebrew command
and the referenced sections, to use the bash language identifier. Ensure no
affected fenced block remains untagged so markdownlint MD040 passes.


</details>

<!-- cr-comment:v1:23cd07e4e817d3047a7adbc0 -->

_Source: Linters/SAST tools_

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @companion/src/CMakeLists.txt:

  • Around line 591-596: Update the target check in the SDL3 library-location
    resolution block to use the exported target name SDL3::SDL3-shared instead of
    SDL3::SDL3-Shared, while preserving the existing IMPORTED_LOCATION and REALPATH
    handling.
  • Around line 620-626: Update the install(CODE) block in
    companion/src/CMakeLists.txt to capture RESULT_VARIABLE and ERROR_VARIABLE for
    each install_name_tool execute_process call, then fail the installation with the
    captured error when either command fails. Apply the same handling to the
    conditional libSDL3.dylib call while preserving the existing install-name
    arguments and component.

Nitpick comments:
In @companion/src/CMakeLists.txt:

  • Around line 597-610: Fix SDL3 discovery in the NOT _sdl3_real branch without
    deriving the Homebrew prefix from the REALPATH-resolved _sdl2_real path. Use
    find_library() with a Homebrew prefix obtained from brew --prefix sdl3 or an
    equivalent HOMEBREW_PREFIX hint, while preserving the existing fallback
    candidates and assigning the resolved result to _sdl3_real.

In @docs/building/macos-sequoia.md:

  • Line 7: Update every shell command fenced code block in macos-sequoia.md,
    including the blocks near the Homebrew command and the referenced sections, to
    use the bash language identifier. Ensure no affected fenced block remains
    untagged so markdownlint MD040 passes.

</details>

<details>
<summary>🪄 Autofix (Beta)</summary>

Fix all unresolved CodeRabbit comments on this PR:

- [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)
- [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: Organization UI

**Review profile**: CHILL

**Plan**: Pro Plus

**Run ID**: `61bb11b5-a644-4808-bbf1-68c18d314fd3`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between f3cabd42f7cd05044fd7af09a36a2aa9c5bb39c8 and b27b32ce7ac4c2d14006db220cb92f8bced2c747.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `companion/src/CMakeLists.txt`
* `docs/building/macos-sequoia.md`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment thread companion/src/CMakeLists.txt Outdated
Comment thread companion/src/CMakeLists.txt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
docs/building/macos-sequoia.md (1)

122-122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add language identifiers to new fenced code blocks.

markdownlint flags MD040 on all five newly added code blocks (lines 122, 138, 145, 153, 163) since none specify a language.

📝 Proposed fix
- ```
+ ```bash
  source ../.venv/bin/activate

(apply the same bash tag to the fences at lines 138, 145, 153, and 163)

Also applies to: 138-138, 145-145, 153-153, 163-163

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/building/macos-sequoia.md` at line 122, Add the bash language identifier
to each of the five newly added fenced code blocks in the macOS Sequoia build
instructions, including the blocks around the commands at lines 122, 138, 145,
153, and 163, while leaving their command contents unchanged.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/building/macos-sequoia.md`:
- Line 122: Add the bash language identifier to each of the five newly added
fenced code blocks in the macOS Sequoia build instructions, including the blocks
around the commands at lines 122, 138, 145, 153, and 163, while leaving their
command contents unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99f8c5de-57b0-4bc7-9b1d-9df772dc45a4

📥 Commits

Reviewing files that changed from the base of the PR and between 7b0d789 and 891dc20.

📒 Files selected for processing (2)
  • companion/src/CMakeLists.txt
  • docs/building/macos-sequoia.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • companion/src/CMakeLists.txt

@Tozapid Tozapid left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope I fixed everything the bots pointed out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants