aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@users.noreply.github.com>2024-05-07 08:47:29 +1000
committerGitHub <noreply@github.com>2024-05-07 08:47:29 +1000
commitc2d154f620fa3a0ff7bf861672d98e3bdf1db1e2 (patch)
treec9effb51a6fe04767fc1cf28feb5df7c8872f179
parent4db6d25602dc76b4567555c80ff520b2ca4494b2 (diff)
parent170d78258673bf78565b29cbd7a342ff4d123c34 (diff)
downloadxbmc-c2d154f620fa3a0ff7bf861672d98e3bdf1db1e2.tar.xz
Merge pull request #25141 from fuzzard/cmake_effectscompiler
[cmake] Move Windows Effect Compiler find module to buildtools
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/modules/FindD3DX11Effects.cmake16
-rw-r--r--cmake/modules/buildtools/FindEffectsCompiler.cmake32
-rw-r--r--cmake/platform/windows/windows.cmake3
-rw-r--r--cmake/platform/windowsstore/windowsstore.cmake2
-rw-r--r--xbmc/guilib/CMakeLists.txt10
6 files changed, 42 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f0253ee10..01acbbf3f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,6 +185,7 @@ endforeach()
set(required_buildtools FlatC
JsonSchemaBuilder
TexturePacker
+ ${PLATFORM_REQUIRED_TOOLS}
)
# Optional build tools
diff --git a/cmake/modules/FindD3DX11Effects.cmake b/cmake/modules/FindD3DX11Effects.cmake
deleted file mode 100644
index 0a43fd3807..0000000000
--- a/cmake/modules/FindD3DX11Effects.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-# - Finds D3DX11 dependencies
-# Once done this will define
-#
-# FXC - Path to the DirectX Effects Compiler (FXC)
-
-find_program(FXC fxc
- PATHS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/x86"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;ProductVersion].0/x86"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/bin/x86"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/bin/x86"
- "$ENV{WindowsSdkDir}bin/x86")
-if(NOT FXC)
- message(WARNING "Could NOT find DirectX Effects Compiler (FXC)")
-endif()
-mark_as_advanced(FXC)
diff --git a/cmake/modules/buildtools/FindEffectsCompiler.cmake b/cmake/modules/buildtools/FindEffectsCompiler.cmake
new file mode 100644
index 0000000000..49d5b0331f
--- /dev/null
+++ b/cmake/modules/buildtools/FindEffectsCompiler.cmake
@@ -0,0 +1,32 @@
+# FindEffectsCompiler
+# --------
+# Find the DirectX Effects Compiler Tool
+#
+# This will define the following target:
+#
+# windows::FXC - The FXC compiler
+
+if(NOT windows::FXC)
+ find_program(FXC_EXECUTABLE fxc
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/x86"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;ProductVersion].0/x86"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/bin/x86"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/bin/x86"
+ "$ENV{WindowsSdkDir}bin/x86")
+
+ if(FXC_EXECUTABLE)
+
+ include(FindPackageMessage)
+ find_package_message(EffectsCompiler "Found DX Effects Compiler Tool (FXC): ${FXC_EXECUTABLE}" "[${FXC_EXECUTABLE}]")
+
+ add_executable(windows::FXC IMPORTED)
+ set_target_properties(windows::FXC PROPERTIES
+ IMPORTED_LOCATION "${FXC_EXECUTABLE}"
+ FOLDER "External Projects")
+ else()
+ if(EffectsCompiler_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find DirectX Effects Compiler (FXC)")
+ endif()
+ endif()
+endif()
diff --git a/cmake/platform/windows/windows.cmake b/cmake/platform/windows/windows.cmake
index b3dc4d24e4..9c11474e97 100644
--- a/cmake/platform/windows/windows.cmake
+++ b/cmake/platform/windows/windows.cmake
@@ -1,4 +1,5 @@
-set(PLATFORM_REQUIRED_DEPS D3DX11Effects Detours)
+set(PLATFORM_REQUIRED_DEPS Detours)
+set(PLATFORM_REQUIRED_TOOLS EffectsCompiler)
set(APP_RENDER_SYSTEM dx11)
list(APPEND PLATFORM_DEFINES -DNTDDI_VERSION=NTDDI_WINBLUE -D_WIN32_WINNT=_WIN32_WINNT_WINBLUE)
diff --git a/cmake/platform/windowsstore/windowsstore.cmake b/cmake/platform/windowsstore/windowsstore.cmake
index 6fa4687720..1e5bb81d5c 100644
--- a/cmake/platform/windowsstore/windowsstore.cmake
+++ b/cmake/platform/windowsstore/windowsstore.cmake
@@ -1,4 +1,4 @@
-set(PLATFORM_REQUIRED_DEPS D3DX11Effects)
+set(PLATFORM_REQUIRED_TOOLS EffectsCompiler)
set(PLATFORM_OPTIONAL_DEPS_EXCLUDE CEC)
set(APP_RENDER_SYSTEM dx11)
diff --git a/xbmc/guilib/CMakeLists.txt b/xbmc/guilib/CMakeLists.txt
index a4c3957f55..5d598cbad3 100644
--- a/xbmc/guilib/CMakeLists.txt
+++ b/xbmc/guilib/CMakeLists.txt
@@ -212,8 +212,9 @@ if(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore)
foreach(shader ${SHADERS_VERTEX})
get_filename_component(file ${shader} NAME_WE)
add_custom_command(OUTPUT ${file}.h
- COMMAND ${FXC} /Fh ${file}.h /E VS /T vs_4_0_level_9_1 /Vn ${file} /Qstrip_reflect
- ${CMAKE_SOURCE_DIR}/system/shaders/${shader}
+ COMMAND windows::FXC
+ ARGS /Fh ${file}.h /E VS /T vs_4_0_level_9_1 /Vn ${file} /Qstrip_reflect
+ ${CMAKE_SOURCE_DIR}/system/shaders/${shader}
DEPENDS ${CMAKE_SOURCE_DIR}/system/shaders/${shader}
COMMENT "FX compile vertex shader ${shader}"
VERBATIM)
@@ -222,8 +223,9 @@ if(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore)
foreach(shader ${SHADERS_PIXEL})
get_filename_component(file ${shader} NAME_WE)
add_custom_command(OUTPUT ${file}.h
- COMMAND ${FXC} /Fh ${file}.h /E PS /T ps_4_0_level_9_1 /Vn ${file} /Qstrip_reflect
- ${CMAKE_SOURCE_DIR}/system/shaders/${shader}
+ COMMAND windows::FXC
+ ARGS /Fh ${file}.h /E PS /T ps_4_0_level_9_1 /Vn ${file} /Qstrip_reflect
+ ${CMAKE_SOURCE_DIR}/system/shaders/${shader}
DEPENDS ${CMAKE_SOURCE_DIR}/system/shaders/${shader}
COMMENT "FX compile pixel shader ${shader}"
VERBATIM)