mingw-w64

GCC cross-compiler toolchain for Windows development on macOS/Linux

brewmacoslinux
Try with needOr install directly
Source

About

Minimalist GNU for Windows and GCC cross-compilers

Commands

x86_64-w64-mingw32-gccx86_64-w64-mingw32-g++x86_64-w64-mingw32-ldx86_64-w64-mingw32-arx86_64-w64-mingw32-stripi686-w64-mingw32-gcci686-w64-mingw32-g++

Examples

Compile a C program for 64-bit Windows$ x86_64-w64-mingw32-gcc -o program.exe program.c
Compile a C++ program for 32-bit Windows$ i686-w64-mingw32-g++ -o program.exe program.cpp
Cross-compile with optimization flags for Windows$ x86_64-w64-mingw32-gcc -O2 -Wall -o output.exe source.c