Skip to content

Commit 0776681

Browse files
committed
build: handle windows.h min/max error locally
1 parent 2a15fa0 commit 0776681

11 files changed

Lines changed: 29 additions & 1 deletion

File tree

examples/createAndDestroyDeviceObject.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <limits> // std::numeric_limits
1717
#include <stdgpu/memory.h> // createDeviceArray, destroyDeviceArray, createHostArray, destroyHostArray
1818
#include <stdgpu/platform.h> // STDGPU_HOST_DEVICE
19+
#include <stdgpu/min_max_push.h>
1920

2021
class Image
2122
{

src/stdgpu/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.23)
5252
execution.h
5353
functional.h
5454
iterator.h
55+
min_max_push.h
56+
min_max_pop.h
5557
limits.h
5658
memory.h
5759
mutex.cuh

src/stdgpu/algorithm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include <stdgpu/execution.h>
2929
#include <stdgpu/platform.h>
30+
#include <stdgpu/min_max_push.h>
3031

3132
namespace stdgpu
3233
{
@@ -211,5 +212,6 @@ using namespace adl_barrier;
211212
} // namespace stdgpu
212213

213214
#include <stdgpu/impl/algorithm_detail.h>
215+
#include <stdgpu/min_max_pop.h>
214216

215217
#endif // STDGPU_ALGORITHM_H

src/stdgpu/impl/memory_detail.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include STDGPU_DETAIL_BACKEND_HEADER(memory.h)
3232

33+
#include <stdgpu/min_max_push.h>
34+
3335
namespace stdgpu::detail
3436
{
3537

@@ -804,5 +806,5 @@ size_bytes(T* array)
804806
}
805807

806808
} // namespace stdgpu
807-
809+
#include <stdgpu/min_max_pop.h>
808810
#endif // STDGPU_MEMORY_DETAIL_H

src/stdgpu/limits.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include <stdgpu/compiler.h>
3232
#include <stdgpu/platform.h>
33+
#include <stdgpu/min_max_push.h>
34+
3335

3436
namespace stdgpu
3537
{
@@ -1561,5 +1563,6 @@ struct numeric_limits<long double>
15611563
} // namespace stdgpu
15621564

15631565
#include <stdgpu/impl/limits_detail.h>
1566+
#include <stdgpu/min_max_pop.h>
15641567

15651568
#endif // STDGPU_LIMITS_H

src/stdgpu/min_max_pop.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#ifdef _WIN32
2+
#pragma pop_macro("min")
3+
#pragma pop_macro("max")
4+
#endif

src/stdgpu/min_max_push.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#if defined(_WIN32)
2+
#pragma push_macro("min")
3+
#pragma push_macro("max")
4+
#undef min
5+
#undef max
6+
#endif

tests/stdgpu/algorithm.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
#include <stdgpu/algorithm.h>
2727
#include <test_utils.h>
28+
#include <stdgpu/min_max_push.h>
29+
2830

2931
class stdgpu_algorithm : public ::testing::Test
3032
{

tests/stdgpu/bit.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include <stdgpu/bit.h>
2424
#include <test_utils.h>
25+
#include <stdgpu/min_max_push.h>
26+
2527

2628
class stdgpu_bit : public ::testing::Test
2729
{

tests/stdgpu/functional.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <stdgpu/functional.h>
2424
#include <test_utils.h>
25+
#include <stdgpu/min_max_push.h>
2526

2627
class stdgpu_functional : public ::testing::Test
2728
{

0 commit comments

Comments
 (0)