Commit 6c91e18c authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

Add support of libraw release < 0.16.0

Minimum version supported are 0.14.x, but with minimum support of extra options from Libraw, as RawSpeed codec support, LCMS support, GPL2 and GPL3 packs supports, etc...
All these options are registered and shared into a new libraw_config.h with 0.16.0, which do not exist in previous release.
CCBUGS: 307146
parent 0d9bdbb7
......@@ -35,8 +35,17 @@ INCLUDE(MacroLibrary)
INCLUDE(MacroOptionalAddSubdirectory)
INCLUDE(FindPackageHandleStandardArgs)
# NOTE: Libraw 0.16.0 is ported to Cmake and will work fine.
FIND_PACKAGE(LibRaw 0.16 REQUIRED)
# NOTE: Libraw 0.16.x is prefered version to use because it's ported to Cmake with full features supported.
# Until libraw 0.16.0 is release (ends of 2013), we will support previous version (with limited support)
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}
......
# - 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
)
......@@ -39,7 +39,10 @@
// LibRaw includes
#include <libraw_version.h>
#ifdef LIBRAW_HAS_CONFIG
#include <libraw_config.h>
#endif
// Local includes
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment