[Bf-blender-cvs] [12f8f1bfd16] tmp_libupdate_34: Fix failing blender_test on Linux

Brecht Van Lommel noreply at git.blender.org
Tue Aug 16 21:55:46 CEST 2022


Commit: 12f8f1bfd1680be504176846e46f3448c2e16527
Author: Brecht Van Lommel
Date:   Tue Aug 16 21:50:01 2022 +0200
Branches: tmp_libupdate_34
https://developer.blender.org/rB12f8f1bfd1680be504176846e46f3448c2e16527

Fix failing blender_test on Linux

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

M	CMakeLists.txt
M	build_files/cmake/platform/platform_unix.cmake
M	tests/CMakeLists.txt

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ac3e379f5e..ca919fe1a2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -777,6 +777,13 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   endif()
 endif()
 
+# Effective install path including config folder, as a generator expression.
+get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(GENERATOR_IS_MULTI_CONFIG)
+  string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" CMAKE_INSTALL_PREFIX_WITH_CONFIG ${CMAKE_INSTALL_PREFIX})
+else()
+  string(REPLACE "\${BUILD_TYPE}" "" CMAKE_INSTALL_PREFIX_WITH_CONFIG ${CMAKE_INSTALL_PREFIX})
+endif()
 
 
 # Apple
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 43c9a2abbdd..e404a3b105e 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -995,8 +995,13 @@ CONFIGURE_ATOMIC_LIB_IF_NEEDED()
 # For binaries that are built but not installed (like makesdan or tests), we add
 # the original directory of all shared libraries to the rpath. This avoids having
 # to install them as part of the build step.
+#
+# This trick however does not work for executables like blender_test that uses
+# USD and openvdb which have indirect dependencies. For these cases also add the
+# absolute path to where libs will be installed, since they only need to work
+# after the install step.
 set(CMAKE_SKIP_BUILD_RPATH FALSE)
-list(APPEND CMAKE_BUILD_RPATH $ORIGIN/lib ${PLATFORM_BUNDLED_LIBRARY_DIRS})
+list(APPEND CMAKE_BUILD_RPATH $ORIGIN/lib ${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib ${PLATFORM_BUNDLED_LIBRARY_DIRS})
 
 # For the installed Python module and installed Blender executable, we set the
 # rpath to the location where install step will copy the shared libraries.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 484ffd17046..6d1c838ad6d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -5,12 +5,7 @@
 #
 # Getting the install path of the executable is somewhat involved, as there are
 # no direct CMake generator expressions to get the install paths of executables.
-get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
-if(GENERATOR_IS_MULTI_CONFIG)
-  string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
-else()
-  string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
-endif()
+set(TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX_WITH_CONFIG})
 
 # Path to Blender and Python executables for all platforms.
 if(MSVC)



More information about the Bf-blender-cvs mailing list