mirror of
https://github.com/obsproject/obs-studio
synced 2025-04-29 15:57:26 +08:00
cmake: Specify NOMINMAX all the time on Windows
This prevents the Windows headers from defining min/max macros. Use std::min and std::max. Modifies deps, frontend, libobs-d3d11, libobs-winrt, decklink, obs-vst, and win-dshow.
This commit is contained in:
parent
c2b4823075
commit
e471d3109b
@ -78,6 +78,7 @@ add_compile_options(
|
||||
)
|
||||
|
||||
add_compile_definitions(
|
||||
NOMINMAX
|
||||
UNICODE
|
||||
_UNICODE
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
|
2
deps/libdshowcapture/CMakeLists.txt
vendored
2
deps/libdshowcapture/CMakeLists.txt
vendored
@ -40,4 +40,4 @@ target_include_directories(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/external/capture-device-support/Library")
|
||||
|
||||
target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
|
||||
target_compile_options(libdshowcapture INTERFACE /wd4018)
|
||||
target_compile_options(libdshowcapture INTERFACE /wd4005 /wd4018)
|
||||
|
2
deps/libdshowcapture/src
vendored
2
deps/libdshowcapture/src
vendored
@ -1 +1 @@
|
||||
Subproject commit ef8c1d2e19c93e664100dd41e1a0df4f8ad45430
|
||||
Subproject commit 8878638324393815512f802640b0d5ce940161f1
|
@ -22,7 +22,7 @@ target_sources(
|
||||
updater.rc
|
||||
)
|
||||
|
||||
target_compile_definitions(updater PRIVATE NOMINMAX "PSAPI_VERSION=2")
|
||||
target_compile_definitions(updater PRIVATE "PSAPI_VERSION=2")
|
||||
|
||||
target_include_directories(updater PRIVATE "${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_SOURCE_DIR}/frontend/utility")
|
||||
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define NOMINMAX
|
||||
|
||||
class QString;
|
||||
class QWidget;
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cinttypes>
|
||||
#include <optional>
|
||||
@ -229,7 +230,7 @@ gs_swap_chain::gs_swap_chain(gs_device *device, const gs_init_data *data)
|
||||
|
||||
ComQIPtr<IDXGIFactory5> factory5 = device->factory;
|
||||
if (factory5) {
|
||||
initData.num_backbuffers = max(data->num_backbuffers, 2);
|
||||
initData.num_backbuffers = std::max(data->num_backbuffers, (uint32_t)2);
|
||||
|
||||
effect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||
flags |= DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
|
||||
|
@ -56,12 +56,12 @@ static bool get_client_box(HWND window, uint32_t width, uint32_t height, D3D11_B
|
||||
|
||||
uint32_t texture_width = 1;
|
||||
if (width > left) {
|
||||
texture_width = min(width - left, (uint32_t)client_rect.right);
|
||||
texture_width = std::min(width - left, (uint32_t)client_rect.right);
|
||||
}
|
||||
|
||||
uint32_t texture_height = 1;
|
||||
if (height > top) {
|
||||
texture_height = min(height - top, (uint32_t)client_rect.bottom);
|
||||
texture_height = std::min(height - top, (uint32_t)client_rect.bottom);
|
||||
}
|
||||
|
||||
client_box->right = left + texture_width;
|
||||
|
@ -72,8 +72,6 @@ target_sources(
|
||||
util.hpp
|
||||
)
|
||||
|
||||
target_compile_definitions(decklink PRIVATE $<$<PLATFORM_ID:Windows>:NOMINMAX>)
|
||||
|
||||
target_link_libraries(
|
||||
decklink
|
||||
PRIVATE
|
||||
|
@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <QWidget>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define NOMINMAX
|
||||
#include <QWindow>
|
||||
#include <Windows.h>
|
||||
#elif defined(__linux__)
|
||||
|
@ -45,7 +45,7 @@ target_include_directories(
|
||||
)
|
||||
|
||||
target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
|
||||
target_compile_options(libdshowcapture INTERFACE /wd4018)
|
||||
target_compile_options(libdshowcapture INTERFACE /wd4005 /wd4018)
|
||||
|
||||
get_target_property(target_sources libdshowcapture INTERFACE_SOURCES)
|
||||
set(target_headers ${target_sources})
|
||||
|
Loading…
x
Reference in New Issue
Block a user