Move the definition of NOMINMAX to source files Defining the NOMINMAX macro in our build system doesn't work if an alternative build system is used. Always define WIN32_LEAN_AND_MEAN before including <windows.h>. Change-Id: I2f80e51c5553b8d37eebaea27ad0431b1ed20046 (cherry picked from commit 53cfa29854208e6b07d95ac8c55a6850b3fdc97e)
diff --git a/aom_ports/aom_once.h b/aom_ports/aom_once.h index 37057e6..0974a3b 100644 --- a/aom_ports/aom_once.h +++ b/aom_ports/aom_once.h
@@ -39,6 +39,8 @@ */ #if CONFIG_MULTITHREAD && defined(_WIN32) +#undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #include <windows.h> /* Declare a per-compilation-unit state variable to track the progress * of calling func() only once. This must be at global scope because
diff --git a/aom_ports/aom_timer.h b/aom_ports/aom_timer.h index 9b17b89..ff58799 100644 --- a/aom_ports/aom_timer.h +++ b/aom_ports/aom_timer.h
@@ -22,9 +22,10 @@ /* * Win32 specific includes */ -#ifndef WIN32_LEAN_AND_MEAN +#undef NOMINMAX +#define NOMINMAX +#undef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN -#endif #include <windows.h> #else /*
diff --git a/aom_ports/x86.h b/aom_ports/x86.h index f390dfa..d44d386 100644 --- a/aom_ports/x86.h +++ b/aom_ports/x86.h
@@ -148,6 +148,10 @@ #endif #if defined(_MSC_VER) && _MSC_VER >= 1700 +#undef NOMINMAX +#define NOMINMAX +#undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #include <windows.h> #if WINAPI_FAMILY_PARTITION(WINAPI_FAMILY_APP) #define getenv(x) NULL
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake index 1ebfa9e..427507f 100644 --- a/build/cmake/aom_configure.cmake +++ b/build/cmake/aom_configure.cmake
@@ -230,9 +230,6 @@ # The default _WIN32_WINNT value in MinGW is 0x0502 (Windows XP with SP2). Set # it to 0x0601 (Windows 7). add_compiler_flag_if_supported("-D_WIN32_WINNT=0x0601") - # Prevent windows.h from defining the min and max macros. This allows us to - # use std::min and std::max. - add_compiler_flag_if_supported("-DNOMINMAX") endif() #