Warning, /graphics/krita/3rdparty/ext_libraw/0001-LibRaw-cmake.patch is written in an unsupported language. File is not indexed.
0001 From ca53730ea40e56f58bf7ec77fcc6247ab6e2efa3 Mon Sep 17 00:00:00 2001
0002 From: "L. E. Segovia" <amy@amyspark.me>
0003 Date: Sun, 21 Feb 2021 00:13:50 +0000
0004 Subject: [PATCH 1/2] LibRaw-cmake
0005
0006 ---
0007 CMakeLists.txt | 718 +++++++++++++++++++
0008 INSTALL.CMAKE | 62 ++
0009 LICENSE | 22 +
0010 cmake/data/libraw.lsm.cmake | 13 +
0011 cmake/data/libraw.pc.cmake | 12 +
0012 cmake/data/libraw_config.h.cmake | 50 ++
0013 cmake/data/libraw_r.pc.cmake | 12 +
0014 cmake/modules/FindLCMS.cmake | 60 ++
0015 cmake/modules/FindLCMS2.cmake | 72 ++
0016 cmake/modules/FindLibRaw.cmake | 96 +++
0017 cmake/modules/MacroBoolTo01.cmake | 20 +
0018 cmake/modules/MacroLogFeature.cmake | 159 ++++
0019 cmake/modules/MacroOptionalFindPackage.cmake | 48 ++
0020 cmake/modules/Uninstall.cmake | 22 +
0021 14 files changed, 1366 insertions(+)
0022 create mode 100644 CMakeLists.txt
0023 create mode 100644 INSTALL.CMAKE
0024 create mode 100644 LICENSE
0025 create mode 100644 cmake/data/libraw.lsm.cmake
0026 create mode 100644 cmake/data/libraw.pc.cmake
0027 create mode 100644 cmake/data/libraw_config.h.cmake
0028 create mode 100644 cmake/data/libraw_r.pc.cmake
0029 create mode 100644 cmake/modules/FindLCMS.cmake
0030 create mode 100644 cmake/modules/FindLCMS2.cmake
0031 create mode 100644 cmake/modules/FindLibRaw.cmake
0032 create mode 100644 cmake/modules/MacroBoolTo01.cmake
0033 create mode 100644 cmake/modules/MacroLogFeature.cmake
0034 create mode 100644 cmake/modules/MacroOptionalFindPackage.cmake
0035 create mode 100644 cmake/modules/Uninstall.cmake
0036
0037 diff --git a/CMakeLists.txt b/CMakeLists.txt
0038 new file mode 100644
0039 index 0000000..948a0a0
0040 --- /dev/null
0041 +++ b/CMakeLists.txt
0042 @@ -0,0 +1,718 @@
0043 +# ===========================================================
0044 +#
0045 +# This file is a part of Libraw project
0046 +# <a href="http://www.libraw.org">http://www.libraw.org</a>
0047 +#
0048 +# @date 2013-09-07
0049 +# @brief Library for reading and processing of RAW images
0050 +#
0051 +# @author Copyright (C) 2013 by Gilles Caulier
0052 +# <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
0053 +#
0054 +# This program is free software; you can redistribute it
0055 +# and/or modify it under the terms of the GNU General
0056 +# Public License as published by the Free Software Foundation;
0057 +# either version 2, or (at your option)
0058 +# any later version.
0059 +#
0060 +# This program is distributed in the hope that it will be useful,
0061 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
0062 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0063 +# GNU General Public License for more details.
0064 +#
0065 +# ============================================================
0066 +
0067 +CMAKE_MINIMUM_REQUIRED(VERSION 3.12..16)
0068 +
0069 +
0070 +# Determine if libraw is built as a subproject (using add_subdirectory)
0071 +# or if it is the master project.
0072 +set(MASTER_PROJECT OFF)
0073 +if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
0074 + set(MASTER_PROJECT ON)
0075 + message(STATUS "CMake version: ${CMAKE_VERSION}")
0076 +endif ()
0077 +
0078 +set(LIBRAW_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Relative path to libraw directory (default=CMAKE_CURRENT_SOURCE_DIR)")
0079 +if(NOT EXISTS "${LIBRAW_PATH}")
0080 + message(STATUS "LIBRAW_PATH=${LIBRAW_PATH}")
0081 + message(FATAL_ERROR "LIBRAW_PATH does not contain a valid path to the libraw home")
0082 +endif()
0083 +
0084 +file(TO_CMAKE_PATH "${LIBRAW_PATH}" LIBRAW_PATH)
0085 +
0086 +# ==================================================================================================
0087 +# Library version info extraction
0088 +
0089 +FILE(READ ${LIBRAW_PATH}/libraw/libraw_version.h _libraw_version_content)
0090 +
0091 +# API version strings
0092 +STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
0093 +SET(RAW_LIB_MAJOR_VERSION "${CMAKE_MATCH_1}")
0094 +
0095 +STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content})
0096 +SET(RAW_LIB_MINOR_VERSION "${CMAKE_MATCH_1}")
0097 +
0098 +STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
0099 +SET(RAW_LIB_PATCH_VERSION "${CMAKE_MATCH_1}")
0100 +
0101 +# ABI version strings
0102 +
0103 +STRING(REGEX MATCH "#define LIBRAW_SHLIB_CURRENT[ \t]*([0-9]*)\n" _version_socur_match ${_libraw_version_content})
0104 +SET(RAW_LIB_SO_CUR_VERSION "${CMAKE_MATCH_1}")
0105 +
0106 +STRING(REGEX MATCH "#define LIBRAW_SHLIB_REVISION[ \t]*([0-9]*)\n" _version_sorev_match ${_libraw_version_content})
0107 +SET(RAW_LIB_SO_REV_VERSION "${CMAKE_MATCH_1}")
0108 +
0109 +STRING(REGEX MATCH "#define LIBRAW_SHLIB_AGE[ \t]*([0-9]*)\n" _version_soage_match ${_libraw_version_content})
0110 +SET(RAW_LIB_SO_AGE_VERSION "${CMAKE_MATCH_1}")
0111 +
0112 +# Set env. variables accordinly.
0113 +SET(RAW_LIB_VERSION_STRING "${RAW_LIB_MAJOR_VERSION}.${RAW_LIB_MINOR_VERSION}.${RAW_LIB_PATCH_VERSION}")
0114 +SET(RAW_LIB_VERSION_ID "0x${RAW_LIB_MAJOR_VERSION}${RAW_LIB_MINOR_VERSION}${RAW_LIB_PATCH_VERSION}")
0115 +SET(RAW_LIB_SO_VERSION_STRING "${RAW_LIB_SO_CUR_VERSION}.${RAW_LIB_SO_REV_VERSION}.${RAW_LIB_SO_AGE_VERSION}")
0116 +
0117 +MESSAGE(STATUS "LibRaw string version: ${RAW_LIB_VERSION_STRING}")
0118 +MESSAGE(STATUS "LibRaw ID version: ${RAW_LIB_VERSION_ID}")
0119 +MESSAGE(STATUS "LibRaw SO version: ${RAW_LIB_SO_VERSION_STRING}")
0120 +
0121 +project(libraw VERSION ${RAW_LIB_VERSION_STRING} LANGUAGES CXX)
0122 +
0123 +# ==================================================================================================
0124 +# Project Options
0125 +OPTION(BUILD_SHARED_LIBS "Build library as shared library (default=ON)" ON)
0126 +OPTION(ENABLE_OPENMP "Build library with OpenMP support (default=ON)" ON)
0127 +OPTION(ENABLE_LCMS "Build library with LCMS support (default=ON)" ON)
0128 +OPTION(ENABLE_JASPER "Build library with libjasper support (default=ON)" ON)
0129 +OPTION(ENABLE_EXAMPLES "Build library with sample command-line programs (default=ON)" ${MASTER_PROJECT})
0130 +OPTION(ENABLE_RAWSPEED "Build library with extra RawSpeed codec support (default=OFF)" OFF)
0131 +OPTION(ENABLE_DCRAW_DEBUG "Build library with debug message from dcraw (default=OFF)" OFF)
0132 +OPTION(ENABLE_X3FTOOLS "Build library with Foveon X3F support (default=OFF)" OFF)
0133 +OPTION(ENABLE_6BY9RPI "Build library with Raspberry Pi RAW support (default=OFF)" OFF)
0134 +option(LIBRAW_UNINSTALL_TARGET "Add a custom target to ease removal of installed targets" ${MASTER_PROJECT})
0135 +option(LIBRAW_INSTALL "Generate the install target." ${MASTER_PROJECT})
0136 +
0137 +SET(RAWSPEED_RPATH "RawSpeed" CACHE STRING
0138 + "Relative path to extra RawSpeed codec (default=RawSpeed)")
0139 +
0140 +SET(RAWSPEED_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${RAWSPEED_RPATH}")
0141 +
0142 +SET(INSTALL_CMAKE_MODULE_PATH "share/libraw/cmake" CACHE STRING
0143 + "Path to install cmake module (default=share/libraw/cmake)")
0144 +
0145 +# ==================================================================================================
0146 +# General definitions rules
0147 +
0148 +SET(LIB_SUFFIX "" CACHE STRING "Define suffix of lib directory name (32/64)" )
0149 +
0150 +IF(WIN32 AND NOT DEFINED CMAKE_DEBUG_POSTFIX)
0151 + SET(CMAKE_DEBUG_POSTFIX "d")
0152 +ENDIF()
0153 +
0154 +# To prevent warnings from M$ compiler
0155 +IF(WIN32 AND MSVC)
0156 + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
0157 + ADD_DEFINITIONS(-D_ATL_SECURE_NO_WARNINGS)
0158 + ADD_DEFINITIONS(-D_AFX_SECURE_NO_WARNINGS)
0159 +ENDIF()
0160 +
0161 +# Under Windows, use specific flag to compile.
0162 +IF(WIN32)
0163 + ADD_DEFINITIONS(-DDJGPP)
0164 +ENDIF()
0165 +
0166 +# -- Check dependencies --------------------------------------------------------------------------------
0167 +
0168 +SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
0169 +
0170 +INCLUDE(MacroBoolTo01)
0171 +INCLUDE(MacroLogFeature)
0172 +INCLUDE(MacroOptionalFindPackage)
0173 +
0174 +# Math library check
0175 +
0176 +IF(NOT WIN32)
0177 + FIND_LIBRARY(MATH_LIBRARY m)
0178 +ENDIF()
0179 +
0180 +# LCMS version 1 and 2 library check
0181 +
0182 +SET(LCMS_SUPPORT_CAN_BE_COMPILED false)
0183 +
0184 +IF (ENABLE_LCMS)
0185 + MESSAGE(STATUS "Check for LCMS2 availability...")
0186 + FIND_PACKAGE(LCMS2)
0187 + IF (LCMS2_FOUND AND (LCMS2_VERSION VERSION_EQUAL 2.1 OR LCMS2_VERSION VERSION_GREATER 2.1))
0188 + MESSAGE(STATUS "Found LCMS2 : ${LCMS2_LIBRARIES} ${LCMS2_INCLUDE_DIR}")
0189 + INCLUDE_DIRECTORIES(${LCMS2_INCLUDE_DIR})
0190 + MACRO_LOG_FEATURE(LCMS2_FOUND "LCMS2" "A small-footprint color management engine" "http://www.littlecms.com" FALSE "" "Needed by libkdcraw")
0191 + # Flag to compile Little CMS version 2 with LibRaw
0192 + ADD_DEFINITIONS(-DUSE_LCMS2)
0193 + SET(LCMS_SUPPORT_CAN_BE_COMPILED true)
0194 + ELSE ()
0195 + MESSAGE(STATUS "Check for LCMS availability instead LCMS2...")
0196 + FIND_PACKAGE(LCMS)
0197 + IF (LCMS_FOUND)
0198 + MESSAGE(STATUS "Found LCMS1: ${LCMS_LIBRARIES} ${LCMS_INCLUDE_DIR}")
0199 + INCLUDE_DIRECTORIES(${LCMS_INCLUDE_DIR})
0200 + MACRO_LOG_FEATURE(LCMS_FOUND "LCMS1" "A small-footprint color management engine" "http://www.littlecms.com" TRUE "" "Needed by libkdcraw")
0201 + # Flag to compile Little CMS version 1 with LibRaw
0202 + ADD_DEFINITIONS(-DUSE_LCMS)
0203 + # For compatibility
0204 + SET(LCMS2_LIBRARIES ${LCMS_LIBRARIES})
0205 + SET(LCMS_SUPPORT_CAN_BE_COMPILED true)
0206 + ENDIF ()
0207 + ENDIF ()
0208 +ENDIF()
0209 +
0210 +# For registration to libraw_config.h
0211 +MACRO_BOOL_TO_01(LCMS_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_LCMS)
0212 +
0213 +# zlib library check
0214 +
0215 +FIND_PACKAGE(ZLIB)
0216 +FIND_PACKAGE(JPEG)
0217 +
0218 +# Flag to use zlib with LibRaw DNG deflate codec
0219 +IF(ZLIB_FOUND)
0220 + ADD_DEFINITIONS(-DUSE_ZLIB)
0221 +ENDIF()
0222 +
0223 +# For registration to libraw_config.h
0224 +MACRO_BOOL_TO_01(ZLIB_FOUND LIBRAW_USE_DNGDEFLATECODEC)
0225 +
0226 +# JPEG library check
0227 +find_package(JPEG)
0228 +IF(JPEG_FOUND)
0229 + if (${JPEG_VERSION} LESS 80)
0230 + set(JPEG8_FOUND FALSE)
0231 + else()
0232 + set(JPEG8_FOUND TRUE)
0233 + endif()
0234 +ENDIF()
0235 +
0236 +MACRO_LOG_FEATURE(JPEG8_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" FALSE "80" "needed for the LibRaw DNG lossy codec")
0237 +
0238 +# Flag to use libjpeg with LibRaw DNG lossy codec
0239 +IF(JPEG8_FOUND)
0240 + ADD_DEFINITIONS(-DUSE_JPEG)
0241 + ADD_DEFINITIONS(-DUSE_JPEG8)
0242 +ENDIF()
0243 +
0244 +# For registration to libraw_config.h
0245 +MACRO_BOOL_TO_01(JPEG8_FOUND LIBRAW_USE_DNGLOSSYCODEC)
0246 +
0247 +IF(ENABLE_OPENMP)
0248 + find_package(OpenMP REQUIRED)
0249 +ENDIF(ENABLE_OPENMP)
0250 +
0251 +# For registration to libraw_config.h
0252 +MACRO_BOOL_TO_01(OpenMP_FOUND LIBRAW_USE_OPENMP)
0253 +
0254 +# Jasper library check
0255 +SET(JASPER_FOUND false)
0256 +IF(ENABLE_JASPER)
0257 + FIND_PACKAGE(Jasper)
0258 +
0259 + # Flag to use libjasper with LibRaw RedCine codec
0260 + IF(JASPER_FOUND)
0261 + ADD_DEFINITIONS(-DUSE_JASPER)
0262 + INCLUDE_DIRECTORIES(${JASPER_INCLUDE_DIR})
0263 + ENDIF()
0264 +ENDIF()
0265 +
0266 +# For registration to libraw_config.h
0267 +MACRO_BOOL_TO_01(JASPER_FOUND LIBRAW_USE_REDCINECODEC)
0268 +
0269 +# For RawSpeed Codec Support
0270 +
0271 +SET(RAWSPEED_FOUND false)
0272 +SET(RAWSPEED_SUPPORT_CAN_BE_COMPILED false)
0273 +
0274 +IF(ENABLE_RAWSPEED)
0275 +
0276 + FIND_PACKAGE(LibXml2)
0277 + FIND_PACKAGE(Threads REQUIRED)
0278 +
0279 + MESSAGE(STATUS "RawSpeed codec path: ${RAWSPEED_PATH}")
0280 +
0281 + IF(EXISTS "${RAWSPEED_PATH}/Common.cpp")
0282 + SET(RAWSPEED_FOUND true)
0283 + ELSE()
0284 + MESSAGE(STATUS "RawSpeed source code not found. Please checkout source code from RawStudio project website.")
0285 + ENDIF()
0286 +
0287 + IF(ENABLE_RAWSPEED AND RAWSPEED_FOUND AND JPEG8_FOUND AND LIBXML2_FOUND AND PTHREADS_FOUND)
0288 +
0289 + SET(RAWSPEED_SUPPORT_CAN_BE_COMPILED true)
0290 +
0291 + ELSE()
0292 + IF (NOT JPEG8_FOUND)
0293 + MESSAGE(STATUS "LibJPEG dependency not resolved. LibRaw cannot be compiled with RawSpeed codec")
0294 + ENDIF()
0295 +
0296 + IF (NOT LIBXML2_FOUND)
0297 + MESSAGE(STATUS "LibXML2 dependency not resolved. LibRaw cannot be compiled with RawSpeed codec")
0298 + ENDIF()
0299 +
0300 + IF (NOT PTHREADS_FOUND)
0301 + MESSAGE(STATUS "Pthreads dependency not resolved. LibRaw cannot be compiled with RawSpeed codec")
0302 + ENDIF()
0303 +
0304 + ENDIF()
0305 +ENDIF()
0306 +
0307 +# For registration to libraw_config.h
0308 +MACRO_BOOL_TO_01(RAWSPEED_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_RAWSPEED)
0309 +
0310 +# -- Compilation rules for RawSpeed library -------------------------------------------------------------
0311 +
0312 +IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
0313 +
0314 + INCLUDE_DIRECTORIES(${RAWSPEED_PATH})
0315 +
0316 + INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PTHREADS_INCLUDE_DIR})
0317 +
0318 + # Flag to include RawSpeed codec with Libraw
0319 + ADD_DEFINITIONS(-DUSE_RAWSPEED)
0320 +
0321 + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${PTHREADS_DEFINITIONS})
0322 +
0323 + SET(librawspeed_LIB_SRCS ${RAWSPEED_PATH}/ArwDecoder.cpp
0324 + ${RAWSPEED_PATH}/BitPumpJPEG.cpp
0325 + ${RAWSPEED_PATH}/BitPumpMSB.cpp
0326 + ${RAWSPEED_PATH}/BitPumpMSB32.cpp
0327 + ${RAWSPEED_PATH}/BitPumpPlain.cpp
0328 + ${RAWSPEED_PATH}/BlackArea.cpp
0329 + ${RAWSPEED_PATH}/ByteStream.cpp
0330 + ${RAWSPEED_PATH}/ByteStreamSwap.cpp
0331 + ${RAWSPEED_PATH}/Camera.cpp
0332 + ${RAWSPEED_PATH}/CameraMetaData.cpp
0333 + ${RAWSPEED_PATH}/CameraMetadataException.cpp
0334 + ${RAWSPEED_PATH}/CameraSensorInfo.cpp
0335 + ${RAWSPEED_PATH}/ColorFilterArray.cpp
0336 + ${RAWSPEED_PATH}/Common.cpp
0337 + ${RAWSPEED_PATH}/Cr2Decoder.cpp
0338 + ${RAWSPEED_PATH}/DngDecoder.cpp
0339 + ${RAWSPEED_PATH}/DngDecoderSlices.cpp
0340 + ${RAWSPEED_PATH}/DngOpcodes.cpp
0341 + ${RAWSPEED_PATH}/FileIOException.cpp
0342 + ${RAWSPEED_PATH}/FileMap.cpp
0343 + ${RAWSPEED_PATH}/IOException.cpp
0344 + ${RAWSPEED_PATH}/LJpegDecompressor.cpp
0345 + ${RAWSPEED_PATH}/LJpegPlain.cpp
0346 + ${RAWSPEED_PATH}/NefDecoder.cpp
0347 + ${RAWSPEED_PATH}/NikonDecompressor.cpp
0348 + ${RAWSPEED_PATH}/OrfDecoder.cpp
0349 + ${RAWSPEED_PATH}/PefDecoder.cpp
0350 + ${RAWSPEED_PATH}/PentaxDecompressor.cpp
0351 + ${RAWSPEED_PATH}/RawDecoder.cpp
0352 + ${RAWSPEED_PATH}/RawDecoderException.cpp
0353 + ${RAWSPEED_PATH}/RawImage.cpp
0354 + ${RAWSPEED_PATH}/RawImageDataFloat.cpp
0355 + ${RAWSPEED_PATH}/RawImageDataU16.cpp
0356 + ${RAWSPEED_PATH}/RawParser.cpp
0357 + ${RAWSPEED_PATH}/Rw2Decoder.cpp
0358 + ${RAWSPEED_PATH}/SrwDecoder.cpp
0359 + ${RAWSPEED_PATH}/TiffEntry.cpp
0360 + ${RAWSPEED_PATH}/TiffEntryBE.cpp
0361 + ${RAWSPEED_PATH}/TiffIFD.cpp
0362 + ${RAWSPEED_PATH}/TiffIFDBE.cpp
0363 + ${RAWSPEED_PATH}/TiffParser.cpp
0364 + ${RAWSPEED_PATH}/TiffParserException.cpp
0365 + ${RAWSPEED_PATH}/TiffParserHeaderless.cpp
0366 + ${RAWSPEED_PATH}/TiffParserOlympus.cpp
0367 + )
0368 +
0369 +ENDIF()
0370 +
0371 +# -- Common LibRaw library compilation rules ------------------------------------------------------------------
0372 +
0373 +# Flag to add debug print on the console
0374 +IF(ENABLE_DCRAW_DEBUG)
0375 + ADD_DEFINITIONS(-DDCRAW_VERBOSE)
0376 +ENDIF()
0377 +
0378 +# For registration to libraw_config.h
0379 +MACRO_BOOL_TO_01(ENABLE_DCRAW_DEBUG LIBRAW_USE_DCRAW_DEBUG)
0380 +
0381 +# Flag to add Foveon X3F support
0382 +IF(ENABLE_X3FTOOLS)
0383 + ADD_DEFINITIONS(-DUSE_X3FTOOLS)
0384 +ENDIF()
0385 +
0386 +# For registration to libraw_config.h
0387 +MACRO_BOOL_TO_01(ENABLE_X3FTOOLS LIBRAW_USE_X3FTOOLS)
0388 +
0389 +# Flag to add Raspberry Pi RAW support
0390 +IF(ENABLE_6BY9RPI)
0391 + ADD_DEFINITIONS(-DUSE_6BY9RPI)
0392 +ENDIF()
0393 +
0394 +# For registration to libraw_config.h
0395 +MACRO_BOOL_TO_01(ENABLE_6BY9RPI LIBRAW_USE_6BY9RPI)
0396 +
0397 +# Flag to export library symbols
0398 +IF (WIN32)
0399 + ADD_DEFINITIONS(-DLIBRAW_BUILDLIB)
0400 +ENDIF()
0401 +
0402 +# Create a config header for client application.
0403 +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw_config.h)
0404 +
0405 +# Put the include dirs which are in the source or build tree
0406 +# before all other include dirs, so the headers in the sources
0407 +# are preferred over the already installed ones
0408 +SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
0409 +
0410 +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/
0411 + ${LIBRAW_PATH}/
0412 + )
0413 +
0414 +# -- Log messages about configuration ------------------------------------------------------------------
0415 +
0416 +MESSAGE(STATUS "")
0417 +MESSAGE(STATUS "----------------------------------------------------------------------------------")
0418 +MESSAGE(STATUS " Libraw ${RAW_LIB_VERSION_STRING} configuration <http://www.libraw.org>")
0419 +MESSAGE(STATUS "")
0420 +
0421 +IF(OpenMP_FOUND)
0422 + MESSAGE(STATUS " Libraw will be compiled with OpenMP support .................. YES")
0423 +ELSE()
0424 + MESSAGE(STATUS " Libraw will be compiled with OpenMP support .................. NO")
0425 +ENDIF()
0426 +
0427 +IF(LCMS_SUPPORT_CAN_BE_COMPILED)
0428 + MESSAGE(STATUS " Libraw will be compiled with LCMS support .................... YES")
0429 +ELSE()
0430 + MESSAGE(STATUS " Libraw will be compiled with LCMS support .................... NO")
0431 +ENDIF()
0432 +
0433 +IF(ENABLE_EXAMPLES)
0434 + MESSAGE(STATUS " Libraw will be compiled with example command-line programs ... YES")
0435 +ELSE()
0436 + MESSAGE(STATUS " Libraw will be compiled with example command-line programs ... NO")
0437 +ENDIF()
0438 +
0439 +IF(JASPER_FOUND)
0440 + MESSAGE(STATUS " Libraw will be compiled with RedCine codec support ........... YES")
0441 +ELSE()
0442 + MESSAGE(STATUS " Libraw will be compiled with RedCine codec support ........... NO")
0443 +ENDIF()
0444 +
0445 +IF(ZLIB_FOUND)
0446 + MESSAGE(STATUS " Libraw will be compiled with DNG deflate codec support ....... YES")
0447 +ELSE()
0448 + MESSAGE(STATUS " Libraw will be compiled with DNG deflate codec support ....... NO")
0449 +ENDIF()
0450 +
0451 +IF(JPEG8_FOUND)
0452 + MESSAGE(STATUS " Libraw will be compiled with DNG lossy codec support ......... YES")
0453 +ELSE()
0454 + MESSAGE(STATUS " Libraw will be compiled with DNG lossy codec support ......... NO")
0455 +ENDIF()
0456 +
0457 +IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
0458 + MESSAGE(STATUS " Libraw will be compiled with RawSpeed support ................ YES")
0459 +ELSE()
0460 + MESSAGE(STATUS " Libraw will be compiled with RawSpeed support ................ NO")
0461 +ENDIF()
0462 +
0463 +IF(ENABLE_DCRAW_DEBUG)
0464 + MESSAGE(STATUS " Libraw will be compiled with debug message from dcraw ........ YES")
0465 +ELSE()
0466 + MESSAGE(STATUS " Libraw will be compiled with debug message from dcraw ........ NO")
0467 +ENDIF()
0468 +
0469 +IF(ENABLE_X3FTOOLS)
0470 + MESSAGE(STATUS " Libraw will be compiled with Foveon X3F support .............. YES")
0471 +ELSE()
0472 + MESSAGE(STATUS " Libraw will be compiled with Foveon X3F support .............. NO")
0473 +ENDIF()
0474 +
0475 +IF(ENABLE_6BY9RPI)
0476 + MESSAGE(STATUS " Libraw will be compiled with Raspberry Pi RAW support ........ YES")
0477 +ELSE()
0478 + MESSAGE(STATUS " Libraw will be compiled with Raspberry Pi RAW support ........ NO")
0479 +ENDIF()
0480 +
0481 +IF(BUILD_SHARED_LIBS)
0482 + MESSAGE(STATUS " Libraw will be compiled as a shared library")
0483 +ELSE()
0484 + MESSAGE(STATUS " Libraw will be compiled as a static library")
0485 +ENDIF()
0486 +
0487 +MESSAGE(STATUS "----------------------------------------------------------------------------------")
0488 +MESSAGE(STATUS "")
0489 +
0490 +# -- Dedicated libraw target which does not support multi-threading ---------------------------------------
0491 +
0492 +IF(RAW_LIB_VERSION_STRING VERSION_LESS 0.21)
0493 + SET(libraw_LIB_SRCS ${LIBRAW_PATH}/internal/dcraw_common.cpp
0494 + ${LIBRAW_PATH}/internal/dcraw_fileio.cpp
0495 + ${LIBRAW_PATH}/internal/demosaic_packs.cpp
0496 + ${LIBRAW_PATH}/src/libraw_cxx.cpp
0497 + ${LIBRAW_PATH}/src/libraw_c_api.cpp
0498 + ${LIBRAW_PATH}/src/libraw_datastream.cpp
0499 + )
0500 +ELSE()
0501 + FILE(GLOB_RECURSE libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_PATH}/src/*.cpp")
0502 +
0503 + # Exclude placeholder (stub) implementations
0504 + FILE(GLOB_RECURSE exclude_libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_PATH}/src/*_ph.cpp")
0505 + LIST(REMOVE_ITEM libraw_LIB_SRCS ${exclude_libraw_LIB_SRCS})
0506 +ENDIF()
0507 +
0508 +IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
0509 + SET(libraw_LIB_SRCS ${libraw_LIB_SRCS} ${librawspeed_LIB_SRCS})
0510 +ENDIF()
0511 +
0512 +
0513 +add_library(raw ${libraw_LIB_SRCS})
0514 +add_library(libraw::libraw ALIAS raw)
0515 +target_compile_definitions(raw PRIVATE LIBRAW_NOTHREADS)
0516 +
0517 +# Disable compilation warnings from LibRaw. Just to be clear on the console.
0518 +# Use O4 GCC compilation option to prevent artifacts with OpenMP
0519 +IF(WIN32 AND MSVC)
0520 + target_compile_options(raw PRIVATE -w)
0521 +ELSE()
0522 + target_compile_options(raw PRIVATE -w -O4)
0523 +ENDIF()
0524 +
0525 +target_include_directories(raw
0526 + PUBLIC
0527 + $<INSTALL_INTERFACE:libraw>
0528 + $<BUILD_INTERFACE:${LIBRAW_PATH}>)
0529 +
0530 +TARGET_LINK_LIBRARIES(raw ${MATH_LIBRARY})
0531 +
0532 +IF(MINGW)
0533 + TARGET_LINK_LIBRARIES(raw ws2_32)
0534 +ENDIF()
0535 +
0536 +IF(OpenMP_FOUND)
0537 + target_link_libraries(raw OpenMP::OpenMP_CXX)
0538 +ENDIF()
0539 +
0540 +IF(LCMS_SUPPORT_CAN_BE_COMPILED)
0541 + TARGET_LINK_LIBRARIES(raw ${LCMS2_LIBRARIES})
0542 +ENDIF()
0543 +
0544 +IF(ZLIB_FOUND)
0545 + TARGET_LINK_LIBRARIES(raw ZLIB::ZLIB)
0546 +ENDIF()
0547 +
0548 +IF(JPEG8_FOUND)
0549 + TARGET_LINK_LIBRARIES(raw JPEG::JPEG)
0550 +ENDIF()
0551 +
0552 +IF(JASPER_FOUND)
0553 + TARGET_LINK_LIBRARIES(raw ${JASPER_LIBRARIES})
0554 +ENDIF()
0555 +
0556 +IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
0557 + TARGET_LINK_LIBRARIES(raw ${LIBXML2_LIBRARIES})
0558 +ENDIF()
0559 +
0560 +SET_TARGET_PROPERTIES(raw PROPERTIES VERSION ${RAW_LIB_SO_VERSION_STRING})
0561 +SET_TARGET_PROPERTIES(raw PROPERTIES SOVERSION ${RAW_LIB_SO_CUR_VERSION})
0562 +SET_TARGET_PROPERTIES(raw PROPERTIES OUTPUT_NAME "raw")
0563 +SET_TARGET_PROPERTIES(raw PROPERTIES COMPILE_PDB_NAME "raw")
0564 +
0565 +# -- Dedicated libraw target to support multi-threading ---------------------------------------------
0566 +
0567 +SET(libraw_r_LIB_SRCS ${libraw_LIB_SRCS})
0568 +
0569 +ADD_LIBRARY(raw_r ${libraw_r_LIB_SRCS})
0570 +add_library(libraw::libraw_r ALIAS raw_r)
0571 +
0572 +IF(WIN32 AND MSVC)
0573 + target_compile_options(raw_r PRIVATE -w)
0574 +ELSE()
0575 + target_compile_options(raw_r PRIVATE -w -O4)
0576 +ENDIF()
0577 +
0578 +# Always build position-independent code (PIC), even when building Libraw as a
0579 +# static library so that shared libraries can link against it, not just
0580 +# executables (PIC does not apply on Windows).
0581 +# Use set_target_properties() not append_target_property() here as
0582 +# POSITION_INDEPENDENT_CODE is a binary ON/OFF switch.
0583 +set_target_properties(raw PROPERTIES POSITION_INDEPENDENT_CODE ON)
0584 +set_target_properties(raw_r PROPERTIES POSITION_INDEPENDENT_CODE ON)
0585 +
0586 +TARGET_LINK_LIBRARIES(raw_r ${MATH_LIBRARY})
0587 +target_include_directories(raw_r
0588 + PUBLIC
0589 + $<INSTALL_INTERFACE:libraw>
0590 + $<BUILD_INTERFACE:${LIBRAW_PATH}>)
0591 +
0592 +IF(MINGW)
0593 + TARGET_LINK_LIBRARIES(raw_r ws2_32)
0594 +ENDIF()
0595 +
0596 +IF(OpenMP_FOUND)
0597 + TARGET_LINK_LIBRARIES(raw_r OpenMP::OpenMP_CXX)
0598 +ENDIF()
0599 +
0600 +IF(LCMS_SUPPORT_CAN_BE_COMPILED)
0601 + TARGET_LINK_LIBRARIES(raw_r ${LCMS2_LIBRARIES})
0602 +ENDIF()
0603 +
0604 +IF(ZLIB_FOUND)
0605 + TARGET_LINK_LIBRARIES(raw_r ZLIB::ZLIB)
0606 +ENDIF()
0607 +
0608 +IF(JPEG8_FOUND)
0609 + TARGET_LINK_LIBRARIES(raw_r JPEG::JPEG)
0610 +ENDIF()
0611 +
0612 +IF(JASPER_FOUND)
0613 + TARGET_LINK_LIBRARIES(raw_r ${JASPER_LIBRARIES})
0614 +ENDIF()
0615 +
0616 +IF(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
0617 + TARGET_LINK_LIBRARIES(raw_r ${LIBXML2_LIBRARIES} Threads::Threads)
0618 +ENDIF()
0619 +
0620 +SET_TARGET_PROPERTIES(raw_r PROPERTIES VERSION ${RAW_LIB_SO_VERSION_STRING})
0621 +SET_TARGET_PROPERTIES(raw_r PROPERTIES SOVERSION ${RAW_LIB_SO_CUR_VERSION})
0622 +SET_TARGET_PROPERTIES(raw_r PROPERTIES OUTPUT_NAME "raw_r")
0623 +SET_TARGET_PROPERTIES(raw_r PROPERTIES COMPILE_PDB_NAME "raw_r")
0624 +
0625 +# -- Files to install -------------------------------------------------------------------------------------
0626 +if (LIBRAW_INSTALL)
0627 +
0628 +# Configure and install data file for packaging.
0629 +IF(NOT WIN32)
0630 + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw.pc @ONLY)
0631 + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libraw.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
0632 +
0633 + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw_r.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw_r.pc @ONLY)
0634 + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libraw_r.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
0635 +
0636 + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw.lsm.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw.lsm)
0637 +ENDIF()
0638 +
0639 +# Install Shared header files.
0640 +INSTALL(FILES ${LIBRAW_PATH}/libraw/libraw.h
0641 + ${LIBRAW_PATH}/libraw/libraw_alloc.h
0642 + ${LIBRAW_PATH}/libraw/libraw_const.h
0643 + ${LIBRAW_PATH}/libraw/libraw_datastream.h
0644 + ${LIBRAW_PATH}/libraw/libraw_internal.h
0645 + ${LIBRAW_PATH}/libraw/libraw_types.h
0646 + ${LIBRAW_PATH}/libraw/libraw_version.h
0647 + ${CMAKE_CURRENT_BINARY_DIR}/libraw_config.h
0648 + DESTINATION include/libraw
0649 + COMPONENT Devel
0650 + )
0651 +
0652 +# Install Shared binary files.
0653 +INSTALL(TARGETS raw
0654 + RUNTIME DESTINATION bin
0655 + LIBRARY DESTINATION lib${LIB_SUFFIX}
0656 + ARCHIVE DESTINATION lib${LIB_SUFFIX}
0657 + )
0658 +
0659 +INSTALL(TARGETS raw_r
0660 + RUNTIME DESTINATION bin
0661 + LIBRARY DESTINATION lib${LIB_SUFFIX}
0662 + ARCHIVE DESTINATION lib${LIB_SUFFIX}
0663 + )
0664 +
0665 +IF(MSVC)
0666 + INSTALL(FILES $<TARGET_PDB_FILE:raw>
0667 + DESTINATION lib
0668 + CONFIGURATIONS Debug RelWithDebInfo
0669 + )
0670 + INSTALL(FILES $<TARGET_PDB_FILE:raw_r>
0671 + DESTINATION lib
0672 + CONFIGURATIONS Debug RelWithDebInfo
0673 + )
0674 +ENDIF()
0675 +
0676 +# Install find cmake script to the system for client applications.
0677 +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindLibRaw.cmake
0678 + DESTINATION ${INSTALL_CMAKE_MODULE_PATH})
0679 +
0680 +# Install doc data files.
0681 +IF(NOT WIN32)
0682 + INSTALL(FILES ${LIBRAW_PATH}/COPYRIGHT
0683 + ${LIBRAW_PATH}/LICENSE.CDDL
0684 + ${LIBRAW_PATH}/LICENSE.LGPL
0685 + ${LIBRAW_PATH}/Changelog.txt
0686 + DESTINATION share/libraw
0687 + COMPONENT main
0688 + )
0689 +ENDIF()
0690 +endif(LIBRAW_INSTALL)
0691 +
0692 +# Uninstall rules
0693 +IF(LIBRAW_UNINSTALL_TARGET)
0694 + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/Uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY)
0695 + ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
0696 +ENDIF(LIBRAW_UNINSTALL_TARGET)
0697 +
0698 +# -- Compile LibRaw Examples --------------------------------------------------------------------------------
0699 +
0700 +# add a small macro so that this is a bit cleaner
0701 +MACRO(LIBRAW_BUILD_SAMPLES)
0702 +
0703 + SET(_filename ${ARGV0})
0704 + SET(_rawlib ${ARGV1})
0705 + STRING(REPLACE "." ";" _temp ${_filename})
0706 + LIST(GET _temp 0 _target)
0707 +
0708 + SET(${_target}_SRCS ${LIBRAW_PATH}/samples/${_filename})
0709 +
0710 + ADD_EXECUTABLE(${_target} ${${_target}_SRCS})
0711 + target_compile_options(${_target} PRIVATE -w)
0712 +
0713 + TARGET_LINK_LIBRARIES(${_target} PRIVATE ${_rawlib})
0714 +
0715 + IF(OpenMP_FOUND)
0716 + target_link_libraries(${_target} PUBLIC OpenMP::OpenMP_CXX)
0717 + ENDIF()
0718 +
0719 + IF (${_rawlib} MATCHES "raw_r")
0720 + TARGET_LINK_LIBRARIES(${_target} PUBLIC ${PTHREADS_LIBRARY})
0721 + ENDIF()
0722 +
0723 + IF(WIN32)
0724 + TARGET_LINK_LIBRARIES(${_target} PUBLIC ws2_32)
0725 + ENDIF()
0726 +
0727 + INSTALL(TARGETS ${_target}
0728 + RUNTIME DESTINATION bin
0729 + LIBRARY DESTINATION lib${LIB_SUFFIX}
0730 + ARCHIVE DESTINATION lib${LIB_SUFFIX}
0731 + )
0732 +
0733 +ENDMACRO(LIBRAW_BUILD_SAMPLES)
0734 +
0735 +IF(ENABLE_EXAMPLES)
0736 +
0737 + LIBRAW_BUILD_SAMPLES(simple_dcraw.cpp raw)
0738 +
0739 + if(EXISTS mem_image.cpp)
0740 + LIBRAW_BUILD_SAMPLES(mem_image.cpp raw)
0741 + else()
0742 + LIBRAW_BUILD_SAMPLES(mem_image_sample.cpp raw)
0743 + endif()
0744 +
0745 + LIBRAW_BUILD_SAMPLES(dcraw_emu.cpp raw)
0746 + LIBRAW_BUILD_SAMPLES(4channels.cpp raw)
0747 + LIBRAW_BUILD_SAMPLES(unprocessed_raw.cpp raw)
0748 + LIBRAW_BUILD_SAMPLES(raw-identify.cpp raw)
0749 + LIBRAW_BUILD_SAMPLES(multirender_test.cpp raw)
0750 + LIBRAW_BUILD_SAMPLES(postprocessing_benchmark.cpp raw)
0751 +
0752 + IF (TARGET Threads::Threads)
0753 + IF(WIN32)
0754 + LIBRAW_BUILD_SAMPLES(half_mt_win32.c raw_r)
0755 + ELSE()
0756 + LIBRAW_BUILD_SAMPLES(dcraw_half.c raw_r)
0757 + LIBRAW_BUILD_SAMPLES(half_mt.c raw_r)
0758 + ENDIF()
0759 + ENDIF()
0760 +ENDIF()
0761 diff --git a/INSTALL.CMAKE b/INSTALL.CMAKE
0762 new file mode 100644
0763 index 0000000..e000651
0764 --- /dev/null
0765 +++ b/INSTALL.CMAKE
0766 @@ -0,0 +1,62 @@
0767 +
0768 +========= Installing LibRaw (CMake version) ==========
0769 +
0770 +I. Installation steps
0771 +
0772 +1. Unpack the distribution file:
0773 +
0774 + $ tar xzvf LibRaw-0.xx.yy.tar.gz
0775 +
0776 +2. Copy this LibRaw-cmake scripts in LibRaw-... folder
0777 +
0778 +3. Go to LibRaw folder and run ./configure and make:
0779 +
0780 + $ cd LibRaw-0.xx.yy
0781 + $ ./cmake [...optional args...] .
0782 + $ make
0783 +
0784 +4. install by run make install as root:
0785 +
0786 + $ sudo make install
0787 +
0788 +
0789 +II. ./cmake options
0790 +
0791 +-DENABLE_OPENMP=ON/OFF
0792 +
0793 + Enable/disable OpenMP support if compiler supports it.
0794 + OpenMP is enabled by default.
0795 +
0796 +
0797 +-DENABLE_LCMS=ON/OFF
0798 +
0799 + Enable/disable LCMS color engine support. If enabled, ./cmake will try to
0800 + find lcms library. Both LCMS-1.x and LCMS-2.x are supported
0801 + LCMS support is enabled by default
0802 +
0803 +
0804 +-DENABLE_EXAMPLES=ON/OFF
0805 +
0806 + Enables/disables examples compilation and installation. Enabled by default
0807 +
0808 +
0809 +-DENABLE_RAWSPEED=ON/OFF
0810 +-DRAWSPEED_RPATH=FOLDERNAME
0811 +
0812 + Enables/disables support of additional code from RawStudio project
0813 + You need to download RawSpeed source code to use this feature.
0814 + See README.RawSpeed.txt for details.
0815 + ./cmake will try to find RawSpeed code in:
0816 +
0817 + a) If folder is specified via -DRAWSPEED_RPATH=FOLDERNAME
0818 + command-line option, then only this folder will be checked.
0819 +
0820 + b) If no folder is specified in -DENABLE_RAWSPEED switch:
0821 +
0822 + ./RawSpeed (in LibRaw folder)
0823 +
0824 +
0825 +
0826 +-DENABLE_DCRAW_DEBUG=ON/OFF
0827 +
0828 + Enables/disables support of additional debug traces from dcraw operations. Disabled by default
0829 diff --git a/LICENSE b/LICENSE
0830 new file mode 100644
0831 index 0000000..4b41776
0832 --- /dev/null
0833 +++ b/LICENSE
0834 @@ -0,0 +1,22 @@
0835 +Redistribution and use in source and binary forms, with or without
0836 +modification, are permitted provided that the following conditions
0837 +are met:
0838 +
0839 +1. Redistributions of source code must retain the copyright
0840 + notice, this list of conditions and the following disclaimer.
0841 +2. Redistributions in binary form must reproduce the copyright
0842 + notice, this list of conditions and the following disclaimer in the
0843 + documentation and/or other materials provided with the distribution.
0844 +3. The name of the author may not be used to endorse or promote products
0845 + derived from this software without specific prior written permission.
0846 +
0847 +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0848 +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0849 +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0850 +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0851 +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0852 +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0853 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0854 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0855 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0856 +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0857 diff --git a/cmake/data/libraw.lsm.cmake b/cmake/data/libraw.lsm.cmake
0858 new file mode 100644
0859 index 0000000..45dfb45
0860 --- /dev/null
0861 +++ b/cmake/data/libraw.lsm.cmake
0862 @@ -0,0 +1,13 @@
0863 +Begin4
0864 +Title: ${PROJECT_NAME}
0865 +Version: ${RAW_LIB_VERSION_STRING}
0866 +Entered-date: 2013-09-08
0867 +Description: Raw image decoder library
0868 +Keywords: Raw image digital camera demosaicing decoding
0869 +Author: Copyright 2008-2013 LibRaw LLC (info@libraw.org)
0870 +Maintained-by:
0871 +Primary-site: http://www.libraw.org
0872 +Original-site:
0873 +Platforms: Linux and other Unices, MacOs-X, Win32
0874 +Copying-policy: GPL
0875 +End
0876 diff --git a/cmake/data/libraw.pc.cmake b/cmake/data/libraw.pc.cmake
0877 new file mode 100644
0878 index 0000000..aede5f2
0879 --- /dev/null
0880 +++ b/cmake/data/libraw.pc.cmake
0881 @@ -0,0 +1,12 @@
0882 +prefix=@CMAKE_INSTALL_PREFIX@
0883 +exec_prefix=${prefix}
0884 +libdir=${prefix}/lib@LIB_SUFFIX@
0885 +includedir=${prefix}/include/libraw
0886 +
0887 +Name: @PROJECT_NAME@
0888 +Description: @PROJECT_NAME@ - Raw image decoder library (non-thread-safe)
0889 +URL: http://www.libraw.org
0890 +Requires:
0891 +Version: @RAW_LIB_VERSION_STRING@
0892 +Libs: -L${libdir} -lraw
0893 +Cflags: -I${includedir}
0894 diff --git a/cmake/data/libraw_config.h.cmake b/cmake/data/libraw_config.h.cmake
0895 new file mode 100644
0896 index 0000000..4e4b314
0897 --- /dev/null
0898 +++ b/cmake/data/libraw_config.h.cmake
0899 @@ -0,0 +1,50 @@
0900 +/* -*- C++ -*-
0901 + * File: libraw_version.h
0902 + * Copyright 2008-2013 LibRaw LLC (info@libraw.org)
0903 + * Created: Mon Sept 8, 2008
0904 + *
0905 + * LibRaw C++ interface
0906 + *
0907 +
0908 +LibRaw is free software; you can redistribute it and/or modify
0909 +it under the terms of the one of two licenses as you choose:
0910 +
0911 +1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
0912 +(See the file LICENSE.LGPL provided in LibRaw distribution archive for details).
0913 +
0914 +2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
0915 +(See the file LICENSE.CDDL provided in LibRaw distribution archive for details).
0916 +
0917 + */
0918 +
0919 +#ifndef __LIBRAW_CONFIG_H
0920 +#define __LIBRAW_CONFIG_H
0921 +
0922 +/* Define to 1 if LibRaw have been compiled with DNG deflate codec support */
0923 +#cmakedefine LIBRAW_USE_DNGDEFLATECODEC 1
0924 +
0925 +/* Define to 1 if LibRaw have been compiled with DNG lossy codec support */
0926 +#cmakedefine LIBRAW_USE_DNGLOSSYCODEC 1
0927 +
0928 +/* Define to 1 if LibRaw have been compiled with OpenMP support */
0929 +#cmakedefine LIBRAW_USE_OPENMP 1
0930 +
0931 +/* Define to 1 if LibRaw have been compiled with LCMS support */
0932 +#cmakedefine LIBRAW_USE_LCMS 1
0933 +
0934 +/* Define to 1 if LibRaw have been compiled with RedCine codec support */
0935 +#cmakedefine LIBRAW_USE_REDCINECODEC 1
0936 +
0937 +/* Define to 1 if LibRaw have been compiled with RawSpeed codec support */
0938 +#cmakedefine LIBRAW_USE_RAWSPEED 1
0939 +
0940 +/* Define to 1 if LibRaw have been compiled with debug message from dcraw */
0941 +#cmakedefine LIBRAW_USE_DCRAW_DEBUG 1
0942 +
0943 +/* Define to 1 if LibRaw have been compiled with Foveon X3F support */
0944 +#cmakedefine LIBRAW_USE_X3FTOOLS 1
0945 +
0946 +/* Define to 1 if LibRaw have been compiled with Raspberry Pi RAW support */
0947 +#cmakedefine LIBRAW_USE_6BY9RPI 1
0948 +
0949 +#endif
0950 diff --git a/cmake/data/libraw_r.pc.cmake b/cmake/data/libraw_r.pc.cmake
0951 new file mode 100644
0952 index 0000000..16134e8
0953 --- /dev/null
0954 +++ b/cmake/data/libraw_r.pc.cmake
0955 @@ -0,0 +1,12 @@
0956 +prefix=@CMAKE_INSTALL_PREFIX@
0957 +exec_prefix=${prefix}
0958 +libdir=${prefix}/lib@LIB_SUFFIX@
0959 +includedir=${prefix}/include/libraw
0960 +
0961 +Name: @PROJECT_NAME@
0962 +Description: @PROJECT_NAME@ - Raw image decoder library (thread-safe)
0963 +URL: http://www.libraw.org
0964 +Requires:
0965 +Version: @RAW_LIB_VERSION_STRING@
0966 +Libs: -L${libdir} -lraw_r
0967 +Cflags: -I${includedir}
0968 diff --git a/cmake/modules/FindLCMS.cmake b/cmake/modules/FindLCMS.cmake
0969 new file mode 100644
0970 index 0000000..d82d82e
0971 --- /dev/null
0972 +++ b/cmake/modules/FindLCMS.cmake
0973 @@ -0,0 +1,60 @@
0974 +# - Find LCMS
0975 +# Find the LCMS (Little Color Management System) library and includes and
0976 +# This module defines
0977 +# LCMS_INCLUDE_DIR, where to find lcms.h
0978 +# LCMS_LIBRARIES, the libraries needed to use LCMS.
0979 +# LCMS_DOT_VERSION, The version number of the LCMS library, e.g. "1.19"
0980 +# LCMS_VERSION, Similar to LCMS_DOT_VERSION, but without the dots, e.g. "119"
0981 +# LCMS_FOUND, If false, do not try to use LCMS.
0982 +#
0983 +# The minimum required version of LCMS can be specified using the
0984 +# standard syntax, e.g. find_package(LCMS 1.10)
0985 +
0986 +# Copyright (c) 2008, Adrian Page, <adrian@pagenet.plus.com>
0987 +# Copyright (c) 2009, Cyrille Berger, <cberger@cberger.net>
0988 +#
0989 +# Redistribution and use is allowed according to the terms of the BSD license.
0990 +# For details see the accompanying LICENSE file.
0991 +
0992 +
0993 +# use pkg-config to get the directories and then use these values
0994 +# in the FIND_PATH() and FIND_LIBRARY() calls
0995 +if(NOT WIN32)
0996 + find_package(PkgConfig)
0997 + pkg_check_modules(PC_LCMS lcms)
0998 + set(LCMS_DEFINITIONS ${PC_LCMS_CFLAGS_OTHER})
0999 +endif(NOT WIN32)
1000 +
1001 +find_path(LCMS_INCLUDE_DIR lcms.h
1002 + HINTS
1003 + ${PC_LCMS_INCLUDEDIR}
1004 + ${PC_LCMS_INCLUDE_DIRS}
1005 + PATH_SUFFIXES lcms liblcms1
1006 +)
1007 +
1008 +find_library(LCMS_LIBRARIES NAMES lcms liblcms lcms-1 liblcms-1
1009 + HINTS
1010 + ${PC_LCMS_LIBDIR}
1011 + ${PC_LCMS_LIBRARY_DIRS}
1012 + PATH_SUFFIXES lcms
1013 +)
1014 +
1015 +# Store the LCMS version number in the cache, so we don't have to search every time again
1016 +if(LCMS_INCLUDE_DIR AND NOT LCMS_VERSION)
1017 + file(READ ${LCMS_INCLUDE_DIR}/lcms.h LCMS_VERSION_CONTENT)
1018 + string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS_VERSION_MATCH ${LCMS_VERSION_CONTENT})
1019 + if(LCMS_VERSION_MATCH)
1020 + string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" _LCMS_VERSION ${LCMS_VERSION_MATCH})
1021 + string(SUBSTRING ${_LCMS_VERSION} 0 1 LCMS_MAJOR_VERSION)
1022 + string(SUBSTRING ${_LCMS_VERSION} 1 2 LCMS_MINOR_VERSION)
1023 + endif(LCMS_VERSION_MATCH)
1024 + set(LCMS_VERSION "${LCMS_MAJOR_VERSION}${LCMS_MINOR_VERSION}" CACHE STRING "Version number of lcms" FORCE)
1025 + set(LCMS_DOT_VERSION "${LCMS_MAJOR_VERSION}.${LCMS_MINOR_VERSION}" CACHE STRING "Version number of lcms split into components" FORCE)
1026 +endif(LCMS_INCLUDE_DIR AND NOT LCMS_VERSION)
1027 +
1028 +include(FindPackageHandleStandardArgs)
1029 +find_package_handle_standard_args(LCMS REQUIRED_VARS LCMS_LIBRARIES LCMS_INCLUDE_DIR
1030 + VERSION_VAR LCMS_DOT_VERSION )
1031 +
1032 +mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARIES LCMS_VERSION)
1033 +
1034 diff --git a/cmake/modules/FindLCMS2.cmake b/cmake/modules/FindLCMS2.cmake
1035 new file mode 100644
1036 index 0000000..4e3e482
1037 --- /dev/null
1038 +++ b/cmake/modules/FindLCMS2.cmake
1039 @@ -0,0 +1,72 @@
1040 +# - Find LCMS2
1041 +# Find the LCMS2 includes and library
1042 +# This module defines
1043 +# LCMS2_INCLUDE_DIR, where to find lcms.h
1044 +# LCMS2_LIBRARIES, the libraries needed to use LCMS2.
1045 +# LCMS2_VERSION, The value of LCMS_VERSION defined in lcms.h
1046 +# LCMS2_FOUND, If false, do not try to use LCMS2.
1047 +
1048 +
1049 +# Copyright (c) 2008, Adrian Page, <adrian@pagenet.plus.com>
1050 +# Copyright (c) 2009, Cyrille Berger, <cberger@cberger.net>
1051 +#
1052 +# Redistribution and use is allowed according to the terms of the BSD license.
1053 +# For details see the accompanying LICENSE file.
1054 +
1055 +
1056 +# use pkg-config to get the directories and then use these values
1057 +# in the FIND_PATH() and FIND_LIBRARY() calls
1058 +if(NOT WIN32)
1059 + find_package(PkgConfig)
1060 + pkg_check_modules(PC_LCMS2 lcms2)
1061 + set(LCMS2_DEFINITIONS ${PC_LCMS2_CFLAGS_OTHER})
1062 +endif(NOT WIN32)
1063 +
1064 +find_path(LCMS2_INCLUDE_DIR lcms2.h
1065 + PATHS
1066 + ${PC_LCMS2_INCLUDEDIR}
1067 + ${PC_LCMS2_INCLUDE_DIRS}
1068 + PATH_SUFFIXES lcms2 liblcms2
1069 +)
1070 +
1071 +find_library(LCMS2_LIBRARIES NAMES lcms2 liblcms2 lcms-2 liblcms-2
1072 + PATHS
1073 + ${PC_LCMS2_LIBDIR}
1074 + ${PC_LCMS2_LIBRARY_DIRS}
1075 + PATH_SUFFIXES lcms2
1076 +)
1077 +
1078 +if(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
1079 + set(LCMS2_FOUND TRUE)
1080 +else(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
1081 + set(LCMS2_FOUND FALSE)
1082 +endif(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
1083 +
1084 +if(LCMS2_FOUND)
1085 + file(READ ${LCMS2_INCLUDE_DIR}/lcms2.h LCMS2_VERSION_CONTENT)
1086 + string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS2_VERSION_MATCH ${LCMS2_VERSION_CONTENT})
1087 + if(LCMS2_VERSION_MATCH)
1088 + string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" LCMS2_VERSION ${LCMS2_VERSION_MATCH})
1089 + if(NOT LCMS2_FIND_QUIETLY)
1090 + string(SUBSTRING ${LCMS2_VERSION} 0 1 LCMS2_MAJOR_VERSION)
1091 + string(SUBSTRING ${LCMS2_VERSION} 1 2 LCMS2_MINOR_VERSION)
1092 + message(STATUS "Found lcms version ${LCMS2_MAJOR_VERSION}.${LCMS2_MINOR_VERSION}, ${LCMS2_LIBRARIES}")
1093 + endif(NOT LCMS2_FIND_QUIETLY)
1094 + else(LCMS2_VERSION_MATCH)
1095 + if(NOT LCMS2_FIND_QUIETLY)
1096 + message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARIES}")
1097 + endif(NOT LCMS2_FIND_QUIETLY)
1098 + set(LCMS2_VERSION NOTFOUND)
1099 + endif(LCMS2_VERSION_MATCH)
1100 +else(LCMS2_FOUND)
1101 + if(NOT LCMS2_FIND_QUIETLY)
1102 + if(LCMS2_FIND_REQUIRED)
1103 + message(FATAL_ERROR "Required package lcms2 NOT found")
1104 + else(LCMS2_FIND_REQUIRED)
1105 + message(STATUS "lcms2 NOT found")
1106 + endif(LCMS2_FIND_REQUIRED)
1107 + endif(NOT LCMS2_FIND_QUIETLY)
1108 +endif(LCMS2_FOUND)
1109 +
1110 +mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION)
1111 +
1112 diff --git a/cmake/modules/FindLibRaw.cmake b/cmake/modules/FindLibRaw.cmake
1113 new file mode 100644
1114 index 0000000..2ce7140
1115 --- /dev/null
1116 +++ b/cmake/modules/FindLibRaw.cmake
1117 @@ -0,0 +1,96 @@
1118 +# - Find LibRaw
1119 +# Find the LibRaw library <http://www.libraw.org>
1120 +# This module defines
1121 +# LibRaw_VERSION_STRING, the version string of LibRaw
1122 +# LibRaw_INCLUDE_DIR, where to find libraw.h
1123 +# LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe)
1124 +# LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe)
1125 +# LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe)
1126 +# LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe)
1127 +#
1128 +# Copyright (c) 2013, Pino Toscano <pino at kde dot org>
1129 +# Copyright (c) 2013, Gilles Caulier <caulier dot gilles at gmail dot com>
1130 +#
1131 +# Redistribution and use is allowed according to the terms of the BSD license.
1132 +# For details see the accompanying LICENSE file.
1133 +
1134 +FIND_PACKAGE(PkgConfig)
1135 +
1136 +IF(PKG_CONFIG_FOUND)
1137 + PKG_CHECK_MODULES(PC_LIBRAW libraw)
1138 + SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
1139 +
1140 + PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r)
1141 + SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})
1142 +ENDIF()
1143 +
1144 +FIND_PATH(LibRaw_INCLUDE_DIR libraw.h
1145 + HINTS
1146 + ${PC_LIBRAW_INCLUDEDIR}
1147 + ${PC_LibRaw_INCLUDE_DIRS}
1148 + PATH_SUFFIXES libraw
1149 + )
1150 +
1151 +FIND_LIBRARY(LibRaw_LIBRARY_RELEASE NAMES raw
1152 + HINTS
1153 + ${PC_LIBRAW_LIBDIR}
1154 + ${PC_LIBRAW_LIBRARY_DIRS}
1155 + )
1156 +
1157 +FIND_LIBRARY(LibRaw_LIBRARY_DEBUG NAMES rawd
1158 + HINTS
1159 + ${PC_LIBRAW_LIBDIR}
1160 + ${PC_LIBRAW_LIBRARY_DIRS}
1161 + )
1162 +
1163 +include(SelectLibraryConfigurations)
1164 +select_library_configurations(LibRaw)
1165 +
1166 +FIND_LIBRARY(LibRaw_r_LIBRARY_RELEASE NAMES raw_r
1167 + HINTS
1168 + ${PC_LIBRAW_R_LIBDIR}
1169 + ${PC_LIBRAW_R_LIBRARY_DIRS}
1170 + )
1171 +
1172 +FIND_LIBRARY(LibRaw_r_LIBRARY_DEBUG NAMES raw_rd
1173 + HINTS
1174 + ${PC_LIBRAW_R_LIBDIR}
1175 + ${PC_LIBRAW_R_LIBRARY_DIRS}
1176 + )
1177 +
1178 +select_library_configurations(LibRaw_r)
1179 +
1180 +IF(LibRaw_INCLUDE_DIR)
1181 + FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content)
1182 +
1183 + STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
1184 + SET(_libraw_version_major "${CMAKE_MATCH_1}")
1185 +
1186 + STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content})
1187 + SET(_libraw_version_minor "${CMAKE_MATCH_1}")
1188 +
1189 + STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
1190 + SET(_libraw_version_patch "${CMAKE_MATCH_1}")
1191 +
1192 + IF(_version_major_match AND _version_minor_match AND _version_patch_match)
1193 + SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}")
1194 + ELSE()
1195 + IF(NOT LibRaw_FIND_QUIETLY)
1196 + MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h")
1197 + ENDIF()
1198 + ENDIF()
1199 +ENDIF()
1200 +
1201 +INCLUDE(FindPackageHandleStandardArgs)
1202 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw
1203 + REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR
1204 + VERSION_VAR LibRaw_VERSION_STRING
1205 + )
1206 +
1207 +MARK_AS_ADVANCED(LibRaw_VERSION_STRING
1208 + LibRaw_INCLUDE_DIR
1209 + LibRaw_LIBRARIES
1210 + LibRaw_r_LIBRARIES
1211 + LibRaw_DEFINITIONS
1212 + LibRaw_r_DEFINITIONS
1213 + )
1214 diff --git a/cmake/modules/MacroBoolTo01.cmake b/cmake/modules/MacroBoolTo01.cmake
1215 new file mode 100644
1216 index 0000000..a6f2fd8
1217 --- /dev/null
1218 +++ b/cmake/modules/MacroBoolTo01.cmake
1219 @@ -0,0 +1,20 @@
1220 +# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN )
1221 +# This macro evaluates its first argument
1222 +# and sets all the given vaiables either to 0 or 1
1223 +# depending on the value of the first one
1224 +
1225 +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
1226 +#
1227 +# Redistribution and use is allowed according to the terms of the BSD license.
1228 +# For details see the accompanying LICENSE file.
1229 +
1230 +
1231 +MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
1232 + FOREACH (_current_VAR ${ARGN})
1233 + IF(${FOUND_VAR})
1234 + SET(${_current_VAR} 1)
1235 + ELSE(${FOUND_VAR})
1236 + SET(${_current_VAR} 0)
1237 + ENDIF(${FOUND_VAR})
1238 + ENDFOREACH(_current_VAR)
1239 +ENDMACRO(MACRO_BOOL_TO_01)
1240 diff --git a/cmake/modules/MacroLogFeature.cmake b/cmake/modules/MacroLogFeature.cmake
1241 new file mode 100644
1242 index 0000000..5917a09
1243 --- /dev/null
1244 +++ b/cmake/modules/MacroLogFeature.cmake
1245 @@ -0,0 +1,159 @@
1246 +# This file defines the Feature Logging macros.
1247 +#
1248 +# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
1249 +# Logs the information so that it can be displayed at the end
1250 +# of the configure run
1251 +# VAR : TRUE or FALSE, indicating whether the feature is supported
1252 +# FEATURE: name of the feature, e.g. "libjpeg"
1253 +# DESCRIPTION: description what this feature provides
1254 +# URL: home page
1255 +# REQUIRED: TRUE or FALSE, indicating whether the feature is required
1256 +# MIN_VERSION: minimum version number. empty string if unneeded
1257 +# COMMENTS: More info you may want to provide. empty string if unnecessary
1258 +#
1259 +# MACRO_DISPLAY_FEATURE_LOG()
1260 +# Call this to display the collected results.
1261 +# Exits CMake with a FATAL error message if a required feature is missing
1262 +#
1263 +# Example:
1264 +#
1265 +# INCLUDE(MacroLogFeature)
1266 +#
1267 +# FIND_PACKAGE(JPEG)
1268 +# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
1269 +# ...
1270 +# MACRO_DISPLAY_FEATURE_LOG()
1271 +
1272 +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
1273 +# Copyright (c) 2006, Allen Winter, <winter@kde.org>
1274 +# Copyright (c) 2009, Sebastian Trueg, <trueg@kde.org>
1275 +#
1276 +# Redistribution and use is allowed according to the terms of the BSD license.
1277 +# For details see the accompanying LICENSE file.
1278 +
1279 +IF (NOT _macroLogFeatureAlreadyIncluded)
1280 + SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
1281 + IF (EXISTS ${_file})
1282 + FILE(REMOVE ${_file})
1283 + ENDIF (EXISTS ${_file})
1284 +
1285 + SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
1286 + IF (EXISTS ${_file})
1287 + FILE(REMOVE ${_file})
1288 + ENDIF (EXISTS ${_file})
1289 +
1290 + SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
1291 + IF (EXISTS ${_file})
1292 + FILE(REMOVE ${_file})
1293 + ENDIF (EXISTS ${_file})
1294 +
1295 + SET(_macroLogFeatureAlreadyIncluded TRUE)
1296 +
1297 + INCLUDE(FeatureSummary)
1298 +
1299 +ENDIF (NOT _macroLogFeatureAlreadyIncluded)
1300 +
1301 +
1302 +MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
1303 +
1304 + STRING(TOUPPER "${ARGV4}" _required)
1305 + SET(_minvers "${ARGV5}")
1306 + SET(_comments "${ARGV6}")
1307 +
1308 + IF (${_var})
1309 + SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
1310 + ELSE (${_var})
1311 + IF ("${_required}" STREQUAL "TRUE")
1312 + SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
1313 + ELSE ("${_required}" STREQUAL "TRUE")
1314 + SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
1315 + ENDIF ("${_required}" STREQUAL "TRUE")
1316 + ENDIF (${_var})
1317 +
1318 + SET(_logtext " * ${_package}")
1319 +
1320 + IF (NOT ${_var})
1321 + IF (${_minvers} MATCHES ".*")
1322 + SET(_logtext "${_logtext} (${_minvers} or higher)")
1323 + ENDIF (${_minvers} MATCHES ".*")
1324 + SET(_logtext "${_logtext} <${_url}>\n ")
1325 + ELSE (NOT ${_var})
1326 + SET(_logtext "${_logtext} - ")
1327 + ENDIF (NOT ${_var})
1328 +
1329 + SET(_logtext "${_logtext}${_description}")
1330 +
1331 + IF (NOT ${_var})
1332 + IF (${_comments} MATCHES ".*")
1333 + SET(_logtext "${_logtext}\n ${_comments}")
1334 + ENDIF (${_comments} MATCHES ".*")
1335 +# SET(_logtext "${_logtext}\n") #double-space missing features?
1336 + ENDIF (NOT ${_var})
1337 +
1338 + FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
1339 +
1340 + IF(COMMAND SET_PACKAGE_PROPERTIES)
1341 + SET_PACKAGE_PROPERTIES("${_package}" PROPERTIES URL "${_url}" DESCRIPTION "\"${_description}\"")
1342 + ELSEIF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3
1343 + SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"")
1344 + ENDIF(COMMAND SET_PACKAGE_PROPERTIES)
1345 +
1346 +ENDMACRO(MACRO_LOG_FEATURE)
1347 +
1348 +
1349 +MACRO(MACRO_DISPLAY_FEATURE_LOG)
1350 + IF(COMMAND FEATURE_SUMMARY) # in FeatureSummary.cmake since CMake 2.8.3
1351 + FEATURE_SUMMARY(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/FindPackageLog.txt
1352 + WHAT ALL)
1353 + ENDIF(COMMAND FEATURE_SUMMARY)
1354 +
1355 + SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
1356 + SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
1357 + SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
1358 +
1359 + IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
1360 + SET(_printSummary TRUE)
1361 + ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
1362 +
1363 + IF(_printSummary)
1364 + SET(_missingDeps 0)
1365 + IF (EXISTS ${_enabledFile})
1366 + FILE(READ ${_enabledFile} _enabled)
1367 + FILE(REMOVE ${_enabledFile})
1368 + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}")
1369 + ENDIF (EXISTS ${_enabledFile})
1370 +
1371 +
1372 + IF (EXISTS ${_disabledFile})
1373 + SET(_missingDeps 1)
1374 + FILE(READ ${_disabledFile} _disabled)
1375 + FILE(REMOVE ${_disabledFile})
1376 + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}")
1377 + ENDIF (EXISTS ${_disabledFile})
1378 +
1379 +
1380 + IF (EXISTS ${_missingFile})
1381 + SET(_missingDeps 1)
1382 + FILE(READ ${_missingFile} _requirements)
1383 + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}")
1384 + FILE(REMOVE ${_missingFile})
1385 + SET(_haveMissingReq 1)
1386 + ENDIF (EXISTS ${_missingFile})
1387 +
1388 +
1389 + IF (NOT ${_missingDeps})
1390 + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.")
1391 + ENDIF (NOT ${_missingDeps})
1392 +
1393 +
1394 + MESSAGE(${_summary})
1395 + MESSAGE("-----------------------------------------------------------------------------\n")
1396 +
1397 +
1398 + IF(_haveMissingReq)
1399 + MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
1400 + ENDIF(_haveMissingReq)
1401 +
1402 + ENDIF(_printSummary)
1403 +
1404 +ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)
1405 diff --git a/cmake/modules/MacroOptionalFindPackage.cmake b/cmake/modules/MacroOptionalFindPackage.cmake
1406 new file mode 100644
1407 index 0000000..05fa139
1408 --- /dev/null
1409 +++ b/cmake/modules/MacroOptionalFindPackage.cmake
1410 @@ -0,0 +1,48 @@
1411 +# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
1412 +# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
1413 +# This macro is a combination of OPTION() and FIND_PACKAGE(), it
1414 +# works like FIND_PACKAGE(), but additionally it automatically creates
1415 +# an option name WITH_<name>, which can be disabled via the cmake GUI.
1416 +# or via -DWITH_<name>=OFF
1417 +# The standard <name>_FOUND variables can be used in the same way
1418 +# as when using the normal FIND_PACKAGE()
1419 +
1420 +# Copyright (c) 2006-2010 Alexander Neundorf, <neundorf@kde.org>
1421 +#
1422 +# Redistribution and use is allowed according to the terms of the BSD license.
1423 +# For details see the accompanying LICENSE file.
1424 +
1425 +# This is just a helper macro to set a bunch of variables empty.
1426 +# We don't know whether the package uses UPPERCASENAME or CamelCaseName, so we try both:
1427 +macro(_MOFP_SET_EMPTY_IF_DEFINED _name _var)
1428 + if(DEFINED ${_name}_${_var})
1429 + set(${_name}_${_var} "")
1430 + endif(DEFINED ${_name}_${_var})
1431 +
1432 + string(TOUPPER ${_name} _nameUpper)
1433 + if(DEFINED ${_nameUpper}_${_var})
1434 + set(${_nameUpper}_${_var} "")
1435 + endif(DEFINED ${_nameUpper}_${_var})
1436 +endmacro(_MOFP_SET_EMPTY_IF_DEFINED _package _var)
1437 +
1438 +
1439 +macro (MACRO_OPTIONAL_FIND_PACKAGE _name )
1440 + option(WITH_${_name} "Search for ${_name} package" ON)
1441 + if (WITH_${_name})
1442 + find_package(${_name} ${ARGN})
1443 + else (WITH_${_name})
1444 + string(TOUPPER ${_name} _nameUpper)
1445 + set(${_name}_FOUND FALSE)
1446 + set(${_nameUpper}_FOUND FALSE)
1447 +
1448 + _mofp_set_empty_if_defined(${_name} INCLUDE_DIRS)
1449 + _mofp_set_empty_if_defined(${_name} INCLUDE_DIR)
1450 + _mofp_set_empty_if_defined(${_name} INCLUDES)
1451 + _mofp_set_empty_if_defined(${_name} LIBRARY)
1452 + _mofp_set_empty_if_defined(${_name} LIBRARIES)
1453 + _mofp_set_empty_if_defined(${_name} LIBS)
1454 + _mofp_set_empty_if_defined(${_name} FLAGS)
1455 + _mofp_set_empty_if_defined(${_name} DEFINITIONS)
1456 + endif (WITH_${_name})
1457 +endmacro (MACRO_OPTIONAL_FIND_PACKAGE)
1458 +
1459 diff --git a/cmake/modules/Uninstall.cmake b/cmake/modules/Uninstall.cmake
1460 new file mode 100644
1461 index 0000000..36dd9ba
1462 --- /dev/null
1463 +++ b/cmake/modules/Uninstall.cmake
1464 @@ -0,0 +1,22 @@
1465 +IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
1466 + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
1467 +ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
1468 +
1469 +FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
1470 +STRING(REGEX REPLACE "\n" ";" files "${files}")
1471 +FOREACH(file ${files})
1472 + MESSAGE(STATUS "Uninstalling \"${file}\"")
1473 + IF(EXISTS "${file}")
1474 + EXEC_PROGRAM(
1475 + "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
1476 + OUTPUT_VARIABLE rm_out
1477 + RETURN_VALUE rm_retval
1478 + )
1479 + IF("${rm_retval}" STREQUAL 0)
1480 + ELSE("${rm_retval}" STREQUAL 0)
1481 + MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
1482 + ENDIF("${rm_retval}" STREQUAL 0)
1483 + ELSE(EXISTS "${file}")
1484 + MESSAGE(STATUS "File \"${file}\" does not exist.")
1485 + ENDIF(EXISTS "${file}")
1486 +ENDFOREACH(file)
1487 --
1488 2.30.1.windows.1
1489