THRIFT-4680: fix up std::min, std::max, and numeric limits min/max on Windows; remove NOMINMAX from cmake build
diff --git a/lib/py/src/ext/protocol.tcc b/lib/py/src/ext/protocol.tcc
index c025d0c..e15df7e 100644
--- a/lib/py/src/ext/protocol.tcc
+++ b/lib/py/src/ext/protocol.tcc
@@ -144,7 +144,7 @@
   *output = PyBytes_AS_STRING(buf2->buf) + buf2->pos;
 #endif
   Py_ssize_t pos0 = buf2->pos;
-  buf2->pos = std::min(buf2->pos + static_cast<Py_ssize_t>(len), buf2->string_size);
+  buf2->pos = (std::min)(buf2->pos + static_cast<Py_ssize_t>(len), buf2->string_size);
   return static_cast<int>(buf2->pos - pos0);
 }
 }
@@ -212,7 +212,7 @@
   if (INT_CONV_ERROR_OCCURRED(len)) {
     return false;
   }
-  if (!CHECK_RANGE(len, 0, std::numeric_limits<int32_t>::max())) {
+  if (!CHECK_RANGE(len, 0, (std::numeric_limits<int32_t>::max)())) {
     PyErr_SetString(PyExc_OverflowError, "size out of range: exceeded INT32_MAX");
     return false;
   }
@@ -360,8 +360,8 @@
   case T_I08: {
     int8_t val;
 
-    if (!parse_pyint(value, &val, std::numeric_limits<int8_t>::min(),
-                     std::numeric_limits<int8_t>::max())) {
+    if (!parse_pyint(value, &val, (std::numeric_limits<int8_t>::min)(),
+                     (std::numeric_limits<int8_t>::max)())) {
       return false;
     }
 
@@ -371,8 +371,8 @@
   case T_I16: {
     int16_t val;
 
-    if (!parse_pyint(value, &val, std::numeric_limits<int16_t>::min(),
-                     std::numeric_limits<int16_t>::max())) {
+    if (!parse_pyint(value, &val, (std::numeric_limits<int16_t>::min)(),
+                     (std::numeric_limits<int16_t>::max)())) {
       return false;
     }
 
@@ -382,8 +382,8 @@
   case T_I32: {
     int32_t val;
 
-    if (!parse_pyint(value, &val, std::numeric_limits<int32_t>::min(),
-                     std::numeric_limits<int32_t>::max())) {
+    if (!parse_pyint(value, &val, (std::numeric_limits<int32_t>::min)(),
+                     (std::numeric_limits<int32_t>::max)())) {
       return false;
     }
 
@@ -397,8 +397,8 @@
       return false;
     }
 
-    if (!CHECK_RANGE(nval, std::numeric_limits<int64_t>::min(),
-                     std::numeric_limits<int64_t>::max())) {
+    if (!CHECK_RANGE(nval, (std::numeric_limits<int64_t>::min)(),
+                     (std::numeric_limits<int64_t>::max)())) {
       PyErr_SetString(PyExc_OverflowError, "int out of range");
       return false;
     }