From 40f0814b98b9e7e02b12a3718cbf1419adf3ae9c Mon Sep 17 00:00:00 2001 From: JonasBa Date: Wed, 1 May 2024 14:27:31 -0400 Subject: [PATCH] fix(profiling): override win macros --- packages/profiling-node/binding.gyp | 12 +++++++++++- packages/profiling-node/bindings/cpu_profiler.cc | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/profiling-node/binding.gyp b/packages/profiling-node/binding.gyp index fd2322db4e94..1c1aad075e39 100644 --- a/packages/profiling-node/binding.gyp +++ b/packages/profiling-node/binding.gyp @@ -6,5 +6,15 @@ # Silence gcc8 deprecation warning https://github.com/nodejs/nan/issues/807#issuecomment-455750192 "cflags": ["-Wno-cast-function-type"] }, - ] + ], + 'conditions': [ + [ 'OS=="win"', { + 'defines': [ + # Stop from defining macros that conflict with + # std::min() and std::max(). We don't use (much) + # but we still inherit it from uv.h. + 'NOMINMAX', + ] + }], + ], } diff --git a/packages/profiling-node/bindings/cpu_profiler.cc b/packages/profiling-node/bindings/cpu_profiler.cc index f269990f425b..64a82ba61910 100644 --- a/packages/profiling-node/bindings/cpu_profiler.cc +++ b/packages/profiling-node/bindings/cpu_profiler.cc @@ -1,3 +1,6 @@ +#ifndef NOMINMAX +#define NOMINMAX +#endif #include #include