Update Windows build documentation

This commit is contained in:
luochen570
2026-05-31 12:48:56 +08:00
parent 4e1f73bab7
commit 804a5db77d
5 changed files with 266 additions and 32 deletions

30
build_wsl_windows.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
if ! command -v x86_64-w64-mingw32-g++ >/dev/null 2>&1; then
echo "Missing x86_64-w64-mingw32-g++."
echo "Install it in WSL with: sudo apt install mingw-w64"
exit 1
fi
if [[ "${QT_MINGW_PREFIX:-}" == "" ]]; then
echo "Missing QT_MINGW_PREFIX."
echo "Example: export QT_MINGW_PREFIX=/opt/mxe/usr/x86_64-w64-mingw32.shared/qt6"
exit 1
fi
if [[ "${OpenCV_DIR:-}" == "" ]]; then
echo "Missing OpenCV_DIR."
echo "Example: export OpenCV_DIR=/opt/mxe/usr/x86_64-w64-mingw32.shared/lib/cmake/opencv4"
exit 1
fi
cmake -S . -B build-wsl-windows \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw64.cmake \
-DCMAKE_PREFIX_PATH="${QT_MINGW_PREFIX}" \
-DOpenCV_DIR="${OpenCV_DIR}"
cmake --build build-wsl-windows --config Release
echo "Windows executable should be under build-wsl-windows/."