Commit: 5d67fb0f18291d3aa6ee2bde0972cf90881f187c
Author: Xavier Hallade
Date:   Mon Oct 17 10:06:28 2022 +0200
Branches: master
https://developer.blender.org/rB5d67fb0f18291d3aa6ee2bde0972cf90881f187c

Cycles: oneAPI: fix MSVC_TOOLS_DIR for some build environments

MSVC Tools version doesn't match MSVC Redist version on some systems and
it's not populated when using Ninja outside of Visual Studio shell,
trying another way.

===================================================================

M       intern/cycles/kernel/CMakeLists.txt

===================================================================

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index 36c8b23d983..dfd21c4e675 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -819,12 +819,17 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
     -DONEAPI_EXPORT)
 
     string(REPLACE /Redist/ /Tools/ MSVC_TOOLS_DIR ${MSVC_REDIST_DIR})
-    if(NOT CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) # case for Ninja on 
Windows
+    # Version Folder between Redist and Tools can mismatch sometimes
+    if(NOT EXISTS ${MSVC_TOOLS_DIR})
+      get_filename_component(cmake_ar_dir ${CMAKE_AR} DIRECTORY)
+      get_filename_component(MSVC_TOOLS_DIR "${cmake_ar_dir}/../../../" 
ABSOLUTE)
+    endif()
+    if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
+      set(WINDOWS_KIT_DIR 
${WINDOWS_KITS_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
+    else() # case for Ninja on Windows
       get_filename_component(cmake_mt_dir ${CMAKE_MT} DIRECTORY)
       string(REPLACE /bin/ /Lib/ WINDOWS_KIT_DIR ${cmake_mt_dir})
       get_filename_component(WINDOWS_KIT_DIR "${WINDOWS_KIT_DIR}/../" ABSOLUTE)
-    else()
-      set(WINDOWS_KIT_DIR 
${WINDOWS_KITS_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
     endif()
     list(APPEND sycl_compiler_flags
                 -L "${MSVC_TOOLS_DIR}/lib/x64"

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to