diff -Naur blender-2.77a-orig/extern/glog/src/windows/config.h blender-2.77a/extern/glog/src/windows/config.h
--- blender-2.77a-orig/extern/glog/src/windows/config.h	2016-03-23 11:49:49.000000000 +0300
+++ blender-2.77a/extern/glog/src/windows/config.h	2016-07-12 13:40:19.613595000 +0300
@@ -15,6 +15,10 @@
 #if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1900))
 #  define HAVE_SNPRINTF
 #endif
+
+#if defined(__MINGW32__)
+#  define HAVE_PTHREAD
+#endif
 
 /* Always the empty-string on non-windows systems. On windows, should be
    "__declspec(dllexport)". This way, when we compile the dll, we export our
diff -Naur blender-2.77a-orig/extern/glog/src/windows/port.h blender-2.77a/extern/glog/src/windows/port.h
--- blender-2.77a-orig/extern/glog/src/windows/port.h	2016-03-23 11:49:49.000000000 +0300
+++ blender-2.77a/extern/glog/src/windows/port.h	2016-07-12 13:40:19.613595000 +0300
@@ -62,7 +62,7 @@
  * used by both C and C++ code, so we put all the C++ together.
  */
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 
 /* 4244: otherwise we get problems when substracting two size_t's to an int
  * 4251: it's complaining about a private struct I've chosen not to dllexport
@@ -74,17 +74,19 @@
 #pragma warning(disable:4244 4251 4355 4715 4800 4996)
 
 /* file I/O */
-#define PATH_MAX 1024
 #define access  _access
 #define getcwd  _getcwd
 #define open    _open
 #define read    _read
 #define write   _write
-#define lseek   _lseek
 #define close   _close
 #define popen   _popen
 #define pclose  _pclose
+#ifndef __MINGW64_VERSION_MAJOR
+#define lseek   _lseek
+#define PATH_MAX 1024
 #define R_OK    04           /* read-only (for access()) */
+#endif
 #define S_ISDIR(m)  (((m) & _S_IFMT) == _S_IFDIR)
 #ifndef __MINGW32__
 enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 };
@@ -130,7 +132,9 @@
 #define DEFAULT_TEMPLATE_ROOTDIR  ".."
 
 // ----------------------------------- SYSTEM/PROCESS
+#ifndef __MINGW64_VERSION_MAJOR
 typedef int pid_t;
+#endif
 #define getpid  _getpid
 
 #endif  // _MSC_VER
diff -Naur blender-2.77a-orig/intern/cycles/util/util_logging.h blender-2.77a/intern/cycles/util/util_logging.h
--- blender-2.77a-orig/intern/cycles/util/util_logging.h	2016-03-23 11:49:49.000000000 +0300
+++ blender-2.77a/intern/cycles/util/util_logging.h	2016-07-12 13:40:19.646095000 +0300
@@ -18,7 +18,9 @@
 
 #if defined(WITH_CYCLES_LOGGING) && !defined(__KERNEL_GPU__)
 #  include <gflags/gflags.h>
+#  define GLOG_NO_ABBREVIATED_SEVERITIES
 #  include <glog/logging.h>
+#  undef GLOG_NO_ABBREVIATED_SEVERITIES
 #endif
 
 #include <iostream>
diff -Naur blender-2.80-orig/intern/cycles/util/util_simd.h blender-2.80/intern/cycles/util/util_simd.h
--- blender-2.80-orig/intern/cycles/util/util_simd.h	2016-03-23 11:49:49.000000000 +0300
+++ blender-2.80/intern/cycles/util/util_simd.h	2016-07-12 13:40:19.681095000 +0300
@@ -29,22 +29,13 @@
  * We assume __KERNEL_SSEX__ flags to have been defined at this point */
 
 /* SSE intrinsics headers */
-#  ifndef FREE_WINDOWS64
 
-#    ifdef _MSC_VER
+#    ifdef _WIN32
 #      include <intrin.h>
 #    elif (defined(__x86_64__) || defined(__i386__))
 #      include <x86intrin.h>
 #    endif
 
