@echo off
setlocal
if exist KeyEmitter.exe del KeyEmitter.exe

where g++ >nul 2>nul
if not errorlevel 1 (
    echo Building with MinGW g++ static runtime
    g++ -O2 -static -mwindows KeyEmitter.cpp -o KeyEmitter.exe
    goto :eof
)

where cl >nul 2>nul
if not errorlevel 1 (
    echo Building with MSVC cl static CRT
    cl /O2 /EHsc /MT KeyEmitter.cpp user32.lib gdi32.lib /link /SUBSYSTEM:WINDOWS
    goto :eof
)

echo ERROR: no C++ compiler found. Install MinGW-w64 or Visual Studio.
