export PREFIX=$HOME/toolchains/native/x86_64-w64-mingw32-mcf/x86_64-w64-mingw32
export INSTALLPREFIX=$HOME/llvm_toolchains/x86_64-w64-mingw32-mcf/llvm
export LLVMROOT=$HOME/llvm_toolchains/native

cmake ../../../llvm-project/llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" -Wno-dev -DLLVM_INCLUDE_TESTS=Off -DLLVM_INCLUDE_EXAMPLES=Off -DLLVM_ENABLE_BACKTRACES=Off  -DLLVM_ENABLE_PIC=Off -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-windows-gnu -DLLVM_HOST_TRIPLE=x86_64-windows-gnu -DHAVE_CXX_FLAG_WTHREAD_SAFETY=Off -DLLVM_TABLEGEN=$LLVMROOT/bin/llvm-tblgen -DCLANG_TABLEGEN=$LLVMROOT/bin/clang-tblgen -DCMAKE_CROSSCOMPILING=On -DCMAKE_INSTALL_PREFIX=$INSTALLPREFIX -DCMAKE_SYSTEM_NAME=Windows -GNinja -DLLVM_ENABLE_ZLIB=FORCE_ON -DWIN32=On -DLLVM_OPTIMIZED_TABLEGEN=On -DLLVM_ENABLE_ASSERTIONS=Off -DLLVM_ENABLE_UNWIND_TABLES=Off -DMINGW=On -DHAVE_STEADY_CLOCK=Off -DBUILD_SHARED_LIBS=On -DBENCHMARK_ENABLE_TESTING=Off -DCMAKE_ASM_COMPILER=x86_64-w64-mingw32-as -DCMAKE_FIND_ROOT_PATH=$PREFIX -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=Never -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=Only -DCMAKE_CROSSCOMPILING=On -DCMAKE_HOST_SYSTEM_NAME=Windows -DCMAKE_INSTALL_PREFIX=$INSTALLPREFIX -DCMAKE_SYSTEM_NAME=Windows -GNinja -DLLVM_ENABLE_ZLIB=FORCE_ON -DWIN32=1 -DMINGW=1 -DZLIB_LIBRARY=$PREFIX/x86_64-w64-mingw32/lib/libzlibstatic.a -DZLIB_INCLUDE_DIR=$PREFIX/x86_64-w64-mingw32/include -DCMAKE_ASM_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_AR=$PREFIX/bin/x86_64-w64-mingw32-ar -DCMAKE_RANLIB=$PREFIX/bin/x86_64-w64-mingw32-ranlib -DLLVM_INCLUDE_BENCHMARKS=Off -DLLVM_BUILD_BENCHMARKS=Off -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PIC=Off