Page MenuHome
Paste P2897

(An Untitled Masterwork)
ActivePublic

Authored by Brecht Van Lommel (brecht) on Apr 19 2022, 12:21 AM.
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index 43ce230..2fbab73 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -71,6 +71,8 @@ set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
# Find precompiled libraries, and avoid system or user-installed ones.
if(EXISTS ${LIBDIR})
+ include(platform_old_libs_update)
+
without_system_libs_begin()
endif()
diff --git a/build_files/cmake/platform/platform_old_libs_update.cmake b/build_files/cmake/platform/platform_old_libs_update.cmake
new file mode 100644
index 0000000..cb548b1
--- /dev/null
+++ b/build_files/cmake/platform/platform_old_libs_update.cmake
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright 2022 Blender Foundation. All rights reserved.
+
+# Auto update existing CMake caches for new libraries
+
+function(unset_cache_variables pattern)
+ get_cmake_property(_cache_variables CACHE_VARIABLES)
+ foreach (_cache_variable ${_cache_variables})
+ if("${_cache_variable}" MATCHES "${pattern}")
+ message(STATUS "${_cache_variable} vs ${pattern}")
+ unset(${_cache_variable} CACHE)
+ endif()
+ endforeach()
+endfunction()
+
+# Detect update from 3.1 to 3.2 libs.
+if(OPENEXR_VERSION AND ${OPENEXR_VERSION} VERSION_LESS "3.0.0" AND EXISTS ${LIBDIR}/imath)
+ message(STATUS "Auto updating CMake configuration for Blender 3.2 libraries")
+
+ unset_cache_variables("^OPENIMAGEIO")
+ unset_cache_variables("^OPENEXR")
+ unset_cache_variables("^IMATH")
+ unset_cache_variables("^PNG")
+ unset_cache_variables("^USD")
+ if(WITH_OPENIMAGEIO)
+ set(WITH_IMAGE_WEBP ON FORCE)
+ endif()
+endif()
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index cc16847..0704ca0 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -57,6 +57,8 @@ if(EXISTS ${LIBDIR})
set(Boost_NO_SYSTEM_PATHS ON)
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
set(CLANG_ROOT_DIR ${LIBDIR}/llvm)
+
+ include(platform_old_libs_update)
endif()
if(WITH_STATIC_LIBS)

Event Timeline

Brecht Van Lommel (brecht) edited the content of this paste. (Show Details)
Brecht Van Lommel (brecht) edited the content of this paste. (Show Details)