Skip to content

build: Add NOMINMAX definition for MSVC compatibility#478

Open
siposcsaba89 wants to merge 1 commit intostotko:masterfrom
siposcsaba89:master
Open

build: Add NOMINMAX definition for MSVC compatibility#478
siposcsaba89 wants to merge 1 commit intostotko:masterfrom
siposcsaba89:master

Conversation

@siposcsaba89
Copy link
Contributor

This pull request makes a small build configuration change to the src/stdgpu/CMakeLists.txt file. The main update is the addition of a preprocessor definition to prevent macro conflicts when building with MSVC.

  • Build system improvement:
    • Added the NOMINMAX preprocessor definition for MSVC builds to prevent conflicts with the min and max macros defined in Windows headers. (src/stdgpu/CMakeLists.txt)

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.60%. Comparing base (2a15fa0) to head (46a36a4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #478      +/-   ##
==========================================
- Coverage   96.64%   96.60%   -0.04%     
==========================================
  Files          33       33              
  Lines        2622     2622              
==========================================
- Hits         2534     2533       -1     
- Misses         88       89       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stotko
Copy link
Owner

stotko commented Feb 24, 2026

Thanks! I'm a bit hesitant to merge this fix since I don't believe that the proposed preprocessor definition should belong to stdgpu. In fact, the culprit is the <windows.h> header which defines non-standard macros for min and max that would clash with the stdgpu's algorithm.h and limits.h headers. However, <windows.h> is not directly used by stdgpu and unconditionally defining NOMINMAX may break cases where this case is already accounted for. Could you provide more details on your use case?

@siposcsaba89
Copy link
Contributor Author

Thanks! I'm a bit hesitant to merge this fix since I don't believe that the proposed preprocessor definition should belong to stdgpu. In fact, the culprit is the <windows.h> header which defines non-standard macros for min and max that would clash with the stdgpu's algorithm.h and limits.h headers. However, <windows.h> is not directly used by stdgpu and unconditionally defining NOMINMAX may break cases where this case is already accounted for. Could you provide more details on your use case?

Sorry, thad I did not give you more detailed description. I am trying to port our project to compile with cuda 13, and I belive that thrust and cuda in version 13 includes windows.h or some header from windows that defines min, max, which breaks our build. I understand, that you are hesitant, and I tought about that too, that it could break other cases, could give warning from already defined macros, etc., but if I do not set it, it won't compile. Maybe a pragma pop, push solution would be better, that's how nvidia does it, so I think you are right not to merge it, let me see if I can provide a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants