Files

65 lines
2.2 KiB
Markdown

# Windows builds: MSYS2 (native) and MinGW-w64 (cross)
## MSYS2 (native Windows, recommended for a full build)
Install the MINGW64 toolchain and the optional libraries used by the modules:
```bash
pacman -S --needed base-devel \
mingw-w64-x86_64-toolchain \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-ninja \
mingw-w64-x86_64-boost \
mingw-w64-x86_64-openssl \
mingw-w64-x86_64-libsodium \
mingw-w64-x86_64-libarchive \
mingw-w64-x86_64-sqlite3 \
mingw-w64-x86_64-lua
```
Then, from a **MINGW64** shell (not the MSYS shell):
```bash
cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build
ctest --test-dir build --output-on-failure
```
Notes:
- C++26 reflection requires GCC 16 or newer (`-freflection`). The build
probes for it; on older GCC some reflection-only tests are skipped.
- `Void::IO` currently has a POSIX (epoll) backend only; select the modules
you need with `-DVOID_ENABLED_MODULES=...` if a module is not yet available
on Windows.
- The Windows branches of `Void::System` (paths, bounded reads, audio) are
compiled by this configuration.
## MinGW-w64 cross build (Linux container)
`Dockerfile.mingw` uses the LLVM-MinGW toolchain (Clang + libc++ + the
MinGW-w64 runtime) on top of Ubuntu, together with CMake 4 and Ninja. The
matching devcontainer is in `.devcontainer/mingw/`.
```bash
docker build -f Dockerfile.mingw -t voidlibrary-mingw .
docker run --rm -v "$PWD:/src" -w /src voidlibrary-mingw bash -lc '
cmake -B build-mingw -S . -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DVOID_ENABLE_TESTING=OFF \
-DVOID_ENABLED_MODULES="Core;Functional;Containers;Math;Text;Algorithms;Unicode;Time;LogState"
cmake --build build-mingw
'
```
Cross-compiling cannot use the host's Boost/OpenSSL/libsodium/libarchive/SQLite/
Lua libraries. Modules that need them (or the POSIX-only IO backend) are
therefore excluded from a cross build; use MSYS2 on Windows for those.
- The toolchain file accepts GCC- or Clang-based MinGW prefixes and picks
whichever compiler exists.
- `CMAKE_CXX_STANDARD` can be pinned for older toolchains
(`-DCMAKE_CXX_STANDARD=23`); the build probes capabilities against the
selected standard.