[Bf-blender-cvs] [86ec9d79eca] master: Fix build without Cycles HIP device

Brecht Van Lommel noreply at git.blender.org
Tue Sep 28 20:01:44 CEST 2021


Commit: 86ec9d79eca2a31044a5096df5d5ee244d15708d
Author: Brecht Van Lommel
Date:   Tue Sep 28 19:55:25 2021 +0200
Branches: master
https://developer.blender.org/rB86ec9d79eca2a31044a5096df5d5ee244d15708d

Fix build without Cycles HIP device

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

M	extern/CMakeLists.txt
M	intern/cycles/cmake/external_libs.cmake
M	intern/cycles/cmake/macros.cmake
M	intern/cycles/device/CMakeLists.txt
M	intern/cycles/kernel/CMakeLists.txt

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

diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 2b2cca04503..1fdc8e60167 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -67,10 +67,10 @@ endif()
 
 if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
   add_subdirectory(clew)
-  if(WITH_CUDA_DYNLOAD)
+  if((WITH_CYCLES_DEVICE_CUDA OR WITH_CYCLES_DEVICE_OPTIX) AND WITH_CUDA_DYNLOAD)
     add_subdirectory(cuew)
   endif()
-  if(WITH_HIP_DYNLOAD)
+  if(WITH_CYCLES_DEVICE_HIP AND WITH_HIP_DYNLOAD)
     add_subdirectory(hipew)
   endif()
 endif()
diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
index 5653f51ec05..b966edd4298 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -531,8 +531,13 @@ if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
     endif()
   endif()
 endif()
+
+
+###########################################################################
+# HIP
+###########################################################################
+
 if(NOT WITH_HIP_DYNLOAD)
-  message(STATUS "Setting up HIP Dynamic Load")
   set(WITH_HIP_DYNLOAD ON)
 endif()
 
diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake
index 172ae280cea..a470fb9c574 100644
--- a/intern/cycles/cmake/macros.cmake
+++ b/intern/cycles/cmake/macros.cmake
@@ -156,13 +156,15 @@ macro(cycles_target_link_libraries target)
     ${PLATFORM_LINKLIBS}
   )
 
-  if(WITH_CUDA_DYNLOAD)
-    target_link_libraries(${target} extern_cuew)
-  else()
-    target_link_libraries(${target} ${CUDA_CUDA_LIBRARY})
+  if(WITH_CYCLES_DEVICE_CUDA OR WITH_CYCLES_DEVICE_OPTIX)
+    if(WITH_CUDA_DYNLOAD)
+      target_link_libraries(${target} extern_cuew)
+    else()
+      target_link_libraries(${target} ${CUDA_CUDA_LIBRARY})
+    endif()
   endif()
 
-  if(WITH_HIP_DYNLOAD)
+  if(WITH_CYCLES_DEVICE_HIP AND WITH_HIP_DYNLOAD)
     target_link_libraries(${target} extern_hipew)
   endif()
 
diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt
index 9af68550d17..6d33a6f107f 100644
--- a/intern/cycles/device/CMakeLists.txt
+++ b/intern/cycles/device/CMakeLists.txt
@@ -22,19 +22,21 @@ set(INC_SYS
   ../../../extern/clew/include
 )
 
-if(WITH_CUDA_DYNLOAD)
-  list(APPEND INC
-    ../../../extern/cuew/include
-  )
-  add_definitions(-DWITH_CUDA_DYNLOAD)
-else()
-  list(APPEND INC_SYS
-    ${CUDA_TOOLKIT_INCLUDE}
-  )
-  add_definitions(-DCYCLES_CUDA_NVCC_EXECUTABLE="${CUDA_NVCC_EXECUTABLE}")
+if(WITH_CYCLES_DEVICE_OPTIX OR WITH_CYCLES_DEVICE_CUDA)
+  if(WITH_CUDA_DYNLOAD)
+    list(APPEND INC
+      ../../../extern/cuew/include
+    )
+    add_definitions(-DWITH_CUDA_DYNLOAD)
+  else()
+    list(APPEND INC_SYS
+      ${CUDA_TOOLKIT_INCLUDE}
+    )
+    add_definitions(-DCYCLES_CUDA_NVCC_EXECUTABLE="${CUDA_NVCC_EXECUTABLE}")
+  endif()
 endif()
 
-if(WITH_HIP_DYNLOAD)
+if(WITH_CYCLES_DEVICE_HIP AND WITH_HIP_DYNLOAD)
   list(APPEND INC
     ../../../extern/hipew/include
   )
@@ -127,17 +129,19 @@ set(LIB
   ${CYCLES_GL_LIBRARIES}
 )
 
-if(WITH_CUDA_DYNLOAD)
-  list(APPEND LIB
-    extern_cuew
-  )
-else()
-  list(APPEND LIB
-    ${CUDA_CUDA_LIBRARY}
-  )
+if(WITH_CYCLES_DEVICE_OPTIX OR WITH_CYCLES_DEVICE_CUDA)
+  if(WITH_CUDA_DYNLOAD)
+    list(APPEND LIB
+      extern_cuew
+    )
+  else()
+    list(APPEND LIB
+      ${CUDA_CUDA_LIBRARY}
+    )
+  endif()
 endif()
 
-if(WITH_HIP_DYNLOAD)
+if(WITH_CYCLES_DEVICE_HIP AND WITH_HIP_DYNLOAD)
   list(APPEND LIB
     extern_hipew
   )
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 8c2cb2c68de..7b56216e887 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -542,7 +542,7 @@ if(WITH_CYCLES_HIP_BINARIES)
         -D WITH_NANOVDB
         -I "${NANOVDB_INCLUDE_DIR}")
     endif()
-
+  endmacro()
 
   set(prev_arch "none")
   foreach(arch ${CYCLES_HIP_BINARIES_ARCH})



More information about the Bf-blender-cvs mailing list