Skip to content

Commit

Permalink
[Graphbolt]Fix windows nominmax issue (dmlc#6853)
Browse files Browse the repository at this point in the history
Co-authored-by: Ubuntu <[email protected]>
  • Loading branch information
peizhou001 and Ubuntu authored Dec 29, 2023
1 parent 5b51e96 commit a2cb2ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 5 additions & 0 deletions graphbolt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ if(USE_CUDA)
add_definitions(-DGRAPHBOLT_USE_CUDA)
endif()

# For windows, define NOMINMAX to avoid conflict with std::min/max
if(MSVC)
add_definitions(-DNOMINMAX)
endif()

# Find PyTorch cmake files and PyTorch versions with the python interpreter
# $PYTHON_INTERP ("python3" or "python" if empty)
if(NOT PYTHON_INTERP)
Expand Down
9 changes: 0 additions & 9 deletions graphbolt/include/graphbolt/shared_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,12 @@
#define GRAPHBOLT_SHARED_MEMORY_H_

#ifdef _WIN32
// Add the macro to avoid MIN/MAX conflict.
#ifndef NOMINMAX
#define NOMINMAX
#define GRAPHBOLT_WINDOWS_NOMINMAX_
#endif // NOMINMAX
#include <windows.h>
#endif // _WIN32

#include <memory>
#include <string>

#ifdef GRAPHBOLT_WINDOWS_NOMINMAX_
#undef NOMINMAX
#endif // GRAPHBOLT_WINDOWS_NOMINMAX_

namespace graphbolt {
namespace sampling {

Expand Down

0 comments on commit a2cb2ec

Please sign in to comment.