obs-studio
obs-studio copied to clipboard
cmake: Use NOMINMAX on Windows
Description
This PR makes a few changes.
- Explicitly use std::min
- Explicitly use std::max
- Set
NOMINMAXas a default compile definition on Windows to prevent defining min/max macros
Motivation and Context
Want to just use STL std::min/std::max and avoid shenanigans with min/max macros.
See also:
- https://github.com/obsproject/obs-studio/pull/10997
Also needs:
- https://github.com/elgatosf/capture-device-support/pull/6
How Has This Been Tested?
Built locally on Windows 11. Still needs built with VS for/on WoA to make sure it works.
Types of changes
- Code cleanup (non-breaking change which makes code smaller or more readable)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
There's still two more instances of specific
NOMINMAXuse:https://github.com/obsproject/obs-studio/blob/ba6a6bfdcb4db6fdee02b0224df4106321c5ef48/UI/win-update/updater/CMakeLists.txt#L25
https://github.com/obsproject/obs-studio/blob/ba6a6bfdcb4db6fdee02b0224df4106321c5ef48/plugins/decklink/CMakeLists.txt#L75
Removed those. Thanks.
The commits may need squashed to avoid the first two commits failing.