blender/build_files/build_environment/patches/openexr_deflate_cmake.diff
Sebastian Parborg 0243d0c2fa Deps: Fix fragile openexr dependency linking
When working on the 5.1 library updates, I noticed that quite a few places in Blender where OpenEXR (and libraries depending on OpenEXR) didn't really seem to pull in all of the required libraries properly.
While we are working around this currently, I felt like actually doing the proper thing and using the new cmake libraries interfaces would be the best way forward as we then can rely on them pulling in all needed dependencies by themselves.

To be able to use the .cmake files, two patches are needed:

1. `openexr_deflate_cmake.diff`:
This fixes the cmake install targets to not require libdeflate if it has been complied into openexr as a static library.
2. `osl_relative_inc_cmake.diff`:
This makes it so the library targets no longer uses absolute paths for the include directories. They now use relative paths so that they can be relocated properly.

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Co-authored-by: Jonas Holzman <jonas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/153424
2026-02-05 23:10:02 +01:00

29 lines
1.1 KiB
Diff

Fix openexr trying to pull in libdeflate even if it has been included as a
static library.
diff -Naur openexr/cmake/OpenEXRConfig.cmake.in openexr/cmake/OpenEXRConfig.cmake.in
--- openexr/cmake/OpenEXRConfig.cmake.in 2026-01-16 13:44:08.143001800 -0800
+++ openexr/cmake/OpenEXRConfig.cmake.in 2026-01-21 15:51:39.475353400 -0800
@@ -14,7 +14,7 @@
find_dependency(Imath)
-if (@libdeflate_FOUND@)
+if (@libdeflate_FOUND@ AND @EXR_DEFLATE_SHARED@)
find_dependency(libdeflate)
endif()
diff -Naur openexr/cmake/OpenEXRSetup.cmake openexr/cmake/OpenEXRSetup.cmake
--- openexr/cmake/OpenEXRSetup.cmake 2026-01-16 13:44:08.143001800 -0800
+++ openexr/cmake/OpenEXRSetup.cmake 2026-01-21 15:51:28.225418400 -0800
@@ -212,8 +212,10 @@
if(libdeflate_FOUND)
if(TARGET libdeflate::libdeflate_shared)
set(EXR_DEFLATE_LIB libdeflate::libdeflate_shared)
+ set(EXR_DEFLATE_SHARED 1)
else()
set(EXR_DEFLATE_LIB libdeflate::libdeflate_static)
+ set(EXR_DEFLATE_SHARED 0)
endif()
set(EXR_DEFLATE_VERSION ${libdeflate_VERSION})
message(STATUS "Using libdeflate from ${libdeflate_DIR}")