Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-04-19 19:09:05 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-04-21 12:09:06 +0300
commit44e3e541f6b5a774d40909f71cf531d94914d812 (patch)
tree03d2f1364ce44449edbb92bea0f214fabb395c32 /build_files/cmake/platform/platform_old_libs_update.cmake
parentdbd2993230aab79d9a427626554e0317404417a1 (diff)
Build: updates for Blender to build against new 3.2 libraries
Building against the existing 3.1 libraries should continue to work, until the precompiled libraries are committed for all platforms. * Enable WebP by default. * Update Windows for new library file names. * Automatically clear outdated CMake cache variables when upgrading to new libraries. * Fix static library linking order issues on Linux for OpenEXR and OpenVDB. Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel. Ref T95206
Diffstat (limited to 'build_files/cmake/platform/platform_old_libs_update.cmake')
-rw-r--r--build_files/cmake/platform/platform_old_libs_update.cmake37
1 files changed, 37 insertions, 0 deletions
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 00000000000..014aa198caf
--- /dev/null
+++ b/build_files/cmake/platform/platform_old_libs_update.cmake
@@ -0,0 +1,37 @@
+# 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}")
+ unset(${_cache_variable} CACHE)
+ endif()
+ endforeach()
+endfunction()
+
+# Detect update from 3.1 to 3.2 libs.
+if(UNIX AND
+ DEFINED 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")
+ unset_cache_variables("^WEBP")
+endif()
+
+# Automatically set WebP on/off depending if libraries are available.
+if(EXISTS ${LIBDIR}/webp)
+ if(WITH_OPENIMAGEIO)
+ set(WITH_IMAGE_WEBP ON CACHE BOOL "" FORCE)
+ endif()
+else()
+ set(WITH_IMAGE_WEBP OFF)
+endif()