Skip to content

Building from Source

Mikhail Deynekin edited this page Oct 16, 2026 · 1 revision

Building from Source

The repository builds two ways that CI exercises on every push — a static mingw-w64 cross-build from Linux/macOS and a native MSVC build on Windows — plus a native MinGW path. This page gives the exact commands, the gates the project enforces, and the verification steps this wiki used (including the Wine smoke matrix that produced its screenshots).


Contents


Option A: cross-compile from Linux/macOS

What CI runs; verified during this wiki's research on Debian 12 with mingw-w64 GCC 12.2:

sudo apt install g++-mingw-w64-x86-64 cmake make
./scripts/build.sh          # → dist/TrayIconGuard.exe (static, stripped)

scripts/build.sh configures CMake with cmake/mingw-w64-x86_64.cmake, builds, runs the manifest regression gate (well-formed XML, unique supportedOS GUIDs, required nodes), then prints the imported-DLL list for the dependency audit. Measured on the studied commit: zero warnings under -Wall -Wextra, executable 1,052,672 bytes, 16 imports — all Windows system DLLs.

Option B: native MinGW-w64 on Windows

cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
cmake --build build -j8
copy build\TrayIconGuard.exe dist\

Option C: MSVC (Visual Studio 2022)

cmake -S . -B build-msvc -G "Visual Studio 17 2022" -A x64
cmake --build build-msvc --config Release

The CMakeLists carries a real MSVC branch (/W4 /permissive- /O2 /Gy, and /MANIFEST:NO so the linker does not fight the manifest embedded by resources.rc); the code is compiler-agnostic C++17. Note that docs/BUILD.md still narrates the pre-fix situation where GNU-specific flags needed manual replacement — one of the stale-doc items listed in Changelog and Versioning.

Gates the project enforces

Gate Where Effect
Zero warnings (-Wall -Wextra) CI cross-build greps the build log any warning fails the run
DLL allow-list CI objdump -p filter any non-system import fails
Manifest regression scripts/build.sh python gate duplicate supportedOS / malformed XML fails
MSVC /W4 clean CI msvc-build compiler errors fail

Compile-time contract: UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX WINVER=0x0A00 _WIN32_WINNT=0x0A00 NTDDI_VERSION=0x0A000006; Win32 threads by design (mingw win32 thread model), so the source never includes <thread>/<mutex>.

Packaging

./scripts/package.sh   # → dist/TrayIconGuard-<VER>-win-x64.zip + dist/SHA256SUMS

Maintainer note: package.sh's VER literal is 8.3.0 at the studied commit while the feed announces 8.4.0 — part of the version-drift record; bump it together with version.h when publishing (Self-Updater Guide checklist).

Regenerating visual assets

python3 scripts/make_icon.py   # resources/icon.ico (16..256), icon_256/512.png, sheet

The .ico carries BMP-DIB entries for 16–128 px (maximum shell compatibility) and a PNG entry for 256 px; small sizes use the solid shield variant for tray legibility.

VS Code integration

Ctrl+Shift+B selects the per-OS build task (mingw cross on Linux, MinGW on Windows); F5 launches the GUI under cppvsdbg on Windows. Recommended extensions: ms-vscode.cpptools, ms-vscode.cmake-tools.

Smoke-testing without a Windows machine

The repository's QA hook renders any page and captures itself:

xvfb-run -a wine dist/TrayIconGuard.exe --ui-test dashboard   # → %TEMP%\tig-uitest-dashboard.png

This wiki's verification run executed the full matrix (seven pages) under Wine 8 + xvfb, plus the CLI battery and side-effect inspection (settings.json defaults, log format, autostart Run value). Expect glyph boxes instead of Segoe Fluent Icons glyphs in Wine — a font-availability artifact (Troubleshooting). For updater end-to-end tests, serve a loopback feed per Self-Updater Guide.


See also

Clone this wiki locally