Windows: make the CMake build work with MSYS2's native toolchain
This commit is contained in:
@@ -41,6 +41,35 @@ cmake --build build-win-tui
|
||||
Copy `build-win-tui/cst-agent.exe`, `third_party/busybox/busybox.exe`, and
|
||||
`libwinpthread-1.dll` into one folder.
|
||||
|
||||
## Build natively on Windows (MSYS2)
|
||||
|
||||
The CMake build also works directly on Windows with MSYS2's mingw-w64
|
||||
toolchain -- no separate Linux host needed:
|
||||
|
||||
```bash
|
||||
# in an MSYS2 MINGW64 shell
|
||||
pacman -S --needed --noconfirm \
|
||||
mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-make \
|
||||
mingw-w64-x86_64-curl mingw-w64-x86_64-pdcurses
|
||||
|
||||
cd agent
|
||||
cmake -B build-win -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build-win --target cst-agent -j"$(nproc)"
|
||||
```
|
||||
|
||||
`CST_BUILD_TUI=ON` (the default) picks up MSYS2's PDCurses automatically,
|
||||
including its `include/pdcurses/` layout; set `-DPDCurses_ROOT=...` only for
|
||||
a custom PDCurses.
|
||||
|
||||
Two differences from the cross-build release layout above:
|
||||
|
||||
- **Extra DLLs.** MSYS2's curl package is the shared OpenSSL build, so the
|
||||
executable needs its whole dependency chain beside it. Collect it with
|
||||
`ldd build-win/cst-agent.exe | grep mingw64`.
|
||||
- **Only build the `cst-agent` target.** Some sources under `tests/` are
|
||||
POSIX-only (two-argument `mkdir`, `setenv`, `arpa/inet.h`, `symlink`) and
|
||||
do not compile with MinGW. The main program is unaffected.
|
||||
|
||||
## Run
|
||||
|
||||
```bat
|
||||
|
||||
Reference in New Issue
Block a user