From 56fcc97f6dc91ca177c384803f4f9657dbd73ae4 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 6 Apr 2023 18:37:45 -0700 Subject: [PATCH 1/2] CMake: Check `WIN32` instead of `CMAKE_SYSTEM_NAME STREQUAL Windows` --- Source/Core/Common/CMakeLists.txt | 2 +- Source/Core/VideoBackends/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 1177363ec3..8269290729 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -299,7 +299,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_link_libraries(common PUBLIC dl rt) endif() -if(CMAKE_SYSTEM_NAME STREQUAL "Windows") +if(WIN32) target_sources(common PRIVATE HRWrap.h HRWrap.cpp) endif() diff --git a/Source/Core/VideoBackends/CMakeLists.txt b/Source/Core/VideoBackends/CMakeLists.txt index 55b44f8c5d..9d20d6d2b5 100644 --- a/Source/Core/VideoBackends/CMakeLists.txt +++ b/Source/Core/VideoBackends/CMakeLists.txt @@ -2,7 +2,7 @@ add_subdirectory(OGL) add_subdirectory(Null) add_subdirectory(Software) -if(CMAKE_SYSTEM_NAME STREQUAL "Windows") +if(WIN32) add_subdirectory(D3DCommon) add_subdirectory(D3D) add_subdirectory(D3D12) From 969d5e0fbeef8cd2e1a6a3a59be53b4569912fd6 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 6 Apr 2023 16:30:34 -0700 Subject: [PATCH 2/2] CMake: Don't include SPIRV-Cross except on Windows and macOS Building it on Linux is unnecessary as Direct3D and Metal are unavailable. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae86d33b42..3904d059d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -693,7 +693,11 @@ endif() add_subdirectory(Externals/imgui) add_subdirectory(Externals/implot) add_subdirectory(Externals/glslang) -add_subdirectory(Externals/spirv_cross) +# SPIRV-Cross is used on Windows for GLSL to HLSL conversion for the Direct3D 11 and Direct3D 12 +# video backends, and on Apple devices for the Metal video backend. +if(WIN32 OR APPLE) + add_subdirectory(Externals/spirv_cross) +endif() if(ENABLE_VULKAN) add_definitions(-DHAS_VULKAN)