-#  else
-
-/* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
- * Since we can't avoid including <windows.h>, better only include that */
-#    include "util/util_windows.h"
-
-#  endif
-
 #  if defined(__x86_64__) || defined(_M_X64)
 #    define SIMD_SET_FLUSH_TO_ZERO \
       _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); \
diff -Naur blender-2.80-orig/intern/cycles/util/util_defines.h blender-2.80/intern/cycles/util/util_defines.h
--- blender-2.80-orig/intern/cycles/util/util_defines.h	2016-03-23 11:49:49.000000000 +0300
+++ blender-2.80/intern/cycles/util/util_defines.h	2016-07-12 13:40:19.712595000 +0300
@@ -59,7 +59,7 @@
 #    define ccl_device_inline static inline __attribute__((always_inline))
 #    define ccl_device_forceinline static inline __attribute__((always_inline))
 #    define ccl_align(...) __attribute__((aligned(__VA_ARGS__)))
-#    ifndef FREE_WINDOWS64
+#      ifndef __MINGW64_VERSION_MAJOR
 #      define __forceinline inline __attribute__((always_inline))
 #    endif
 #    define ccl_try_align(...) __attribute__((aligned(__VA_ARGS__)))
diff -Naur blender-2.80-orig/intern/dualcon/intern/Projections.h blender-2.80/intern/dualcon/intern/Projections.h
--- blender-2.80-orig/intern/dualcon/intern/Projections.h	2016-03-23 11:49:49.000000000 +0300
+++ blender-2.80/intern/dualcon/intern/Projections.h	2016-07-12 13:40:19.712595000 +0300
@@ -23,7 +23,7 @@
 #define CONTAINS_INDEX
 #define GRID_DIMENSION 20
 
-#if defined(_WIN32) && !(_MSC_VER >= 1900)
+#if defined(_MSC_VER) && !(_MSC_VER >= 1900)
 #  define isnan(n) _isnan(n)
 #  define LONG __int64
 #  define int64_t __int64
diff -Naur blender-2.80-orig/intern/ghost/intern/GHOST_WindowWin32.cpp blender-2.80/intern/ghost/intern/GHOST_WindowWin32.cpp
--- blender-2.80-orig/intern/ghost/intern/GHOST_WindowWin32.cpp	2016-03-23 11:49:43.000000000 +0300
+++ blender-2.80/intern/ghost/intern/GHOST_WindowWin32.cpp	2016-07-12 13:40:19.800595000 +0300
@@ -23,6 +23,12 @@
 
 #define _USE_MATH_DEFINES
 
+#if defined(WITH_GL_EGL)
+#  include "GHOST_ContextEGL.h"
+#else
+#  include "GHOST_ContextWGL.h"
+#endif
+
 #include "GHOST_WindowWin32.h"
 #include "GHOST_ContextD3D.h"
 #include "GHOST_ContextNone.h"
@@ -36,11 +42,6 @@
 #include "utfconv.h"
 #include "utf_winfunc.h"
 
-#if defined(WITH_GL_EGL)
-#  include "GHOST_ContextEGL.h"
-#else
-#  include "GHOST_ContextWGL.h"
-#endif
 #ifdef WIN32_COMPOSITING
 #  include <Dwmapi.h>
 #endif
diff -Naur blender-2.77a-orig/intern/libmv/libmv/numeric/numeric.h blender-2.77a/intern/libmv/libmv/numeric/numeric.h
--- blender-2.77a-orig/intern/libmv/libmv/numeric/numeric.h	2016-03-23 11:49:49.000000000 +0300
+++ blender-2.77a/intern/libmv/libmv/numeric/numeric.h	2016-07-12 13:40:19.817095000 +0300
@@ -33,7 +33,7 @@
 #include <Eigen/QR>
 #include <Eigen/SVD>
 
