Blob Blame History Raw
diff -up libkdcraw-4.10.5/CMakeLists.txt.using-system-libraw libkdcraw-4.10.5/CMakeLists.txt
--- libkdcraw-4.10.5/CMakeLists.txt.using-system-libraw	2013-06-28 19:36:41.947766793 +0200
+++ libkdcraw-4.10.5/CMakeLists.txt	2018-04-18 17:06:45.478621145 +0200
@@ -29,15 +29,22 @@ SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SO
 MESSAGE(STATUS "----------------------------------------------------------------------------------")
 MESSAGE(STATUS "Starting CMake configuration for: libkdcraw")
 
-OPTION(ENABLE_LCMS2    "Link libraw to LCMS2 else LCMS1 (default=OFF)"    OFF)
-OPTION(ENABLE_RAWSPEED "Compile libraw with RawSpeed codec (default=OFF)" OFF)
-
 FIND_PACKAGE(KDE4 REQUIRED)
 INCLUDE(KDE4Defaults)
 INCLUDE(MacroLibrary)
 INCLUDE(MacroOptionalAddSubdirectory)
 INCLUDE(FindPackageHandleStandardArgs)
 
+FIND_PACKAGE(LibRaw 0.14 REQUIRED)
+
+#Check LibRaw Major and Minor version to rules compilation.
+MACRO_ENSURE_VERSION("0.16.0" "${LibRaw_VERSION_STRING}" VERSION_LIBRAW_WITH_CMAKE_SUPPORT)
+MESSAGE(STATUS "LibRaw version: ${LibRaw_VERSION_STRING} - has config file: ${VERSION_LIBRAW_WITH_CMAKE_SUPPORT}")
+
+IF(VERSION_LIBRAW_WITH_CMAKE_SUPPORT)
+    ADD_DEFINITIONS(-DLIBRAW_HAS_CONFIG)
+ENDIF()
+
 ADD_DEFINITIONS (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
 INCLUDE_DIRECTORIES (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
 
@@ -106,7 +113,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C
 
 # ==================================================================================================
 
-ADD_SUBDIRECTORY(libraw)
 ADD_SUBDIRECTORY(libkdcraw)
 ADD_SUBDIRECTORY(test)
 ADD_SUBDIRECTORY(icons)
diff -up libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake.using-system-libraw libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake
--- libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake.using-system-libraw	2018-04-18 16:57:12.966314267 +0200
+++ libkdcraw-4.10.5/cmake/modules/FindLibRaw.cmake	2018-04-18 17:08:34.597629174 +0200
@@ -0,0 +1,79 @@
+# - Find LibRaw
+# Find the LibRaw library <http://www.libraw.org>
+# This module defines
+#  LibRaw_VERSION_STRING, the version string of LibRaw
+#  LibRaw_INCLUDE_DIR, where to find libraw.h
+#  LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe)
+#  LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe)
+#  LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe)
+#  LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe)
+#
+# Copyright (c) 2013, Pino Toscano <pino at kde dot org>
+# Copyright (c) 2013, Gilles Caulier <caulier dot gilles at gmail dot com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+FIND_PACKAGE(PkgConfig)
+
+IF(PKG_CONFIG_FOUND)
+   PKG_CHECK_MODULES(PC_LIBRAW libraw)
+   SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
+
+   PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r)
+   SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})   
+ENDIF()
+
+FIND_PATH(LibRaw_INCLUDE_DIR libraw.h
+          HINTS
+          ${PC_LIBRAW_INCLUDEDIR}
+          ${PC_LibRaw_INCLUDE_DIRS}
+          PATH_SUFFIXES libraw
+         )
+
+FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw
+             HINTS
+             ${PC_LIBRAW_LIBDIR}
+             ${PC_LIBRAW_LIBRARY_DIRS}
+            )
+
+FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r
+             HINTS
+             ${PC_LIBRAW_R_LIBDIR}
+             ${PC_LIBRAW_R_LIBRARY_DIRS}
+            )
+
+IF(LibRaw_INCLUDE_DIR)
+   FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content)
+   
+   STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
+   SET(_libraw_version_major "${CMAKE_MATCH_1}")
+   
+   STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content})
+   SET(_libraw_version_minor "${CMAKE_MATCH_1}")
+   
+   STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
+   SET(_libraw_version_patch "${CMAKE_MATCH_1}")
+   
+   IF(_version_major_match AND _version_minor_match AND _version_patch_match)
+      SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}")
+   ELSE()
+      IF(NOT LibRaw_FIND_QUIETLY)
+         MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h")
+      ENDIF()
+   ENDIF()
+ENDIF()
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw
+                                  REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR
+                                  VERSION_VAR LibRaw_VERSION_STRING
+                                 )
+
+MARK_AS_ADVANCED(LibRaw_VERSION_STRING
+                 LibRaw_INCLUDE_DIR
+                 LibRaw_LIBRARIES
+                 LibRaw_r_LIBRARIES
+                 LibRaw_DEFINITIONS
+                 LibRaw_r_DEFINITIONS
+                 )
diff -up libkdcraw-4.10.5/libkdcraw/CMakeLists.txt.using-system-libraw libkdcraw-4.10.5/libkdcraw/CMakeLists.txt
--- libkdcraw-4.10.5/libkdcraw/CMakeLists.txt.using-system-libraw	2013-06-28 19:36:41.947766793 +0200
+++ libkdcraw-4.10.5/libkdcraw/CMakeLists.txt	2018-04-18 17:04:31.919279255 +0200
@@ -22,7 +22,27 @@
 #
 # ============================================================
 
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libraw)
+# In some versions LibRaw is not linked against OpenMP stuff,
+# so manually link libkdcraw against it for now.
+
+IF(NOT APPLE)
+    # OpenMP library detection (requires CMake >= 2.6.3)
+    # NOTE: OpenMP under MacOSX do not support multithreading.
+
+    MACRO_OPTIONAL_FIND_PACKAGE(OpenMP)
+
+    IF(OPENMP_FOUND)
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+        IF("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp")
+            SET(OPENMP_LDFLAGS "-lgomp")
+        ENDIF("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp")
+        IF("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp")
+            SET(OPENMP_LDFLAGS "-xopenmp")
+        ENDIF("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp")
+    ENDIF(OPENMP_FOUND)
+ENDIF(NOT APPLE)
+
+INCLUDE_DIRECTORIES(${LibRaw_INCLUDE_DIR})
 
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
 
