31 lines
901 B
Bash
Executable File
31 lines
901 B
Bash
Executable File
#!/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/."
|