Skip to content

Commit

Permalink
BUG: Ensure packaging of the latest d3dcompiler_47.dll for SlicerVirt…
Browse files Browse the repository at this point in the history
…ualReality

This commit focuses on updating the Qt install rules to ensure the packaging of the
latest version of "d3dcompiler_47.dll". The proper functioning of
"Microsoft.Holographic.Remoting.OpenXr" within the SlicerVirtualReality extension
with OpenXR remoting enabled relies on this update for successful scene rendering.

By setting the `WindowsSdkDir` environment variable, the "windeployqt" tool is
instructed to look up and deploy the library available on the system. This action
prevents the deployment of an older version that may be installed alongside Qt 5.15.2
libraries when Qt is installed using the installer.

Co-authored-by: Alicia Pose <alicia10pose@gmail.com>
Co-authored-by: Amaia Iribar <airibar@vicomtech.org>
Co-authored-by: Felix von Haxthausen <37213426+felixvh@users.noreply.github.com>
Co-authored-by: Monica Garcia-Sevilla <90038097+monicagsevilla@users.noreply.github.com>
  • Loading branch information
5 people committed Feb 5, 2024
1 parent 4efda83 commit 18e071d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions CMake/SlicerBlockInstallQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,33 @@ set(QT_INSTALL_LIB_DIR ${Slicer_INSTALL_LIB_DIR})

set(executable "${Slicer_MAIN_PROJECT_APPLICATION_NAME}App-real.exe")

# Setting the "WindowsSdkDir" env. variable before building the PACKAGE target ensures
# that the "windeployqt" tool can lookup the path of a recent version of the "d3dcompiler_47.dll"
# library in the directory "%WindowsSdkDir%/Redist/D3D/x64"

if(CMAKE_WINDOWS_KITS_10_DIR)
# See https://cmake.org/cmake/help/latest/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.html
# and https://cmake.org/cmake/help/latest/module/InstallRequiredSystemLibraries.html
set(windows_kits_dir "${CMAKE_WINDOWS_KITS_10_DIR}")
elseif(ENV{WindowsSdkDir})
# If building from an environments established by vcvarsall.bat or similar scripts.
set(windows_kits_dir "$ENV{WindowsSdkDir}")
else()
# Default to registry value
# Copied from CMake/Modules/InstallRequiredSystemLibraries.cmake
get_filename_component(windows_kits_dir
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
endif()
if(NOT windows_kits_dir)
message(WARNING "Failed to lookup Windows SDK directory required to package Qt libraries")
endif()
install(
CODE "
set(windows_kits_dir \"${windows_kits_dir}\")
set(ENV{WindowsSdkDir} \${windows_kits_dir})
if(\"\$ENV{WindowsSdkDir}\" STREQUAL \"\")
message(FATAL_ERROR \"Setting WindowsSdkDir env. variable is required to ensure windeployqt can install the most recent version of d3dcompiler_47.dll\")
endif()
set(ENV{PATH} \"${QT_BINARY_DIR};\$ENV{PATH}\")
execute_process(COMMAND \"${windeployqt}\" ${_args} \"\${CMAKE_INSTALL_PREFIX}/bin/${executable}\")
"
Expand Down

0 comments on commit 18e071d

Please sign in to comment.