@@ -42,15 +62,15 @@ SET(kdcraw_LIB_SRCS kdcraw.cpp
 KDE4_ADD_LIBRARY(kdcraw SHARED ${kdcraw_LIB_SRCS})
 
 TARGET_LINK_LIBRARIES(kdcraw
-                      libraw
+                      ${LibRaw_LIBRARIES}
                       ${KDE4_KDEUI_LIBS}
                       ${KDE4_KIO_LIBS}
                       ${KDE4_SOLID_LIBS}
                       ${KDE4_THREADWEAVER_LIBRARIES}
+                      ${OPENMP_LDFLAGS}
                      )
 
-SET_TARGET_PROPERTIES(kdcraw PROPERTIES VERSION ${DCRAW_LIB_SO_VERSION_STRING} SOVERSION ${DCRAW_LIB_SO_CUR_VERSION}
-                                        DEFINE_SYMBOL LIBRAW_BUILDLIB)
+SET_TARGET_PROPERTIES(kdcraw PROPERTIES VERSION ${DCRAW_LIB_SO_VERSION_STRING} SOVERSION ${DCRAW_LIB_SO_CUR_VERSION})
 
 INSTALL(TARGETS kdcraw ${INSTALL_TARGETS_DEFAULT_ARGS})
 
diff -up libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h.using-system-libraw libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h
--- libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h.using-system-libraw	2013-06-28 19:36:41.915766633 +0200
+++ libkdcraw-4.10.5/libkdcraw/libkdcraw_export.h	2018-04-18 16:57:12.967314240 +0200
@@ -31,7 +31,7 @@
 #include <kdemacros.h>
 
 #ifndef LIBKDCRAW_EXPORT
-# if defined(LIBRAW_BUILDLIB)
+# if defined(MAKE_KDCRAW_LIB)
    /* We are building this library */ 
 #  define LIBKDCRAW_EXPORT KDE_EXPORT
 # else
diff -up libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp.orig libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp
--- libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp.orig	2018-04-24 11:29:13.968446472 +0200
+++ libkdcraw-4.10.5/libkdcraw/dcrawsettingswidget.cpp	2018-04-24 11:29:53.254558248 +0200
@@ -1227,6 +1227,7 @@ RawDecodingSettings DcrawSettingsWidget:
         {
             prm.NRThreshold     = d->NRSpinBox1->value();
             prm.NRChroThreshold = 0;
+            break;
         }
         default:    // IMPULSENR
         {
diff -up libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp.orig libkdcraw-4.10.5/libraw/src/libraw_cxx.cpp