Skip to content

Commit

Permalink
Revert "remove NOMINMAX"
Browse files Browse the repository at this point in the history
This reverts commit 17a80f2.
  • Loading branch information
jiayuehua committed Jun 10, 2022
1 parent 17a80f2 commit 979139b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
19 changes: 19 additions & 0 deletions ports/glog/cmakelists_atomicdetect.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 13c474b..34ffc06 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -398,6 +398,14 @@ if (HAVE_EXECINFO_H)
set (HAVE_STACKTRACE 1)
endif (HAVE_EXECINFO_H)

+if (HAVE_CXX11_ATOMIC)
+ message(STATUS "have atomic")
+ set (ac_cv_cxx11_atomic 1)
+else ()
+ message(STATUS "not have atomic")
+ set (ac_cv_cxx11_atomic 0)
+endif ()
+
if (WITH_SYMBOLIZE)
if (WIN32 OR CYGWIN)
if(CMAKE_CROSSCOMPILING)
31 changes: 18 additions & 13 deletions ports/glog/noerror-nominmax.patch
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in
index 3ecacfb..ebbc7d5 100644
index 3ecacfb..033230d 100644
--- a/src/glog/logging.h.in
+++ b/src/glog/logging.h.in
@@ -103,7 +103,14 @@
#ifdef HAVE_CXX11_ATOMIC
@@ -100,10 +100,18 @@
#include <gflags/gflags.h>
#endif

-#ifdef HAVE_CXX11_ATOMIC
+#if @ac_cv_cxx11_atomic@
#include <atomic>
#elif defined(GLOG_OS_WINDOWS)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN // We only need minimal includes
+// To avoid macro definition of ERROR.
+// To avoid macro definition of min/max.
+# ifndef NOMINMAX
+# define NOMINMAX
+# endif
#include <Windows.h>
+// To avoid macro definition of ERROR.
+#ifdef ERROR
+# undef ERROR
+#endif
+# ifdef ERROR
+# undef ERROR
+# endif
#endif

@ac_google_start_namespace@
@@ -1061,7 +1068,7 @@ namespace google {
@@ -1061,7 +1069,7 @@ namespace google {
#elif defined(GLOG_OS_WINDOWS)

#define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \
Expand All @@ -26,7 +31,7 @@ index 3ecacfb..ebbc7d5 100644
InterlockedIncrement(&LOG_OCCURRENCES); \
if (InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) > n) \
InterlockedExchangeSubtract(&LOG_OCCURRENCES_MOD_N, n); \
@@ -1071,7 +1078,7 @@ namespace google {
@@ -1071,7 +1079,7 @@ namespace google {
&what_to_do).stream()

#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
Expand All @@ -35,7 +40,7 @@ index 3ecacfb..ebbc7d5 100644
InterlockedIncrement(&LOG_OCCURRENCES); \
if (condition && \
(InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) || true) && \
@@ -1082,7 +1089,7 @@ namespace google {
@@ -1082,7 +1090,7 @@ namespace google {
&what_to_do).stream()

#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
Expand All @@ -44,7 +49,7 @@ index 3ecacfb..ebbc7d5 100644
InterlockedIncrement(&LOG_OCCURRENCES); \
if (InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) > n) \
InterlockedExchangeSubtract(&LOG_OCCURRENCES_MOD_N, n); \
@@ -1092,7 +1099,7 @@ namespace google {
@@ -1092,7 +1100,7 @@ namespace google {
&what_to_do).stream()

#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
Expand Down
2 changes: 1 addition & 1 deletion ports/glog/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ vcpkg_from_github(
fix_log_every_n.patch
noerror-nominmax.patch
fix_crosscompile_symbolize.patch

cmakelists_atomicdetect.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion versions/g-/glog.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"versions": [
{
"git-tree": "c469b2bfc6498c37b6daad8d512a1b1d1cb6a6f6",
"git-tree": "23a5cebc8eddfba3c2da76d3a6f46a404aa458d9",
"version": "0.5.0",
"port-version": 5
},
Expand Down

0 comments on commit 979139b

Please sign in to comment.