mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
Canon CR3 support
Canon CR3 support and Small UI fixes
This commit is contained in:
1
libraw/src/main/cpp/LibRaw-cmake/.gitattributes
vendored
Normal file
1
libraw/src/main/cpp/LibRaw-cmake/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
* text=auto
|
33
libraw/src/main/cpp/LibRaw-cmake/.github/workflows/ci.yml
vendored
Normal file
33
libraw/src/main/cpp/LibRaw-cmake/.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
env:
|
||||
LIBRAW_GIT: https://github.com/LibRaw/LibRaw.git
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
libraw_ref: ['0.20.2', 'master']
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- run: git clone $LIBRAW_GIT -b ${{ matrix.libraw_ref }}
|
||||
name: Clone LibRaw
|
||||
|
||||
- run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DENABLE_OPENMP=OFF -DLIBRAW_PATH=$(pwd)/../LibRaw ..
|
||||
cmake --build .
|
||||
name: Build LibRaw
|
2
libraw/src/main/cpp/LibRaw-cmake/.gitignore
vendored
Normal file
2
libraw/src/main/cpp/LibRaw-cmake/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/.project
|
||||
build
|
723
libraw/src/main/cpp/LibRaw-cmake/CMakeLists.txt
Normal file
723
libraw/src/main/cpp/LibRaw-cmake/CMakeLists.txt
Normal file
@ -0,0 +1,723 @@
|
||||
# ===========================================================
|
||||
#
|
||||
# This file is a part of Libraw project
|
||||
# <a href="http://www.libraw.org">http://www.libraw.org</a>
|
||||
#
|
||||
# @date 2013-09-07
|
||||
# @brief Library for reading and processing of RAW images
|
||||
#
|
||||
# @author Copyright (C) 2013 by Gilles Caulier
|
||||
# <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
|
||||
#
|
||||
# This program is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General
|
||||
# Public License as published by the Free Software Foundation;
|
||||
# either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# ============================================================
|
||||
|
||||
cmake_minimum_required(VERSION 3.12..16)
|
||||
|
||||
|
||||
# Determine if libraw is built as a subproject (using add_subdirectory)
|
||||
# or if it is the master project.
|
||||
set(MASTER_PROJECT OFF)
|
||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(MASTER_PROJECT ON)
|
||||
message(STATUS "CMake version: ${CMAKE_VERSION}")
|
||||
endif ()
|
||||
|
||||
set(LIBRAW_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Relative path to libraw directory (default=CMAKE_CURRENT_SOURCE_DIR)")
|
||||
if(NOT EXISTS "${LIBRAW_PATH}")
|
||||
message(STATUS "LIBRAW_PATH=${LIBRAW_PATH}")
|
||||
message(FATAL_ERROR "LIBRAW_PATH does not contain a valid path to the libraw home")
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "${LIBRAW_PATH}" LIBRAW_PATH)
|
||||
|
||||
# ==================================================================================================
|
||||
# Library version info extraction
|
||||
|
||||
file(READ ${LIBRAW_PATH}/libraw/libraw_version.h _libraw_version_content)
|
||||
|
||||
# API version strings
|
||||
string(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
|
||||
set(RAW_LIB_MAJOR_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
string(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content})
|
||||
set(RAW_LIB_MINOR_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
string(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
|
||||
set(RAW_LIB_PATCH_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
# ABI version strings
|
||||
|
||||
string(REGEX MATCH "#define LIBRAW_SHLIB_CURRENT[ \t]*([0-9]*)\n" _version_socur_match ${_libraw_version_content})
|
||||
set(RAW_LIB_SO_CUR_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
string(REGEX MATCH "#define LIBRAW_SHLIB_REVISION[ \t]*([0-9]*)\n" _version_sorev_match ${_libraw_version_content})
|
||||
set(RAW_LIB_SO_REV_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
string(REGEX MATCH "#define LIBRAW_SHLIB_AGE[ \t]*([0-9]*)\n" _version_soage_match ${_libraw_version_content})
|
||||
set(RAW_LIB_SO_AGE_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
# Set env. variables accordinly.
|
||||
set(RAW_LIB_VERSION_STRING "${RAW_LIB_MAJOR_VERSION}.${RAW_LIB_MINOR_VERSION}.${RAW_LIB_PATCH_VERSION}")
|
||||
set(RAW_LIB_VERSION_ID "0x${RAW_LIB_MAJOR_VERSION}${RAW_LIB_MINOR_VERSION}${RAW_LIB_PATCH_VERSION}")
|
||||
set(RAW_LIB_SO_VERSION_STRING "${RAW_LIB_SO_CUR_VERSION}.${RAW_LIB_SO_REV_VERSION}.${RAW_LIB_SO_AGE_VERSION}")
|
||||
|
||||
message(STATUS "LibRaw string version: ${RAW_LIB_VERSION_STRING}")
|
||||
message(STATUS "LibRaw ID version: ${RAW_LIB_VERSION_ID}")
|
||||
message(STATUS "LibRaw SO version: ${RAW_LIB_SO_VERSION_STRING}")
|
||||
|
||||
project(libraw VERSION ${RAW_LIB_VERSION_STRING} LANGUAGES CXX)
|
||||
|
||||
# ==================================================================================================
|
||||
# Project Options
|
||||
option(BUILD_SHARED_LIBS "Build library as shared library (default=ON)" ON)
|
||||
option(ENABLE_OPENMP "Build library with OpenMP support (default=ON)" ON)
|
||||
option(ENABLE_LCMS "Build library with LCMS support (default=ON)" ON)
|
||||
option(ENABLE_JASPER "Build library with libjasper support (default=ON)" ON)
|
||||
option(ENABLE_EXAMPLES "Build library with sample command-line programs (default=ON)" ${MASTER_PROJECT})
|
||||
option(ENABLE_RAWSPEED "Build library with extra RawSpeed codec support (default=OFF)" OFF)
|
||||
option(ENABLE_DCRAW_DEBUG "Build library with debug message from dcraw (default=OFF)" OFF)
|
||||
option(ENABLE_X3FTOOLS "Build library with Foveon X3F support (default=OFF)" OFF)
|
||||
option(ENABLE_6BY9RPI "Build library with Raspberry Pi RAW support (default=OFF)" OFF)
|
||||
option(LIBRAW_UNINSTALL_TARGET "Add a custom target to ease removal of installed targets" ${MASTER_PROJECT})
|
||||
option(LIBRAW_INSTALL "Generate the install target." ${MASTER_PROJECT})
|
||||
|
||||
set(RAWSPEED_RPATH "RawSpeed" CACHE STRING
|
||||
"Relative path to extra RawSpeed codec (default=RawSpeed)")
|
||||
|
||||
set(RAWSPEED_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${RAWSPEED_RPATH}")
|
||||
|
||||
# ==================================================================================================
|
||||
# General definitions rules
|
||||
|
||||
if(WIN32 AND NOT DEFINED CMAKE_DEBUG_POSTFIX)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
endif()
|
||||
|
||||
# To prevent warnings from M$ compiler
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_ATL_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_AFX_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# -- Check dependencies --------------------------------------------------------------------------------
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
|
||||
|
||||
include(MacroBoolTo01)
|
||||
include(MacroLogFeature)
|
||||
include(MacroOptionalFindPackage)
|
||||
|
||||
# Math library check
|
||||
|
||||
if(NOT WIN32)
|
||||
FIND_LIBRARY(MATH_LIBRARY m)
|
||||
endif()
|
||||
|
||||
# LCMS version 1 and 2 library check
|
||||
|
||||
set(LCMS_SUPPORT_CAN_BE_COMPILED false)
|
||||
set(LCMS2_FOUND false)
|
||||
set(LCMS_FOUND false)
|
||||
|
||||
if(ENABLE_LCMS)
|
||||
message(STATUS "Check for LCMS2 availability...")
|
||||
find_package(LCMS2)
|
||||
if(LCMS2_FOUND AND (LCMS2_VERSION VERSION_EQUAL 2.1 OR LCMS2_VERSION VERSION_GREATER 2.1))
|
||||
message(STATUS "Found LCMS2 : ${LCMS2_LIBRARIES} ${LCMS2_INCLUDE_DIR}")
|
||||
include_directories(${LCMS2_INCLUDE_DIR})
|
||||
MACRO_LOG_FEATURE(LCMS2_FOUND "LCMS2" "A small-footprint color management engine" "http://www.littlecms.com" FALSE "" "Needed by libkdcraw")
|
||||
# Flag to compile Little CMS version 2 with LibRaw
|
||||
add_definitions(-DUSE_LCMS2)
|
||||
set(LCMS_SUPPORT_CAN_BE_COMPILED true)
|
||||
else()
|
||||
message(STATUS "Check for LCMS availability instead LCMS2...")
|
||||
find_package(LCMS)
|
||||
if(LCMS_FOUND)
|
||||
message(STATUS "Found LCMS1: ${LCMS_LIBRARIES} ${LCMS_INCLUDE_DIR}")
|
||||
include_directories(${LCMS_INCLUDE_DIR})
|
||||
MACRO_LOG_FEATURE(LCMS_FOUND "LCMS1" "A small-footprint color management engine" "http://www.littlecms.com" TRUE "" "Needed by libkdcraw")
|
||||
# Flag to compile Little CMS version 1 with LibRaw
|
||||
add_definitions(-DUSE_LCMS)
|
||||
# For compatibility
|
||||
set(LCMS2_LIBRARIES ${LCMS_LIBRARIES})
|
||||
set(LCMS_SUPPORT_CAN_BE_COMPILED true)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(LCMS_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_LCMS)
|
||||
|
||||
# zlib library check
|
||||
|
||||
find_package(ZLIB)
|
||||
find_package(JPEG)
|
||||
|
||||
# Flag to use zlib with LibRaw DNG deflate codec
|
||||
if(ZLIB_FOUND)
|
||||
add_definitions(-DUSE_ZLIB)
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(ZLIB_FOUND LIBRAW_USE_DNGDEFLATECODEC)
|
||||
|
||||
# JPEG library check
|
||||
find_package(JPEG)
|
||||
if(JPEG_FOUND)
|
||||
if (${JPEG_VERSION} LESS 80)
|
||||
set(JPEG8_FOUND FALSE)
|
||||
else()
|
||||
set(JPEG8_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
MACRO_LOG_FEATURE(JPEG8_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" FALSE "80" "needed for the LibRaw DNG lossy codec")
|
||||
|
||||
# Flag to use libjpeg with LibRaw DNG lossy codec
|
||||
if(JPEG8_FOUND)
|
||||
add_definitions(-DUSE_JPEG)
|
||||
add_definitions(-DUSE_JPEG8)
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(JPEG8_FOUND LIBRAW_USE_DNGLOSSYCODEC)
|
||||
|
||||
if(ENABLE_OPENMP)
|
||||
find_package(OpenMP REQUIRED)
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(OpenMP_FOUND LIBRAW_USE_OPENMP)
|
||||
|
||||
# Jasper library check
|
||||
set(JASPER_FOUND false)
|
||||
if(ENABLE_JASPER)
|
||||
find_package(Jasper)
|
||||
|
||||
# Flag to use libjasper with LibRaw RedCine codec
|
||||
if(JASPER_FOUND)
|
||||
add_definitions(-DUSE_JASPER)
|
||||
include_directories(${JASPER_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(JASPER_FOUND LIBRAW_USE_REDCINECODEC)
|
||||
|
||||
# For RawSpeed Codec Support
|
||||
|
||||
set(RAWSPEED_FOUND false)
|
||||
set(RAWSPEED_SUPPORT_CAN_BE_COMPILED false)
|
||||
|
||||
if(ENABLE_RAWSPEED)
|
||||
find_package(LibXml2)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
message(STATUS "RawSpeed codec path: ${RAWSPEED_PATH}")
|
||||
|
||||
if(EXISTS "${RAWSPEED_PATH}/Common.cpp")
|
||||
set(RAWSPEED_FOUND true)
|
||||
else()
|
||||
message(STATUS "RawSpeed source code not found. Please checkout source code from RawStudio project website.")
|
||||
endif()
|
||||
|
||||
if(ENABLE_RAWSPEED AND RAWSPEED_FOUND AND JPEG8_FOUND AND LIBXML2_FOUND AND PTHREADS_FOUND)
|
||||
|
||||
set(RAWSPEED_SUPPORT_CAN_BE_COMPILED true)
|
||||
|
||||
else()
|
||||
if(NOT JPEG8_FOUND)
|
||||
message(STATUS "LibJPEG dependency not resolved. LibRaw cannot be compiled with RawSpeed codec")
|
||||
endif()
|
||||
|
||||
if(NOT LIBXML2_FOUND)
|
||||
message(STATUS "LibXML2 dependency not resolved. LibRaw cannot be compiled with RawSpeed codec")
|
||||
endif()
|
||||
|
||||
if(NOT PTHREADS_FOUND)
|
||||
message(STATUS "Pthreads dependency not resolved. LibRaw cannot be compiled with RawSpeed codec")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(RAWSPEED_SUPPORT_CAN_BE_COMPILED LIBRAW_USE_RAWSPEED)
|
||||
|
||||
# -- Compilation rules for RawSpeed library -------------------------------------------------------------
|
||||
|
||||
if(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
|
||||
include_directories(${RAWSPEED_PATH})
|
||||
|
||||
include_directories(${LIBXML2_INCLUDE_DIR} ${PTHREADS_INCLUDE_DIR})
|
||||
|
||||
# Flag to include RawSpeed codec with Libraw
|
||||
add_definitions(-DUSE_RAWSPEED)
|
||||
|
||||
add_definitions(${LIBXML2_DEFINITIONS} ${PTHREADS_DEFINITIONS})
|
||||
|
||||
set(librawspeed_LIB_SRCS ${RAWSPEED_PATH}/ArwDecoder.cpp
|
||||
${RAWSPEED_PATH}/BitPumpJPEG.cpp
|
||||
${RAWSPEED_PATH}/BitPumpMSB.cpp
|
||||
${RAWSPEED_PATH}/BitPumpMSB32.cpp
|
||||
${RAWSPEED_PATH}/BitPumpPlain.cpp
|
||||
${RAWSPEED_PATH}/BlackArea.cpp
|
||||
${RAWSPEED_PATH}/ByteStream.cpp
|
||||
${RAWSPEED_PATH}/ByteStreamSwap.cpp
|
||||
${RAWSPEED_PATH}/Camera.cpp
|
||||
${RAWSPEED_PATH}/CameraMetaData.cpp
|
||||
${RAWSPEED_PATH}/CameraMetadataException.cpp
|
||||
${RAWSPEED_PATH}/CameraSensorInfo.cpp
|
||||
${RAWSPEED_PATH}/ColorFilterArray.cpp
|
||||
${RAWSPEED_PATH}/Common.cpp
|
||||
${RAWSPEED_PATH}/Cr2Decoder.cpp
|
||||
${RAWSPEED_PATH}/DngDecoder.cpp
|
||||
${RAWSPEED_PATH}/DngDecoderSlices.cpp
|
||||
${RAWSPEED_PATH}/DngOpcodes.cpp
|
||||
${RAWSPEED_PATH}/FileIOException.cpp
|
||||
${RAWSPEED_PATH}/FileMap.cpp
|
||||
${RAWSPEED_PATH}/IOException.cpp
|
||||
${RAWSPEED_PATH}/LJpegDecompressor.cpp
|
||||
${RAWSPEED_PATH}/LJpegPlain.cpp
|
||||
${RAWSPEED_PATH}/NefDecoder.cpp
|
||||
${RAWSPEED_PATH}/NikonDecompressor.cpp
|
||||
${RAWSPEED_PATH}/OrfDecoder.cpp
|
||||
${RAWSPEED_PATH}/PefDecoder.cpp
|
||||
${RAWSPEED_PATH}/PentaxDecompressor.cpp
|
||||
${RAWSPEED_PATH}/RawDecoder.cpp
|
||||
${RAWSPEED_PATH}/RawDecoderException.cpp
|
||||
${RAWSPEED_PATH}/RawImage.cpp
|
||||
${RAWSPEED_PATH}/RawImageDataFloat.cpp
|
||||
${RAWSPEED_PATH}/RawImageDataU16.cpp
|
||||
${RAWSPEED_PATH}/RawParser.cpp
|
||||
${RAWSPEED_PATH}/Rw2Decoder.cpp
|
||||
${RAWSPEED_PATH}/SrwDecoder.cpp
|
||||
${RAWSPEED_PATH}/TiffEntry.cpp
|
||||
${RAWSPEED_PATH}/TiffEntryBE.cpp
|
||||
${RAWSPEED_PATH}/TiffIFD.cpp
|
||||
${RAWSPEED_PATH}/TiffIFDBE.cpp
|
||||
${RAWSPEED_PATH}/TiffParser.cpp
|
||||
${RAWSPEED_PATH}/TiffParserException.cpp
|
||||
${RAWSPEED_PATH}/TiffParserHeaderless.cpp
|
||||
${RAWSPEED_PATH}/TiffParserOlympus.cpp
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# -- Common LibRaw library compilation rules ------------------------------------------------------------------
|
||||
|
||||
# Flag to add debug print on the console
|
||||
if(ENABLE_DCRAW_DEBUG)
|
||||
add_definitions(-DDCRAW_VERBOSE)
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(ENABLE_DCRAW_DEBUG LIBRAW_USE_DCRAW_DEBUG)
|
||||
|
||||
# Flag to add Foveon X3F support
|
||||
if(ENABLE_X3FTOOLS)
|
||||
add_definitions(-DUSE_X3FTOOLS)
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(ENABLE_X3FTOOLS LIBRAW_USE_X3FTOOLS)
|
||||
|
||||
# Flag to add Raspberry Pi RAW support
|
||||
if(ENABLE_6BY9RPI)
|
||||
add_definitions(-DUSE_6BY9RPI)
|
||||
endif()
|
||||
|
||||
# For registration to libraw_config.h
|
||||
MACRO_BOOL_TO_01(ENABLE_6BY9RPI LIBRAW_USE_6BY9RPI)
|
||||
|
||||
# Create a config header for client application.
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw_config.h)
|
||||
|
||||
# Put the include dirs which are in the source or build tree
|
||||
# before all other include dirs, so the headers in the sources
|
||||
# are preferred over the already installed ones
|
||||
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/
|
||||
${LIBRAW_PATH}/
|
||||
)
|
||||
|
||||
# -- Log messages about configuration ------------------------------------------------------------------
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "----------------------------------------------------------------------------------")
|
||||
message(STATUS " Libraw ${RAW_LIB_VERSION_STRING} configuration <http://www.libraw.org>")
|
||||
message(STATUS "")
|
||||
|
||||
if(OpenMP_FOUND)
|
||||
message(STATUS " Libraw will be compiled with OpenMP support .................. YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with OpenMP support .................. NO")
|
||||
endif()
|
||||
|
||||
if(LCMS_SUPPORT_CAN_BE_COMPILED)
|
||||
message(STATUS " Libraw will be compiled with LCMS support .................... YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with LCMS support .................... NO")
|
||||
endif()
|
||||
|
||||
if(ENABLE_EXAMPLES)
|
||||
message(STATUS " Libraw will be compiled with example command-line programs ... YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with example command-line programs ... NO")
|
||||
endif()
|
||||
|
||||
if(JASPER_FOUND)
|
||||
message(STATUS " Libraw will be compiled with RedCine codec support ........... YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with RedCine codec support ........... NO")
|
||||
endif()
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
message(STATUS " Libraw will be compiled with DNG deflate codec support ....... YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with DNG deflate codec support ....... NO")
|
||||
endif()
|
||||
|
||||
if(JPEG8_FOUND)
|
||||
message(STATUS " Libraw will be compiled with DNG lossy codec support ......... YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with DNG lossy codec support ......... NO")
|
||||
endif()
|
||||
|
||||
if(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
|
||||
message(STATUS " Libraw will be compiled with RawSpeed support ................ YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with RawSpeed support ................ NO")
|
||||
endif()
|
||||
|
||||
if(ENABLE_DCRAW_DEBUG)
|
||||
message(STATUS " Libraw will be compiled with debug message from dcraw ........ YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with debug message from dcraw ........ NO")
|
||||
endif()
|
||||
|
||||
if(ENABLE_X3FTOOLS)
|
||||
message(STATUS " Libraw will be compiled with Foveon X3F support .............. YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with Foveon X3F support .............. NO")
|
||||
endif()
|
||||
|
||||
if(ENABLE_6BY9RPI)
|
||||
message(STATUS " Libraw will be compiled with Raspberry Pi RAW support ........ YES")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled with Raspberry Pi RAW support ........ NO")
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
message(STATUS " Libraw will be compiled as a shared library")
|
||||
else()
|
||||
message(STATUS " Libraw will be compiled as a static library")
|
||||
endif()
|
||||
|
||||
message(STATUS "----------------------------------------------------------------------------------")
|
||||
message(STATUS "")
|
||||
|
||||
# -- Dedicated libraw target which does not support multi-threading ---------------------------------------
|
||||
|
||||
if(RAW_LIB_VERSION_STRING VERSION_LESS 0.21)
|
||||
set(libraw_LIB_SRCS ${LIBRAW_PATH}/internal/dcraw_common.cpp
|
||||
${LIBRAW_PATH}/internal/dcraw_fileio.cpp
|
||||
${LIBRAW_PATH}/internal/demosaic_packs.cpp
|
||||
${LIBRAW_PATH}/src/libraw_cxx.cpp
|
||||
${LIBRAW_PATH}/src/libraw_c_api.cpp
|
||||
${LIBRAW_PATH}/src/libraw_datastream.cpp
|
||||
)
|
||||
else()
|
||||
file(GLOB_RECURSE libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_PATH}/src/*.cpp")
|
||||
|
||||
# Exclude placeholder (stub) implementations
|
||||
file(GLOB_RECURSE exclude_libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_PATH}/src/*_ph.cpp")
|
||||
list(REMOVE_ITEM libraw_LIB_SRCS ${exclude_libraw_LIB_SRCS})
|
||||
endif()
|
||||
|
||||
if(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
|
||||
set(libraw_LIB_SRCS ${libraw_LIB_SRCS} ${librawspeed_LIB_SRCS})
|
||||
endif()
|
||||
|
||||
|
||||
add_library(raw ${libraw_LIB_SRCS})
|
||||
add_library(libraw::libraw ALIAS raw)
|
||||
target_compile_definitions(raw PRIVATE LIBRAW_NOTHREADS)
|
||||
|
||||
# Flag to export library symbols
|
||||
if (WIN32)
|
||||
target_compile_definitions(raw PRIVATE LIBRAW_BUILDLIB)
|
||||
endif()
|
||||
|
||||
# Static builds use LIBRAW_NODLL:
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(raw PUBLIC LIBRAW_NODLL)
|
||||
endif()
|
||||
|
||||
target_include_directories(raw
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:libraw>
|
||||
$<BUILD_INTERFACE:${LIBRAW_PATH}>)
|
||||
|
||||
target_link_libraries(raw PUBLIC ${MATH_LIBRARY})
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(raw PUBLIC ws2_32)
|
||||
endif()
|
||||
|
||||
if(OpenMP_FOUND)
|
||||
target_link_libraries(raw PUBLIC OpenMP::OpenMP_CXX)
|
||||
if(MINGW)
|
||||
target_compile_definitions(raw PRIVATE LIBRAW_FORCE_OPENMP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LCMS_SUPPORT_CAN_BE_COMPILED)
|
||||
target_link_libraries(raw PUBLIC ${LCMS2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
target_link_libraries(raw PUBLIC ZLIB::ZLIB)
|
||||
endif()
|
||||
|
||||
if(JPEG8_FOUND)
|
||||
target_link_libraries(raw PUBLIC JPEG::JPEG)
|
||||
endif()
|
||||
|
||||
if(JASPER_FOUND)
|
||||
target_link_libraries(raw PUBLIC ${JASPER_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
|
||||
target_link_libraries(raw PUBLIC ${LIBXML2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set_target_properties(raw PROPERTIES VERSION ${RAW_LIB_SO_VERSION_STRING})
|
||||
set_target_properties(raw PROPERTIES SOVERSION ${RAW_LIB_SO_CUR_VERSION})
|
||||
set_target_properties(raw PROPERTIES OUTPUT_NAME "raw")
|
||||
set_target_properties(raw PROPERTIES COMPILE_PDB_NAME "raw")
|
||||
|
||||
# -- Dedicated libraw target to support multi-threading ---------------------------------------------
|
||||
|
||||
set(libraw_r_LIB_SRCS ${libraw_LIB_SRCS})
|
||||
|
||||
add_library(raw_r ${libraw_r_LIB_SRCS})
|
||||
add_library(libraw::libraw_r ALIAS raw_r)
|
||||
|
||||
# Flag to export library symbols
|
||||
if(WIN32)
|
||||
target_compile_definitions(raw_r PRIVATE LIBRAW_BUILDLIB)
|
||||
endif()
|
||||
|
||||
# Static builds use LIBRAW_NODLL:
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(raw_r PUBLIC LIBRAW_NODLL)
|
||||
endif()
|
||||
|
||||
# Always build position-independent code (PIC), even when building Libraw as a
|
||||
# static library so that shared libraries can link against it, not just
|
||||
# executables (PIC does not apply on Windows).
|
||||
# Use set_target_properties() not append_target_property() here as
|
||||
# POSITION_INDEPENDENT_CODE is a binary ON/OFF switch.
|
||||
set_target_properties(raw PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
set_target_properties(raw_r PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
target_link_libraries(raw_r PUBLIC ${MATH_LIBRARY})
|
||||
target_include_directories(raw_r
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:libraw>
|
||||
$<BUILD_INTERFACE:${LIBRAW_PATH}>)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(raw_r PUBLIC ws2_32)
|
||||
endif()
|
||||
|
||||
if(OpenMP_FOUND)
|
||||
target_link_libraries(raw_r PUBLIC OpenMP::OpenMP_CXX)
|
||||
if(MINGW)
|
||||
target_compile_definitions(raw_r PRIVATE LIBRAW_FORCE_OPENMP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LCMS_SUPPORT_CAN_BE_COMPILED)
|
||||
target_link_libraries(raw_r PUBLIC ${LCMS2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
target_link_libraries(raw_r PUBLIC ZLIB::ZLIB)
|
||||
endif()
|
||||
|
||||
if(JPEG8_FOUND)
|
||||
target_link_libraries(raw_r PUBLIC JPEG::JPEG)
|
||||
endif()
|
||||
|
||||
if(JASPER_FOUND)
|
||||
target_link_libraries(raw_r PUBLIC ${JASPER_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(RAWSPEED_SUPPORT_CAN_BE_COMPILED)
|
||||
target_link_libraries(raw_r PUBLIC ${LIBXML2_LIBRARIES} Threads::Threads)
|
||||
endif()
|
||||
|
||||
set_target_properties(raw_r PROPERTIES VERSION ${RAW_LIB_SO_VERSION_STRING})
|
||||
set_target_properties(raw_r PROPERTIES SOVERSION ${RAW_LIB_SO_CUR_VERSION})
|
||||
set_target_properties(raw_r PROPERTIES OUTPUT_NAME "raw_r")
|
||||
set_target_properties(raw_r PROPERTIES COMPILE_PDB_NAME "raw_r")
|
||||
|
||||
# -- Files to install -------------------------------------------------------------------------------------
|
||||
if (LIBRAW_INSTALL)
|
||||
# Configure and install data file for packaging.
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(NOT MSVC)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libraw.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw_r.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw_r.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libraw_r.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/data/libraw.lsm.cmake ${CMAKE_CURRENT_BINARY_DIR}/libraw.lsm)
|
||||
endif()
|
||||
|
||||
# Install Shared header files.
|
||||
install(FILES ${LIBRAW_PATH}/libraw/libraw.h
|
||||
${LIBRAW_PATH}/libraw/libraw_alloc.h
|
||||
${LIBRAW_PATH}/libraw/libraw_const.h
|
||||
${LIBRAW_PATH}/libraw/libraw_datastream.h
|
||||
${LIBRAW_PATH}/libraw/libraw_internal.h
|
||||
${LIBRAW_PATH}/libraw/libraw_types.h
|
||||
${LIBRAW_PATH}/libraw/libraw_version.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libraw_config.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libraw
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
# Install Shared binary files.
|
||||
install(TARGETS raw raw_r
|
||||
EXPORT ${PROJECT_NAME}Targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
|
||||
message("ClangCl does not support pdb generation with static libraries")
|
||||
elseif(MSVC)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/raw.pdb ${PROJECT_BINARY_DIR}/raw_r.pdb
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
CONFIGURATIONS Debug RelWithDebInfo
|
||||
)
|
||||
endif()
|
||||
|
||||
# Install find cmake script to the system for client applications.
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindLibRaw.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/libraw)
|
||||
|
||||
# Install doc data files.
|
||||
if(NOT MSVC)
|
||||
install(FILES ${LIBRAW_PATH}/COPYRIGHT
|
||||
${LIBRAW_PATH}/LICENSE.CDDL
|
||||
${LIBRAW_PATH}/LICENSE.LGPL
|
||||
${LIBRAW_PATH}/Changelog.txt
|
||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
# Uninstall rules
|
||||
if(LIBRAW_UNINSTALL_TARGET)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/Uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY)
|
||||
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
endif()
|
||||
|
||||
# Export the package for use from the build tree
|
||||
export(TARGETS raw raw_r
|
||||
NAMESPACE libraw:: FILE cmake/${PROJECT_NAME}Targets.cmake)
|
||||
export(PACKAGE ${PROJECT_NAME})
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
cmake/${PROJECT_NAME}ConfigVersion.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
configure_package_config_file(
|
||||
cmake/${PROJECT_NAME}Config.cmake.in
|
||||
cmake/${PROJECT_NAME}Config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/)
|
||||
|
||||
install(EXPORT ${PROJECT_NAME}Targets
|
||||
NAMESPACE libraw:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/)
|
||||
endif(LIBRAW_INSTALL)
|
||||
|
||||
# -- Compile LibRaw Examples --------------------------------------------------------------------------------
|
||||
|
||||
# add a small macro so that this is a bit cleaner
|
||||
macro(LIBRAW_BUILD_SAMPLES)
|
||||
set(_filename ${ARGV0})
|
||||
set(_rawlib ${ARGV1})
|
||||
string(REPLACE "." ";" _temp ${_filename})
|
||||
list(GET _temp 0 _target)
|
||||
|
||||
set(${_target}_SRCS ${LIBRAW_PATH}/samples/${_filename})
|
||||
|
||||
add_executable(${_target} ${${_target}_SRCS})
|
||||
target_compile_options(${_target} PRIVATE -w)
|
||||
|
||||
target_link_libraries(${_target} PRIVATE ${_rawlib})
|
||||
|
||||
if(${_rawlib} MATCHES "raw_r")
|
||||
target_link_libraries(${_target} PUBLIC ${PTHREADS_LIBRARY})
|
||||
endif()
|
||||
|
||||
install(TARGETS ${_target}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endmacro(LIBRAW_BUILD_SAMPLES)
|
||||
|
||||
if(ENABLE_EXAMPLES)
|
||||
LIBRAW_BUILD_SAMPLES(simple_dcraw.cpp raw)
|
||||
|
||||
if(EXISTS mem_image.cpp)
|
||||
LIBRAW_BUILD_SAMPLES(mem_image.cpp raw)
|
||||
else()
|
||||
LIBRAW_BUILD_SAMPLES(mem_image_sample.cpp raw)
|
||||
endif()
|
||||
|
||||
LIBRAW_BUILD_SAMPLES(dcraw_emu.cpp raw)
|
||||
LIBRAW_BUILD_SAMPLES(4channels.cpp raw)
|
||||
LIBRAW_BUILD_SAMPLES(unprocessed_raw.cpp raw)
|
||||
LIBRAW_BUILD_SAMPLES(raw-identify.cpp raw)
|
||||
LIBRAW_BUILD_SAMPLES(multirender_test.cpp raw)
|
||||
LIBRAW_BUILD_SAMPLES(postprocessing_benchmark.cpp raw)
|
||||
|
||||
if(TARGET Threads::Threads)
|
||||
if(MSVC)
|
||||
LIBRAW_BUILD_SAMPLES(half_mt_win32.c raw_r)
|
||||
else()
|
||||
LIBRAW_BUILD_SAMPLES(dcraw_half.c raw_r)
|
||||
LIBRAW_BUILD_SAMPLES(half_mt.c raw_r)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
62
libraw/src/main/cpp/LibRaw-cmake/INSTALL.CMAKE
Normal file
62
libraw/src/main/cpp/LibRaw-cmake/INSTALL.CMAKE
Normal file
@ -0,0 +1,62 @@
|
||||
|
||||
========= Installing LibRaw (CMake version) ==========
|
||||
|
||||
I. Installation steps
|
||||
|
||||
1. Unpack the distribution file:
|
||||
|
||||
$ tar xzvf LibRaw-0.xx.yy.tar.gz
|
||||
|
||||
2. Copy this LibRaw-cmake scripts in LibRaw-... folder
|
||||
|
||||
3. Go to LibRaw folder and run ./configure and make:
|
||||
|
||||
$ cd LibRaw-0.xx.yy
|
||||
$ ./cmake [...optional args...] .
|
||||
$ make
|
||||
|
||||
4. install by run make install as root:
|
||||
|
||||
$ sudo make install
|
||||
|
||||
|
||||
II. ./cmake options
|
||||
|
||||
-DENABLE_OPENMP=ON/OFF
|
||||
|
||||
Enable/disable OpenMP support if compiler supports it.
|
||||
OpenMP is enabled by default.
|
||||
|
||||
|
||||
-DENABLE_LCMS=ON/OFF
|
||||
|
||||
Enable/disable LCMS color engine support. If enabled, ./cmake will try to
|
||||
find lcms library. Both LCMS-1.x and LCMS-2.x are supported
|
||||
LCMS support is enabled by default
|
||||
|
||||
|
||||
-DENABLE_EXAMPLES=ON/OFF
|
||||
|
||||
Enables/disables examples compilation and installation. Enabled by default
|
||||
|
||||
|
||||
-DENABLE_RAWSPEED=ON/OFF
|
||||
-DRAWSPEED_RPATH=FOLDERNAME
|
||||
|
||||
Enables/disables support of additional code from RawStudio project
|
||||
You need to download RawSpeed source code to use this feature.
|
||||
See README.RawSpeed.txt for details.
|
||||
./cmake will try to find RawSpeed code in:
|
||||
|
||||
a) If folder is specified via -DRAWSPEED_RPATH=FOLDERNAME
|
||||
command-line option, then only this folder will be checked.
|
||||
|
||||
b) If no folder is specified in -DENABLE_RAWSPEED switch:
|
||||
|
||||
./RawSpeed (in LibRaw folder)
|
||||
|
||||
|
||||
|
||||
-DENABLE_DCRAW_DEBUG=ON/OFF
|
||||
|
||||
Enables/disables support of additional debug traces from dcraw operations. Disabled by default
|
22
libraw/src/main/cpp/LibRaw-cmake/LICENSE
Normal file
22
libraw/src/main/cpp/LibRaw-cmake/LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
35
libraw/src/main/cpp/LibRaw-cmake/README.md
Normal file
35
libraw/src/main/cpp/LibRaw-cmake/README.md
Normal file
@ -0,0 +1,35 @@
|
||||
LibRaw-cmake
|
||||
============
|
||||
|
||||
[](https://travis-ci.org/LibRaw/LibRaw-cmake)
|
||||
|
||||
This is a separate repository for LibRaw CMake support scripts.
|
||||
It is [unmaintained](https://github.com/LibRaw/LibRaw/issues/44#issuecomment-60344793) by the authors of LibRaw and relies solely on user contributions.
|
||||
The current community-maintainer of this repository is [Maik Riechert](https://github.com/neothemachine).
|
||||
|
||||
If you wish to contribute to it, please open an issue or submit a pull request in this repository. Do *not* submit issues or pull requests regarding CMake to the main [LibRaw repository](https://github.com/LibRaw/LibRaw). Also, try to keep CMake related discussions out of the [main forum](http://www.libraw.org/forum), instead use the issues for that.
|
||||
|
||||
If you like to become a direct contributor with write permissions to this repository, please contact the [LibRaw authors](https://github.com/LibRaw).
|
||||
|
||||
How to use
|
||||
----------
|
||||
Just copy the contents of this repository into the root LibRaw folder and run cmake as usual.
|
||||
|
||||
### Add as a submodule
|
||||
|
||||
Add this repo and libraw as git submodules:
|
||||
|
||||
`git submodule add https://github.com/LibRaw/LibRaw-cmake.git`
|
||||
|
||||
`git submodule add https://github.com/LibRaw/LibRaw.git`
|
||||
|
||||
In your CMakeLists.txt add
|
||||
|
||||
```cmake
|
||||
add_subdirectory(LibRaw-cmake)
|
||||
target_link_libraries(ProjectName PRIVATE libraw::libraw)
|
||||
```
|
||||
|
||||
Set the `LIBRAW_PATH` CMake variable to point to the **LibRaw** directory:
|
||||
|
||||
`cmake -DLIBRAW_PATH=./LibRaw/`
|
13
libraw/src/main/cpp/LibRaw-cmake/cmake/data/libraw.lsm.cmake
Normal file
13
libraw/src/main/cpp/LibRaw-cmake/cmake/data/libraw.lsm.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
Begin4
|
||||
Title: ${PROJECT_NAME}
|
||||
Version: ${RAW_LIB_VERSION_STRING}
|
||||
Entered-date: 2013-09-08
|
||||
Description: Raw image decoder library
|
||||
Keywords: Raw image digital camera demosaicing decoding
|
||||
Author: Copyright 2008-2013 LibRaw LLC (info@libraw.org)
|
||||
Maintained-by:
|
||||
Primary-site: http://www.libraw.org
|
||||
Original-site:
|
||||
Platforms: Linux and other Unices, MacOs-X, Win32
|
||||
Copying-policy: GPL
|
||||
End
|
12
libraw/src/main/cpp/LibRaw-cmake/cmake/data/libraw.pc.cmake
Normal file
12
libraw/src/main/cpp/LibRaw-cmake/cmake/data/libraw.pc.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: Raw image decoder library (non-thread-safe)
|
||||
URL: http://www.libraw.org
|
||||
Requires:
|
||||
Version: @RAW_LIB_VERSION_STRING@
|
||||
Libs: -L${libdir} -lraw
|
||||
Cflags: -I${includedir} -I${includedir}/libraw
|
@ -0,0 +1,50 @@
|
||||
/* -*- C++ -*-
|
||||
* File: libraw_version.h
|
||||
* Copyright 2008-2013 LibRaw LLC (info@libraw.org)
|
||||
* Created: Mon Sept 8, 2008
|
||||
*
|
||||
* LibRaw C++ interface
|
||||
*
|
||||
|
||||
LibRaw is free software; you can redistribute it and/or modify
|
||||
it under the terms of the one of two licenses as you choose:
|
||||
|
||||
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
|
||||
(See the file LICENSE.LGPL provided in LibRaw distribution archive for details).
|
||||
|
||||
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||
(See the file LICENSE.CDDL provided in LibRaw distribution archive for details).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __LIBRAW_CONFIG_H
|
||||
#define __LIBRAW_CONFIG_H
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with DNG deflate codec support */
|
||||
#cmakedefine LIBRAW_USE_DNGDEFLATECODEC 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with DNG lossy codec support */
|
||||
#cmakedefine LIBRAW_USE_DNGLOSSYCODEC 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with OpenMP support */
|
||||
#cmakedefine LIBRAW_USE_OPENMP 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with LCMS support */
|
||||
#cmakedefine LIBRAW_USE_LCMS 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with RedCine codec support */
|
||||
#cmakedefine LIBRAW_USE_REDCINECODEC 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with RawSpeed codec support */
|
||||
#cmakedefine LIBRAW_USE_RAWSPEED 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with debug message from dcraw */
|
||||
#cmakedefine LIBRAW_USE_DCRAW_DEBUG 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with Foveon X3F support */
|
||||
#cmakedefine LIBRAW_USE_X3FTOOLS 1
|
||||
|
||||
/* Define to 1 if LibRaw have been compiled with Raspberry Pi RAW support */
|
||||
#cmakedefine LIBRAW_USE_6BY9RPI 1
|
||||
|
||||
#endif
|
@ -0,0 +1,12 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: Raw image decoder library (thread-safe)
|
||||
URL: http://www.libraw.org
|
||||
Requires:
|
||||
Version: @RAW_LIB_VERSION_STRING@
|
||||
Libs: -L${libdir} -lraw_r
|
||||
Cflags: -I${includedir} -I${includedir}/libraw
|
35
libraw/src/main/cpp/LibRaw-cmake/cmake/librawConfig.cmake.in
Normal file
35
libraw/src/main/cpp/LibRaw-cmake/cmake/librawConfig.cmake.in
Normal file
@ -0,0 +1,35 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
if(@JASPER_FOUND@)
|
||||
find_dependency(Jasper)
|
||||
endif()
|
||||
|
||||
if(@JPEG_FOUND@)
|
||||
find_dependency(JPEG)
|
||||
endif()
|
||||
if(@ZLIB_FOUND@)
|
||||
find_dependency(ZLIB)
|
||||
endif()
|
||||
|
||||
if(@LCMS_SUPPORT_CAN_BE_COMPILED@)
|
||||
if(@LCMS2_FOUND@)
|
||||
find_dependency(LCMS2)
|
||||
elseif(@LCMS_FOUND@)
|
||||
find_dependency(LCMS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(@ENABLE_RAWSPEED@)
|
||||
find_dependency(LibXml2)
|
||||
find_dependency(Threads)
|
||||
endif()
|
||||
|
||||
if(@ENABLE_OPENMP@)
|
||||
find_dependency(OpenMP)
|
||||
endif()
|
||||
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
@ -0,0 +1,60 @@
|
||||
# - Find LCMS
|
||||
# Find the LCMS (Little Color Management System) library and includes and
|
||||
# This module defines
|
||||
# LCMS_INCLUDE_DIR, where to find lcms.h
|
||||
# LCMS_LIBRARIES, the libraries needed to use LCMS.
|
||||
# LCMS_DOT_VERSION, The version number of the LCMS library, e.g. "1.19"
|
||||
# LCMS_VERSION, Similar to LCMS_DOT_VERSION, but without the dots, e.g. "119"
|
||||
# LCMS_FOUND, If false, do not try to use LCMS.
|
||||
#
|
||||
# The minimum required version of LCMS can be specified using the
|
||||
# standard syntax, e.g. find_package(LCMS 1.10)
|
||||
|
||||
# Copyright (c) 2008, Adrian Page, <adrian@pagenet.plus.com>
|
||||
# Copyright (c) 2009, Cyrille Berger, <cberger@cberger.net>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying LICENSE file.
|
||||
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
if(NOT WIN32)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LCMS lcms)
|
||||
set(LCMS_DEFINITIONS ${PC_LCMS_CFLAGS_OTHER})
|
||||
endif(NOT WIN32)
|
||||
|
||||
find_path(LCMS_INCLUDE_DIR lcms.h
|
||||
HINTS
|
||||
${PC_LCMS_INCLUDEDIR}
|
||||
${PC_LCMS_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES lcms liblcms1
|
||||
)
|
||||
|
||||
find_library(LCMS_LIBRARIES NAMES lcms liblcms lcms-1 liblcms-1
|
||||
HINTS
|
||||
${PC_LCMS_LIBDIR}
|
||||
${PC_LCMS_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES lcms
|
||||
)
|
||||
|
||||
# Store the LCMS version number in the cache, so we don't have to search every time again
|
||||
if(LCMS_INCLUDE_DIR AND NOT LCMS_VERSION)
|
||||
file(READ ${LCMS_INCLUDE_DIR}/lcms.h LCMS_VERSION_CONTENT)
|
||||
string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS_VERSION_MATCH ${LCMS_VERSION_CONTENT})
|
||||
if(LCMS_VERSION_MATCH)
|
||||
string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" _LCMS_VERSION ${LCMS_VERSION_MATCH})
|
||||
string(SUBSTRING ${_LCMS_VERSION} 0 1 LCMS_MAJOR_VERSION)
|
||||
string(SUBSTRING ${_LCMS_VERSION} 1 2 LCMS_MINOR_VERSION)
|
||||
endif(LCMS_VERSION_MATCH)
|
||||
set(LCMS_VERSION "${LCMS_MAJOR_VERSION}${LCMS_MINOR_VERSION}" CACHE STRING "Version number of lcms" FORCE)
|
||||
set(LCMS_DOT_VERSION "${LCMS_MAJOR_VERSION}.${LCMS_MINOR_VERSION}" CACHE STRING "Version number of lcms split into components" FORCE)
|
||||
endif(LCMS_INCLUDE_DIR AND NOT LCMS_VERSION)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LCMS REQUIRED_VARS LCMS_LIBRARIES LCMS_INCLUDE_DIR
|
||||
VERSION_VAR LCMS_DOT_VERSION )
|
||||
|
||||
mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARIES LCMS_VERSION)
|
||||
|
@ -0,0 +1,72 @@
|
||||
# - Find LCMS2
|
||||
# Find the LCMS2 includes and library
|
||||
# This module defines
|
||||
# LCMS2_INCLUDE_DIR, where to find lcms.h
|
||||
# LCMS2_LIBRARIES, the libraries needed to use LCMS2.
|
||||
# LCMS2_VERSION, The value of LCMS_VERSION defined in lcms.h
|
||||
# LCMS2_FOUND, If false, do not try to use LCMS2.
|
||||
|
||||
|
||||
# Copyright (c) 2008, Adrian Page, <adrian@pagenet.plus.com>
|
||||
# Copyright (c) 2009, Cyrille Berger, <cberger@cberger.net>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying LICENSE file.
|
||||
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
if(NOT WIN32)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LCMS2 lcms2)
|
||||
set(LCMS2_DEFINITIONS ${PC_LCMS2_CFLAGS_OTHER})
|
||||
endif(NOT WIN32)
|
||||
|
||||
find_path(LCMS2_INCLUDE_DIR lcms2.h
|
||||
PATHS
|
||||
${PC_LCMS2_INCLUDEDIR}
|
||||
${PC_LCMS2_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES lcms2 liblcms2
|
||||
)
|
||||
|
||||
find_library(LCMS2_LIBRARIES NAMES lcms2 liblcms2 lcms-2 liblcms-2
|
||||
PATHS
|
||||
${PC_LCMS2_LIBDIR}
|
||||
${PC_LCMS2_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES lcms2
|
||||
)
|
||||
|
||||
if(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
|
||||
set(LCMS2_FOUND TRUE)
|
||||
else(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
|
||||
set(LCMS2_FOUND FALSE)
|
||||
endif(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
|
||||
|
||||
if(LCMS2_FOUND)
|
||||
file(READ ${LCMS2_INCLUDE_DIR}/lcms2.h LCMS2_VERSION_CONTENT)
|
||||
string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS2_VERSION_MATCH ${LCMS2_VERSION_CONTENT})
|
||||
if(LCMS2_VERSION_MATCH)
|
||||
string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" LCMS2_VERSION ${LCMS2_VERSION_MATCH})
|
||||
if(NOT LCMS2_FIND_QUIETLY)
|
||||
string(SUBSTRING ${LCMS2_VERSION} 0 1 LCMS2_MAJOR_VERSION)
|
||||
string(SUBSTRING ${LCMS2_VERSION} 1 2 LCMS2_MINOR_VERSION)
|
||||
message(STATUS "Found lcms version ${LCMS2_MAJOR_VERSION}.${LCMS2_MINOR_VERSION}, ${LCMS2_LIBRARIES}")
|
||||
endif(NOT LCMS2_FIND_QUIETLY)
|
||||
else(LCMS2_VERSION_MATCH)
|
||||
if(NOT LCMS2_FIND_QUIETLY)
|
||||
message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARIES}")
|
||||
endif(NOT LCMS2_FIND_QUIETLY)
|
||||
set(LCMS2_VERSION NOTFOUND)
|
||||
endif(LCMS2_VERSION_MATCH)
|
||||
else(LCMS2_FOUND)
|
||||
if(NOT LCMS2_FIND_QUIETLY)
|
||||
if(LCMS2_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Required package lcms2 NOT found")
|
||||
else(LCMS2_FIND_REQUIRED)
|
||||
message(STATUS "lcms2 NOT found")
|
||||
endif(LCMS2_FIND_REQUIRED)
|
||||
endif(NOT LCMS2_FIND_QUIETLY)
|
||||
endif(LCMS2_FOUND)
|
||||
|
||||
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION)
|
||||
|
@ -0,0 +1,96 @@
|
||||
# - 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 LICENSE 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_LIBRARY_RELEASE NAMES raw
|
||||
HINTS
|
||||
${PC_LIBRAW_LIBDIR}
|
||||
${PC_LIBRAW_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LibRaw_LIBRARY_DEBUG NAMES rawd
|
||||
HINTS
|
||||
${PC_LIBRAW_LIBDIR}
|
||||
${PC_LIBRAW_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(LibRaw)
|
||||
|
||||
FIND_LIBRARY(LibRaw_r_LIBRARY_RELEASE NAMES raw_r
|
||||
HINTS
|
||||
${PC_LIBRAW_R_LIBDIR}
|
||||
${PC_LIBRAW_R_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LibRaw_r_LIBRARY_DEBUG NAMES raw_rd
|
||||
HINTS
|
||||
${PC_LIBRAW_R_LIBDIR}
|
||||
${PC_LIBRAW_R_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
select_library_configurations(LibRaw_r)
|
||||
|
||||
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
|
||||
)
|
@ -0,0 +1,20 @@
|
||||
# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN )
|
||||
# This macro evaluates its first argument
|
||||
# and sets all the given vaiables either to 0 or 1
|
||||
# depending on the value of the first one
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying LICENSE file.
|
||||
|
||||
|
||||
MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
|
||||
FOREACH (_current_VAR ${ARGN})
|
||||
IF(${FOUND_VAR})
|
||||
SET(${_current_VAR} 1)
|
||||
ELSE(${FOUND_VAR})
|
||||
SET(${_current_VAR} 0)
|
||||
ENDIF(${FOUND_VAR})
|
||||
ENDFOREACH(_current_VAR)
|
||||
ENDMACRO(MACRO_BOOL_TO_01)
|
@ -0,0 +1,159 @@
|
||||
# This file defines the Feature Logging macros.
|
||||
#
|
||||
# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
|
||||
# Logs the information so that it can be displayed at the end
|
||||
# of the configure run
|
||||
# VAR : TRUE or FALSE, indicating whether the feature is supported
|
||||
# FEATURE: name of the feature, e.g. "libjpeg"
|
||||
# DESCRIPTION: description what this feature provides
|
||||
# URL: home page
|
||||
# REQUIRED: TRUE or FALSE, indicating whether the feature is required
|
||||
# MIN_VERSION: minimum version number. empty string if unneeded
|
||||
# COMMENTS: More info you may want to provide. empty string if unnecessary
|
||||
#
|
||||
# MACRO_DISPLAY_FEATURE_LOG()
|
||||
# Call this to display the collected results.
|
||||
# Exits CMake with a FATAL error message if a required feature is missing
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# INCLUDE(MacroLogFeature)
|
||||
#
|
||||
# FIND_PACKAGE(JPEG)
|
||||
# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
|
||||
# ...
|
||||
# MACRO_DISPLAY_FEATURE_LOG()
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
# Copyright (c) 2006, Allen Winter, <winter@kde.org>
|
||||
# Copyright (c) 2009, Sebastian Trueg, <trueg@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying LICENSE file.
|
||||
|
||||
IF (NOT _macroLogFeatureAlreadyIncluded)
|
||||
SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(REMOVE ${_file})
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(REMOVE ${_file})
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
|
||||
IF (EXISTS ${_file})
|
||||
FILE(REMOVE ${_file})
|
||||
ENDIF (EXISTS ${_file})
|
||||
|
||||
SET(_macroLogFeatureAlreadyIncluded TRUE)
|
||||
|
||||
INCLUDE(FeatureSummary)
|
||||
|
||||
ENDIF (NOT _macroLogFeatureAlreadyIncluded)
|
||||
|
||||
|
||||
MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
|
||||
|
||||
STRING(TOUPPER "${ARGV4}" _required)
|
||||
SET(_minvers "${ARGV5}")
|
||||
SET(_comments "${ARGV6}")
|
||||
|
||||
IF (${_var})
|
||||
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
|
||||
ELSE (${_var})
|
||||
IF ("${_required}" STREQUAL "TRUE")
|
||||
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
|
||||
ELSE ("${_required}" STREQUAL "TRUE")
|
||||
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
|
||||
ENDIF ("${_required}" STREQUAL "TRUE")
|
||||
ENDIF (${_var})
|
||||
|
||||
SET(_logtext " * ${_package}")
|
||||
|
||||
IF (NOT ${_var})
|
||||
IF (${_minvers} MATCHES ".*")
|
||||
SET(_logtext "${_logtext} (${_minvers} or higher)")
|
||||
ENDIF (${_minvers} MATCHES ".*")
|
||||
SET(_logtext "${_logtext} <${_url}>\n ")
|
||||
ELSE (NOT ${_var})
|
||||
SET(_logtext "${_logtext} - ")
|
||||
ENDIF (NOT ${_var})
|
||||
|
||||
SET(_logtext "${_logtext}${_description}")
|
||||
|
||||
IF (NOT ${_var})
|
||||
IF (${_comments} MATCHES ".*")
|
||||
SET(_logtext "${_logtext}\n ${_comments}")
|
||||
ENDIF (${_comments} MATCHES ".*")
|
||||
# SET(_logtext "${_logtext}\n") #double-space missing features?
|
||||
ENDIF (NOT ${_var})
|
||||
|
||||
FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
|
||||
|
||||
IF(COMMAND SET_PACKAGE_PROPERTIES)
|
||||
SET_PACKAGE_PROPERTIES("${_package}" PROPERTIES URL "${_url}" DESCRIPTION "\"${_description}\"")
|
||||
ELSEIF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3
|
||||
SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"")
|
||||
ENDIF(COMMAND SET_PACKAGE_PROPERTIES)
|
||||
|
||||
ENDMACRO(MACRO_LOG_FEATURE)
|
||||
|
||||
|
||||
MACRO(MACRO_DISPLAY_FEATURE_LOG)
|
||||
IF(COMMAND FEATURE_SUMMARY) # in FeatureSummary.cmake since CMake 2.8.3
|
||||
FEATURE_SUMMARY(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/FindPackageLog.txt
|
||||
WHAT ALL)
|
||||
ENDIF(COMMAND FEATURE_SUMMARY)
|
||||
|
||||
SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
|
||||
SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
|
||||
SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
|
||||
|
||||
IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
|
||||
SET(_printSummary TRUE)
|
||||
ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
|
||||
|
||||
IF(_printSummary)
|
||||
SET(_missingDeps 0)
|
||||
IF (EXISTS ${_enabledFile})
|
||||
FILE(READ ${_enabledFile} _enabled)
|
||||
FILE(REMOVE ${_enabledFile})
|
||||
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}")
|
||||
ENDIF (EXISTS ${_enabledFile})
|
||||
|
||||
|
||||
IF (EXISTS ${_disabledFile})
|
||||
SET(_missingDeps 1)
|
||||
FILE(READ ${_disabledFile} _disabled)
|
||||
FILE(REMOVE ${_disabledFile})
|
||||
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}")
|
||||
ENDIF (EXISTS ${_disabledFile})
|
||||
|
||||
|
||||
IF (EXISTS ${_missingFile})
|
||||
SET(_missingDeps 1)
|
||||
FILE(READ ${_missingFile} _requirements)
|
||||
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}")
|
||||
FILE(REMOVE ${_missingFile})
|
||||
SET(_haveMissingReq 1)
|
||||
ENDIF (EXISTS ${_missingFile})
|
||||
|
||||
|
||||
IF (NOT ${_missingDeps})
|
||||
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.")
|
||||
ENDIF (NOT ${_missingDeps})
|
||||
|
||||
|
||||
MESSAGE(${_summary})
|
||||
MESSAGE("-----------------------------------------------------------------------------\n")
|
||||
|
||||
|
||||
IF(_haveMissingReq)
|
||||
MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
|
||||
ENDIF(_haveMissingReq)
|
||||
|
||||
ENDIF(_printSummary)
|
||||
|
||||
ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)
|
@ -0,0 +1,48 @@
|
||||
# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
|
||||
# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
|
||||
# This macro is a combination of OPTION() and FIND_PACKAGE(), it
|
||||
# works like FIND_PACKAGE(), but additionally it automatically creates
|
||||
# an option name WITH_<name>, which can be disabled via the cmake GUI.
|
||||
# or via -DWITH_<name>=OFF
|
||||
# The standard <name>_FOUND variables can be used in the same way
|
||||
# as when using the normal FIND_PACKAGE()
|
||||
|
||||
# Copyright (c) 2006-2010 Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying LICENSE file.
|
||||
|
||||
# This is just a helper macro to set a bunch of variables empty.
|
||||
# We don't know whether the package uses UPPERCASENAME or CamelCaseName, so we try both:
|
||||
macro(_MOFP_SET_EMPTY_IF_DEFINED _name _var)
|
||||
if(DEFINED ${_name}_${_var})
|
||||
set(${_name}_${_var} "")
|
||||
endif(DEFINED ${_name}_${_var})
|
||||
|
||||
string(TOUPPER ${_name} _nameUpper)
|
||||
if(DEFINED ${_nameUpper}_${_var})
|
||||
set(${_nameUpper}_${_var} "")
|
||||
endif(DEFINED ${_nameUpper}_${_var})
|
||||
endmacro(_MOFP_SET_EMPTY_IF_DEFINED _package _var)
|
||||
|
||||
|
||||
macro (MACRO_OPTIONAL_FIND_PACKAGE _name )
|
||||
option(WITH_${_name} "Search for ${_name} package" ON)
|
||||
if (WITH_${_name})
|
||||
find_package(${_name} ${ARGN})
|
||||
else (WITH_${_name})
|
||||
string(TOUPPER ${_name} _nameUpper)
|
||||
set(${_name}_FOUND FALSE)
|
||||
set(${_nameUpper}_FOUND FALSE)
|
||||
|
||||
_mofp_set_empty_if_defined(${_name} INCLUDE_DIRS)
|
||||
_mofp_set_empty_if_defined(${_name} INCLUDE_DIR)
|
||||
_mofp_set_empty_if_defined(${_name} INCLUDES)
|
||||
_mofp_set_empty_if_defined(${_name} LIBRARY)
|
||||
_mofp_set_empty_if_defined(${_name} LIBRARIES)
|
||||
_mofp_set_empty_if_defined(${_name} LIBS)
|
||||
_mofp_set_empty_if_defined(${_name} FLAGS)
|
||||
_mofp_set_empty_if_defined(${_name} DEFINITIONS)
|
||||
endif (WITH_${_name})
|
||||
endmacro (MACRO_OPTIONAL_FIND_PACKAGE)
|
||||
|
@ -0,0 +1,22 @@
|
||||
IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
||||
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||
FOREACH(file ${files})
|
||||
MESSAGE(STATUS "Uninstalling \"${file}\"")
|
||||
IF(EXISTS "${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF("${rm_retval}" STREQUAL 0)
|
||||
ELSE("${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
|
||||
ENDIF("${rm_retval}" STREQUAL 0)
|
||||
ELSE(EXISTS "${file}")
|
||||
MESSAGE(STATUS "File \"${file}\" does not exist.")
|
||||
ENDIF(EXISTS "${file}")
|
||||
ENDFOREACH(file)
|
Reference in New Issue
Block a user