-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add native Windows build of meshtasticd #11031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d8734e4
Add native Windows build of meshtasticd
caveman99 52bc459
Merge branch 'develop' into windows-support
thebentern 5e719da
Fix false-green Windows CI build
caveman99 517c6c9
Allowlist ucrtbase.dll in Windows self-contained check
caveman99 9428899
Drop workflow_dispatch from Windows build workflow
caveman99 db0382e
Merge branch 'develop' into windows-support
caveman99 1452145
Shorten comments in the Windows build changes
caveman99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| name: Build Windows Binary | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| windows_ver: | ||
| required: false | ||
| default: "2025" | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build-Windows: | ||
| runs-on: windows-${{ inputs.windows_ver }} | ||
| defaults: | ||
| run: | ||
| # UCRT64 is the MinGW-w64 environment native-windows targets; the `msys` | ||
| # environment would link msys-2.0.dll and produce a Cygwin-style binary. | ||
| shell: msys2 {0} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| submodules: recursive | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| # Keep the token out of .git/config so later steps and artifacts can't leak it. | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup MSYS2 / UCRT64 | ||
| id: msys2 | ||
| uses: msys2/setup-msys2@v2 | ||
| with: | ||
| msystem: UCRT64 | ||
| update: true | ||
| # argp is not packaged for the mingw environments and is built below. | ||
| # Python is omitted too: MSYS2's reports a `mingw` platform tag no wheel matches. | ||
| install: >- | ||
| mingw-w64-ucrt-x86_64-gcc | ||
| mingw-w64-ucrt-x86_64-pkgconf | ||
| mingw-w64-ucrt-x86_64-yaml-cpp | ||
| mingw-w64-ucrt-x86_64-libuv | ||
| mingw-w64-ucrt-x86_64-jsoncpp | ||
| mingw-w64-ucrt-x86_64-openssl | ||
| mingw-w64-ucrt-x86_64-libusb | ||
| mingw-w64-ucrt-x86_64-cmake | ||
| mingw-w64-ucrt-x86_64-ninja | ||
| git | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.13" | ||
|
|
||
| # framework-portduino calls argp_parse(); MSYS2 packages argp only for the | ||
| # msys runtime, which cannot link into a native binary. No install() rules. | ||
| - name: Build and install argp-standalone | ||
| run: | | ||
| git clone --depth 1 https://github.com/tom42/argp-standalone /tmp/argp | ||
| cd /tmp/argp | ||
| cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release . | ||
| cmake --build build | ||
| cp include/argp-standalone/argp.h /ucrt64/include/argp.h | ||
| cp build/src/libargp-standalone.a /ucrt64/lib/libargp.a | ||
|
|
||
| - name: Install PlatformIO | ||
| shell: pwsh | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install platformio | ||
|
|
||
| - name: Get release version string | ||
| shell: pwsh | ||
| id: version | ||
| run: echo "long=$(python ./bin/buildinfo.py long)" >> $env:GITHUB_OUTPUT | ||
|
|
||
| # Runs outside the MSYS2 shell so PlatformIO stays on the runner's | ||
| # CPython; the UCRT64 toolchain is reached through PATH instead. | ||
| - name: Build for Windows | ||
| shell: pwsh | ||
| run: | | ||
| $env:PATH = "${{ steps.msys2.outputs.msys2-location }}\ucrt64\bin;$env:PATH" | ||
| platformio run -e native-windows | ||
| env: | ||
| PKG_VERSION: ${{ steps.version.outputs.long }} | ||
|
|
||
| - name: List output files | ||
| run: ls -lah .pio/build/native-windows/ | ||
|
|
||
| # The env links statically, so only Windows system DLLs should appear here. | ||
| # A third-party DLL means the static link regressed. | ||
| - name: Verify the binary is self-contained | ||
| run: | | ||
| set -euo pipefail | ||
| bin=.pio/build/native-windows/meshtasticd.exe | ||
| test -f "$bin" | ||
| # `|| true` keeps grep's no-match exit out of `set -e`; an empty import | ||
| # table is caught by the test below instead of passing as "no deps". | ||
| deps=$(objdump -p "$bin" | grep -i 'DLL Name' || true) | ||
| test -n "$deps" | ||
| extra=$(printf '%s\n' "$deps" \ | ||
| | grep -viE 'api-ms-win|KERNEL32|WS2_32|ADVAPI32|USER32|msvcrt|ucrtbase|bcrypt|IPHLPAPI|SHELL32|ole32|CRYPT32|SETUPAPI|CFGMGR32|WINMM|dbghelp' || true) | ||
| if [ -n "$extra" ]; then | ||
| printf '%s\n' "$extra" | ||
| echo "::error::meshtasticd.exe has non-system DLL dependencies (static link regressed)" | ||
| exit 1 | ||
| fi | ||
| echo "OK: no third-party DLL dependencies" | ||
|
|
||
| - name: Smoke test the binary | ||
| run: | | ||
| .pio/build/native-windows/meshtasticd.exe --version | ||
|
|
||
| - name: Store binaries as an artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: firmware-windows-${{ inputs.windows_ver }}-${{ steps.version.outputs.long }} | ||
| overwrite: true | ||
| path: | | ||
| .pio/build/native-windows/meshtasticd.exe | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env python3 | ||
| # trunk-ignore-all(ruff/F821) | ||
| # trunk-ignore-all(flake8/F821): For SConstruct imports | ||
| # | ||
| # PlatformIO routes build_flags to the compile step only, so the static link | ||
| # flags are appended here, as wasm_link_flags.py does for [env:native-wasm]. | ||
| Import("env") | ||
|
|
||
| if env["PIOENV"].startswith("native-windows"): | ||
| env.Append( | ||
| LINKFLAGS=[ | ||
| "-static", | ||
| "-static-libgcc", | ||
| "-static-libstdc++", | ||
| ] | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.