-#if !defined(__MINGW64__)
+#if !defined(__MINGW64_VERSION_MAJOR)
 #  if defined(_WIN32) || defined(__APPLE__) || \
       defined(__FreeBSD__) || defined(__NetBSD__)
 static void sincos(double x, double *sinx, double *cosx) {
@@ -41,7 +41,7 @@
   *cosx = cos(x);
 }
 #  endif
-#endif  // !__MINGW64__
+#endif  // !__MINGW64_VERSION_MAJOR
 
 #if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__)
 inline long lround(double d) {
diff --Naur  a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -65,8 +65,10 @@ int    BLI_create_symlink(const char *path, const char *to) ATTR_NONNULL();
 
 /* keep in sync with the definition of struct direntry in BLI_fileops_types.h */
 #ifdef WIN32
-#  if defined(_MSC_VER)
+#  if defined(_MSC_VER) || defined(__MINGW64__)
 typedef struct _stat64 BLI_stat_t;
+#  elif defined(__MINGW32__)
+typedef struct _stati64 BLI_stat_t;
 #  else
 typedef struct _stat BLI_stat_t;
 #  endif
diff -Naur blender-2.79-orig/source/blender/blenlib/BLI_fileops_types.h blender-2.79/source/blender/blenlib/BLI_fileops_types.h
--- blender-2.79-orig/source/blender/blenlib/BLI_fileops_types.h	2016-03-23 11:49:43.000000000 +0300
+++ blender-2.79/source/blender/blenlib/BLI_fileops_types.h	2016-07-12 13:40:19.827095000 +0300
@@ -35,7 +35,7 @@
 
 #include <sys/stat.h>
 
-#if defined(WIN32)
+#if defined(_MSC_VER)
 typedef unsigned int mode_t;
 #endif
 
@@ -50,8 +50,10 @@ struct direntry {
   const char *relname;
   const char *path;
 #ifdef WIN32 /* keep in sync with the definition of BLI_stat_t in BLI_fileops.h */
-#  if defined(_MSC_VER)
+#  if defined(_MSC_VER) || defined(__MINGW64__)
   struct _stat64 s;
+#  elif defined(__MINGW32__)
+  struct _stati64 s;
 #  else
   struct _stat s;
 #  endif
diff -Naur blender-2.77a-orig/source/blender/blenlib/BLI_winstuff.h blender-2.77a/source/blender/blenlib/BLI_winstuff.h
--- blender-2.77a-orig/source/blender/blenlib/BLI_winstuff.h	2016-03-23 11:49:43.000000000 +0300
+++ blender-2.77a/source/blender/blenlib/BLI_winstuff.h	2016-07-12 13:40:19.827095000 +0300
@@ -90,7 +90,7 @@
 #endif
 
 /* defines for using ISO C++ conformant names */
-#if !defined(_MSC_VER) || _MSC_VER < 1900
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
 #  define snprintf _snprintf
 #endif
 
@@ -82,10 +95,13 @@
 #  define F_OK 0
 #endif
 
+#if defined(_MSC_VER)
 typedef unsigned int mode_t;
+#endif
 
-#ifndef _SSIZE_T_
-#  define _SSIZE_T_
+/* mingw using _SSIZE_T_DEFINED to declare ssize_t type */
+#ifndef _SSIZE_T_DEFINED
+#  define _SSIZE_T_DEFINED
 /* python uses HAVE_SSIZE_T */
 #  ifndef HAVE_SSIZE_T
 #    define HAVE_SSIZE_T 1
--- blender-2.79b/source/blender/blenlib/intern/system.c.orig	2018-05-11 10:10:42.876493200 +0300
+++ blender-2.79b/source/blender/blenlib/intern/system.c	2018-05-11 10:10:49.927705600 +0300
@@ -72,7 +72,7 @@
 }
 
 /* Windows stackwalk lives in system_win32.c */
-#if !defined(_MSC_VER)
+#if !defined(_WIN32)
 /**
  * Write a backtrace into a file for systems which support it.
  */
--- blender-2.79b/source/blender/imbuf/intern/openexr/openexr_api.cpp.orig	2018-05-11 10:10:42.876493200 +0300
+++ blender-2.79b/source/blender/imbuf/intern/openexr/openexr_api.cpp	2018-05-11 10:10:49.927705600 +0300
@@ -77,7 +77,7 @@
 {
 
 // The following prevents a linking error in debug mode for MSVC using the libs in CVS
-#if defined(WITH_OPENEXR) && defined(_WIN32) && defined(DEBUG) && _MSC_VER < 1900
+#if defined(WITH_OPENEXR) && defined(_MSC_VER) && defined(DEBUG) && _MSC_VER < 1900
 _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
 {
 }
diff -Naur blender-2.80-orig/source/blender/blenlib/intern/math_solvers.c blender-2.80/source/blender/blenlib/intern/math_solvers.c
--- blender-2.80-orig/source/blender/blenlib/intern/math_solvers.c	2016-09-28 12:26:55.000000000 +0300
+++ blender-2.80/source/blender/blenlib/intern/math_solvers.c	2016-10-14 13:53:56.430617800 +0300
@@ -121,7 +121,7 @@
 
   MEM_freeN(c1);
 
-  return isfinite(x_prev);
+  return isfinite((float)x_prev);
 }
 
 /**
diff -Naur blender-2.81a-orig/source/creator/creator.c blender-2.81a/source/creator/creator.c
--- blender-2.81a-orig/source/creator/creator.c	2016-09-28 12:26:55.000000000 +0300
+++ blender-2.81a/source/creator/creator.c	2016-10-14 14:45:36.982849100 +0300
@@ -23,8 +23,9 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 #  include "utfconv.h"
 #  include <windows.h>
 #endif
diff -Naur a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
--- a/source/blender/imbuf/intern/IMB_anim.h
+++ b/source/blender/imbuf/intern/IMB_anim.h
@@ -31,7 +31,10 @@
 #  include <commdlg.h>
 #  include <memory.h>
 #  include <mmsystem.h>
-#  include <vfw.h>
+
+#  ifndef FREE_WINDOWS
+#    include <vfw.h>
+#  endif
 #  include <windows.h>
 #  include <windowsx.h>
 
@@ -112,7 +115,7 @@ struct anim {
   /* avi */
   struct _AviMovie *avi;
 
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(FREE_WINDOWS)
   /* windows avi */
   int avistreams;
   int firstvideo;
diff -Naur a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -28,7 +28,10 @@
 
 #ifdef _WIN32
 #  include "BLI_winstuff.h"
+
+#ifndef FREE_WINDOWS
 #  include <vfw.h>
+#endif
 
 #  undef AVIIF_KEYFRAME /* redefined in AVI_avi.h */
 #  undef AVIIF_LIST     /* redefined in AVI_avi.h */
@@ -165,7 +168,7 @@ static void an_stringenc(char *string, const char *head, const char *tail, unsig
 #ifdef WITH_AVI
 static void free_anim_avi(struct anim *anim)
 {
-#  if defined(_WIN32)
+#  if defined(_WIN32) && !defined(FREE_WINDOWS)
   int i;
 #  endif
 
@@ -180,7 +183,7 @@ static void free_anim_avi(struct anim *anim)
   MEM_freeN(anim->avi);
   anim->avi = NULL;
 
-#  if defined(_WIN32)
+#  if defined(_WIN32) && !defined(FREE_WINDOWS)
 
   if (anim->pgf) {
     AVIStreamGetFrameClose(anim->pgf);
@@ -319,7 +322,7 @@ static int startavi(struct anim *anim)
 {
 
   AviError avierror;
-#  if defined(_WIN32)
+#  if defined(_WIN32) && !defined(FREE_WINDOWS)
   HRESULT hr;
   int i, firstvideo = -1;
   int streamcount;
@@ -340,7 +343,7 @@ static int startavi(struct anim *anim)
 
   avierror = AVI_open_movie(anim->name, anim->avi);
 
-#  if defined(_WIN32)
+#  if defined(_WIN32) && !defined(FREE_WINDOWS)
   if (avierror == AVI_ERROR_COMPRESSION) {
     AVIFileInit();
     hr = AVIFileOpen(&anim->pfile, anim->name, OF_READ, 0L);
@@ -444,7 +447,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position)
     return NULL;
   }
 
-#  if defined(_WIN32)
+#  if defined(_WIN32) && !defined(FREE_WINDOWS)
   if (anim->avistreams) {
     LPBITMAPINFOHEADER lpbi;
 
diff -Naur a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1263,7 +1263,18 @@ bool BLI_path_program_search(
 {
   /* free windows */
 
-#if (defined(WIN32) || defined(WIN64))
+#if defined(__MINGW32__)
+  char *envstr;
+
+  if (val)
+    envstr = BLI_sprintfN("%s=%s", env, val);
+  else
+    envstr = BLI_sprintfN("%s=", env);
+
+  putenv(envstr);
+  MEM_freeN(envstr);
+
+#elif defined(_MSC_VER) /* not free windows */
   uputenv(env, val);
 
 #else
diff -Naur a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -266,8 +266,10 @@ int BLI_stat(const char *path, BLI_stat_t *buffer)
 
 int BLI_wstat(const wchar_t *path, BLI_stat_t *buffer)
 {
-#  if defined(_MSC_VER)
+#  if defined(_MSC_VER) || defined(__MINGW64__)
   return _wstat64(path, buffer);
+#  elif defined(__MINGW32__)
+  return _wstati64(path, buffer);
 #  else
   return _wstat(path, buffer);
 #  endif
@@ -457,17 +460,30 @@ void BLI_file_free_lines(LinkNode *lines)
 bool BLI_file_older(const char *file1, const char *file2)
 {
 #ifdef WIN32
-  struct _stat st1, st2;
+#  ifndef __MINGW32__
+    struct _stat st1, st2;
+#  else
+    struct _stati64 st1, st2;
+#  endif
 
   UTF16_ENCODE(file1);
   UTF16_ENCODE(file2);
 
+#ifndef __MINGW32__
   if (_wstat(file1_16, &st1)) {
     return false;
   }
   if (_wstat(file2_16, &st2)) {
     return false;
   }
+#else
+  if (_wstati64(file1_16, &st1)) {
+    return false;
+  }
+  if (_wstati64(file2_16, &st2)) {
+    return false;
+  }
+#endif
 
   UTF16_UN_ENCODE(file2);
   UTF16_UN_ENCODE(file1);
--- blender-2.80/intern/clog/clog.c.orig	2019-08-01 12:18:33.240672100 +0300
+++ blender-2.80/intern/clog/clog.c	2019-08-01 12:18:45.784094200 +0300
@@ -37,7 +37,7 @@
 #  include <sys/time.h>
 #endif
 
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 #  include <io.h>
 #  include <windows.h>
 #endif
@@ -365,7 +365,7 @@
 static uint64_t clg_timestamp_ticks_get(void)
 {
   uint64_t tick;
-#if defined(_MSC_VER)
+#if defined(_WIN32)
   tick = GetTickCount64();
 #else
   struct timeval tv;
--- blender-2.80/intern/ghost/intern/GHOST_DisplayManagerWin32.h.orig	2019-08-01 13:25:18.577130500 +0300
+++ blender-2.80/intern/ghost/intern/GHOST_DisplayManagerWin32.h	2019-08-01 13:25:57.358798600 +0300
@@ -25,7 +25,7 @@
 #ifndef __GHOST_DISPLAYMANAGERWIN32_H__
 #define __GHOST_DISPLAYMANAGERWIN32_H__
 
-#ifndef WIN32
+#ifndef _WIN32
 #  error WIN32 only!
 #endif  // WIN32
 
--- blender-2.80/intern/ghost/intern/GHOST_SystemWin32.h.orig	2019-08-01 13:27:05.485718300 +0300
+++ blender-2.80/intern/ghost/intern/GHOST_SystemWin32.h	2019-08-01 13:27:09.713325700 +0300
@@ -25,7 +25,7 @@
 #ifndef __GHOST_SYSTEMWIN32_H__
 #define __GHOST_SYSTEMWIN32_H__
 
-#ifndef WIN32
+#ifndef _WIN32
 #  error WIN32 only!
 #endif  // WIN32
 
--- blender-2.80/intern/ghost/intern/GHOST_TaskbarWin32.h.orig	2019-08-01 13:26:35.424465500 +0300
+++ blender-2.80/intern/ghost/intern/GHOST_TaskbarWin32.h	2019-08-01 13:26:37.764469600 +0300
@@ -20,7 +20,7 @@
 #ifndef __GHOST_TASKBARWIN32_H__
 #define __GHOST_TASKBARWIN32_H__
 
-#ifndef WIN32
+#ifndef _WIN32
 #  error WIN32 only!
 #endif  // WIN32
 
--- blender-2.80/intern/ghost/intern/GHOST_WindowWin32.h.orig	2019-08-01 13:26:03.333609100 +0300
+++ blender-2.80/intern/ghost/intern/GHOST_WindowWin32.h	2019-08-01 13:26:07.077615600 +0300
@@ -25,7 +25,7 @@
 #ifndef __GHOST_WINDOWWIN32_H__
 #define __GHOST_WINDOWWIN32_H__
 
-#ifndef WIN32
+#ifndef _WIN32
 #  error WIN32 only!
 #endif  // WIN32
 
--- blender-2.80/intern/ghost/intern/GHOST_ContextWGL.h.orig	2019-08-01 13:26:03.333609100 +0300
+++ blender-2.80/intern/ghost/intern/GHOST_ContextWGL.h	2019-08-01 13:26:07.077615600 +0300
@@ -28,6 +28,7 @@
 
 #include "GHOST_Context.h"
 
+#undef INT;
 #include <GL/wglew.h>
 
 #ifndef GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY
--- blender-2.80/intern/cycles/util/util_murmurhash.cpp.orig	2019-08-01 15:24:38.522454900 +0300
+++ blender-2.80/intern/cycles/util/util_murmurhash.cpp	2019-08-01 14:58:05.222223800 +0300
@@ -26,7 +26,7 @@
 #include "util/util_algorithm.h"
 #include "util/util_murmurhash.h"
 
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 #  define ROTL32(x, y) _rotl(x, y)
 #  define ROTL64(x, y) _rotl64(x, y)
 #  define BIG_CONSTANT(x) (x)
--- blender-2.80/intern/cycles/device/device_cuda.cpp.orig	2019-08-01 15:26:37.073620900 +0300
+++ blender-2.80/intern/cycles/device/device_cuda.cpp	2019-08-01 15:26:46.043633500 +0300
@@ -2584,7 +2584,7 @@
 
 static CUresult device_cuda_safe_init()
 {
-#  ifdef _WIN32
+#  ifdef _MSC_VER
   __try {
     return cuInit(0);
   }
--- blender-2.80/intern/cycles/device/device_opencl.cpp.orig	2019-08-01 15:26:37.073620900 +0300
+++ blender-2.80/intern/cycles/device/device_opencl.cpp	2019-08-01 15:26:46.043633500 +0300
@@ -64,7 +64,7 @@
 
 static cl_int device_opencl_get_num_platforms_safe(cl_uint *num_platforms)
 {
-#  ifdef _WIN32
+#  ifdef _MSC_VER
   __try {
     return clGetPlatformIDs(0, NULL, num_platforms);
   }
--- blender-2.81a/extern/quadriflow/src/dedge.cpp.orig	2019-12-06 11:45:08.681059300 +0300
+++ blender-2.81a/extern/quadriflow/src/dedge.cpp	2019-12-06 11:45:54.841540400 +0300
@@ -10,6 +10,11 @@
 #ifdef WITH_TBB
 #include "tbb/tbb.h"
 #endif
+
+#ifdef _WIN32
+#include <intrin.h>
+#endif
+
 namespace qflow {
 
 inline int dedge_prev(int e, int deg) { return (e % deg == 0u) ? e + (deg - 1) : e - 1; }
