File Support-building-with-OpenEXR-3.patch of Package kdelibs4

From 2429c9533621d32f4ab5350856945cc0ad659ae5 Mon Sep 17 00:00:00 2001
From: Antonio Rojas <arojas@archlinux.org>
Date: Sat, 24 Apr 2021 10:17:25 +0000
Subject: [PATCH] Support building with OpenEXR 3

Try to find OpenEXR 3 first via the upstream cmake config and fallback to using our FindOpenEXR
---
 CMakeLists.txt                  | 5 ++++-
 src/imageformats/CMakeLists.txt | 6 +++++-
 src/imageformats/exr.cpp        | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/kimgio/CMakeLists.txt b/kimgio/CMakeLists.txt
--- a/kimgio/CMakeLists.txt
+++ b/kimgio/CMakeLists.txt
@@ -7,7 +7,12 @@
                        TYPE OPTIONAL
                       )
 
-macro_optional_find_package(OpenEXR)
+find_package(OpenEXR 3.0 CONFIG QUIET)
+if(NOT OpenEXR_FOUND)
+    macro_optional_find_package(OpenEXR)
+else()
+    set(OPENEXR_FOUND TRUE)
+endif()
 set_package_properties(OpenEXR PROPERTIES DESCRIPTION "Support for OpenEXR images"
                        URL "http://www.openexr.com"
                        TYPE OPTIONAL
@@ -107,11 +112,17 @@
 ##################################
 
 if(OPENEXR_FOUND)
-    include_directories( ${CMAKE_SOURCE_DIR}/kio ${OPENEXR_INCLUDE_DIR} )
+    include_directories( ${CMAKE_SOURCE_DIR}/kio )
     add_definitions(${OPENEXR_DEFINITIONS})
     set(kimg_exr_LIB_SRCS exr.cpp)
     kde4_add_plugin(kimg_exr ${kimg_exr_LIB_SRCS})
-    target_link_libraries(kimg_exr ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${OPENEXR_LIBRARIES} )
+    target_link_libraries(kimg_exr ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY})
+    if(TARGET OpenEXR::OpenEXR)
+        target_link_libraries(kimg_exr OpenEXR::OpenEXR)
+    else()
+        include_directories( ${OPENEXR_INCLUDE_DIR} )
+        target_link_libraries(kimg_exr ${OPENEXR_LIBRARIES})
+    endif()

 install(TARGETS kimg_exr  DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/imageformats/ )
 install( FILES exr.desktop DESTINATION  ${SERVICES_INSTALL_DIR}/qimageioplugins/ )
diff --git a/kimgio/exr.cpp b/kimgio/exr.cpp
--- a/kimgio/exr.cpp
+++ b/kimgio/exr.cpp
@@ -20,6 +20,7 @@
 #include <ImfChannelListAttribute.h>
 #include <ImfCompressionAttribute.h>
 #include <ImfFloatAttribute.h>
+#include <ImfInt64.h>
 #include <ImfIntAttribute.h>
 #include <ImfLineOrderAttribute.h>
 #include <ImfStringAttribute.h>
-- 
GitLab

openSUSE Build Service is sponsored by