PP3 file version is now manually specified in a header file (ppversion.h) for easier version tracking through Mercurial. It has been set to 300 instead of {latestagdistance} which was a bad idea. This could chnage if the Mercurial team manage to create a reliable absolute version numbering of the remote repos before the 3.0 release.
This commit is contained in:
parent
01401c20a6
commit
c2ad633fe8
478
CMakeLists.txt
478
CMakeLists.txt
@ -1,228 +1,250 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
# the default target is 'Debug'
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "")
|
||||
set (CMAKE_BUILD_TYPE Debug CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif ()
|
||||
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# By default, we don't use specific processor target, so PROC_TARGET_NUMBER is set to 0. If can specify other values to select specific
|
||||
# processor targets, which list can be found in ProcessorTargets.cmake.
|
||||
set (PROC_TARGET_NUMBER 0 CACHE STRING "Selected target processor from the list above (taken from ProcessorTargets.cmake)")
|
||||
|
||||
# The following line set special compilation flags for RTEngine, and will be added to CMAKE_CXX_FLAGS
|
||||
# It were moved away from rtengine/CMakefiles.txt, because some users may want to remove -ffast_math :
|
||||
# this flag speeds up the floating-point operations, but with a little bite less precisions. This default value
|
||||
# gives the same result/behaviour as before.
|
||||
set (RTENGINE_CXX_FLAGS "-ffast-math -funroll-loops" CACHE STRING "Special compilation flags for RTEngine")
|
||||
|
||||
#loading the processor targets list
|
||||
set (PROC_LABEL "undefined")
|
||||
set (PROC_FLAGS "")
|
||||
if (PROC_TARGET_NUMBER GREATER 0)
|
||||
include (ProcessorTargets.cmake)
|
||||
set (PROC_LABEL ${PROC_TARGET_${PROC_TARGET_NUMBER}_LABEL})
|
||||
set (PROC_FLAGS ${PROC_TARGET_${PROC_TARGET_NUMBER}_FLAGS})
|
||||
endif (PROC_TARGET_NUMBER GREATER 0)
|
||||
|
||||
# if it exists, the PROC_FORCED_LABEL value is loaded in PROC_LABEL to override the one of ProcessorTargets
|
||||
if (DEFINED PROC_FORCED_LABEL)
|
||||
set (PROC_LABEL ${PROC_FORCED_LABEL})
|
||||
endif (DEFINED PROC_FORCED_LABEL)
|
||||
|
||||
# adding the proc flags to the build flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROC_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROC_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PROC_FLAGS}")
|
||||
|
||||
if (APPLE)
|
||||
# SET (CMAKE_OSX_ARCHITECTURES "i386;x86_64;" )
|
||||
# SET (CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386;x86_64;" )
|
||||
SET (CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
|
||||
SET (CMAKE_OSX_DEPLOYMENT_TARGET "10.5")
|
||||
endif (APPLE)
|
||||
|
||||
option (BUILD_SHARED "Build rawtherapee with shared libraries" OFF)
|
||||
option (WITH_RAWZOR "Build with Rawzor support" OFF)
|
||||
option (WITH_MYFILE_MMAP "Build using memory mapped file" OFF)
|
||||
option (OPTION_OMP "Build with OpenMP support" ON)
|
||||
|
||||
# set install directories
|
||||
if (NOT DEFINED DATADIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (DATADIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (DATADIR ${CMAKE_INSTALL_PREFIX}/share/rawtherapee)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED DATADIR)
|
||||
|
||||
if (NOT DEFINED BINDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (BINDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED BINDIR)
|
||||
|
||||
if (NOT DEFINED LIBDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
# Respect CMAKE_INSTALL_LIBDIR if set
|
||||
if (DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set (LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
else (DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set (LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif (DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED LIBDIR)
|
||||
|
||||
if (NOT DEFINED DOCDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (DOCDIR ${CMAKE_CURRENT_SOURCE_DIR}/release/doc)
|
||||
else (WIN32 OR APPLE)
|
||||
set (DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED DOCDIR)
|
||||
|
||||
if (NOT DEFINED CREDITSDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (CREDITSDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (CREDITSDIR ${CMAKE_INSTALL_PREFIX}/share/doc)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED CREDITSDIR)
|
||||
|
||||
if (NOT DEFINED LICENCEDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (LICENCEDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (LICENCEDIR ${CMAKE_INSTALL_PREFIX}/share/doc)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED LICENCEDIR)
|
||||
|
||||
# check for libraries
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules (GTK REQUIRED gtk+-2.0>=2.12)
|
||||
pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.16)
|
||||
pkg_check_modules (GLIBMM REQUIRED glibmm-2.4>=2.16)
|
||||
pkg_check_modules (GTKMM REQUIRED gtkmm-2.4>=2.12)
|
||||
pkg_check_modules (GIO REQUIRED gio-2.0>=2.16)
|
||||
pkg_check_modules (GIOMM REQUIRED giomm-2.4>=2.12)
|
||||
pkg_check_modules (GTHREAD REQUIRED gthread-2.0>=2.16)
|
||||
pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.16)
|
||||
pkg_check_modules (SIGC REQUIRED sigc++-2.0)
|
||||
# NOTE: dependencies should be handled by pkg_check_modules and FIND_PACKAGE
|
||||
# on windows too but I don't want to break current build chain
|
||||
if (WIN32)
|
||||
set (EXTRA_LIBDIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
set (EXTRA_INCDIR "${CMAKE_CURRENT_SOURCE_DIR}/winclude")
|
||||
set (EXTRA_LIB "-lws2_32")
|
||||
set (IPTCDATA_LIBRARIES iptcdata)
|
||||
set (LCMS_LIBRARIES liblcms.a)
|
||||
set (JPEG_LIBRARIES libjpeg.a)
|
||||
set (PNG_LIBRARIES libpng.a)
|
||||
set (TIFF_LIBRARIES libtiff.a)
|
||||
set (ZLIB_LIBRARIES libz.a)
|
||||
|
||||
add_definitions (-DWIN32)
|
||||
add_definitions (-D_WIN32)
|
||||
if (MINGW)
|
||||
add_definitions (-D__MINGW32__)
|
||||
endif (MINGW)
|
||||
else (WIN32)
|
||||
pkg_check_modules (IPTCDATA REQUIRED libiptcdata)
|
||||
pkg_check_modules (LCMS REQUIRED lcms)
|
||||
find_package (JPEG REQUIRED)
|
||||
find_package (PNG REQUIRED)
|
||||
find_package (TIFF REQUIRED)
|
||||
find_package (ZLIB REQUIRED)
|
||||
endif (WIN32)
|
||||
|
||||
# set the bit number information of the platform
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(PROC_BIT_DEPTH 32 bits)
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(PROC_BIT_DEPTH 64 bits)
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
|
||||
#generating AboutThisBuild.txt
|
||||
if (WIN32)
|
||||
include (About-Windows.cmake)
|
||||
elseif (APPLE)
|
||||
include (About-Apple.cmake)
|
||||
else (WIN32)
|
||||
include (About-Linux.cmake)
|
||||
endif (WIN32)
|
||||
add_dependencies(AboutFile Debug Release MinSizeRel RelWithDebInfo)
|
||||
|
||||
# link rawzor
|
||||
if (WITH_RAWZOR)
|
||||
if (WIN32)
|
||||
set (EXTRA_INCDIR ${EXTRA_INCDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win")
|
||||
set (EXTRA_LIBDIR ${EXTRA_LIBDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win")
|
||||
set (EXTRA_LIB ${EXTRA_LIB} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win/rwz_sdk_s.a")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win/rwz_sdk_s.dll DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ)
|
||||
elseif (APPLE)
|
||||
set (EXTRA_INCDIR "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac")
|
||||
set (EXTRA_LIBDIR "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac")
|
||||
set (EXTRA_LIB "-lrwz_sdk_64")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac/librwz_sdk_64.dylib DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk_64.dylib)
|
||||
if (BUILD_SHARED)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac/librwz_sdk_64.dylib DESTINATION ${LIBDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk_64.dylib)
|
||||
endif (BUILD_SHARED)
|
||||
else (WIN32)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set (EXTRA_INCDIR ${EXTRA_INCDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32")
|
||||
set (EXTRA_LIBDIR ${EXTRA_LIBDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32")
|
||||
set (EXTRA_LIB ${EXTRA_LIB} "-lrwz_sdk")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32/librwz_sdk.so DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
if (BUILD_SHARED)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32/librwz_sdk.so DESTINATION ${LIBDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
endif (BUILD_SHARED)
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (EXTRA_INCDIR ${EXTRA_INCDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64")
|
||||
set (EXTRA_LIBDIR ${EXTRA_LIBDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64")
|
||||
set (EXTRA_LIB ${EXTRA_LIB} "-lrwz_sdk")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64/librwz_sdk.so DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
if (BUILD_SHARED)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64/librwz_sdk.so DESTINATION ${LIBDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
endif (BUILD_SHARED)
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
endif (WIN32)
|
||||
endif (WITH_RAWZOR)
|
||||
|
||||
if (WITH_MYFILE_MMAP)
|
||||
add_definitions (-DMYFILE_MMAP)
|
||||
endif (WITH_MYFILE_MMAP)
|
||||
|
||||
if (OPTION_OMP)
|
||||
find_package(OpenMP)
|
||||
if (OPENMP_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif (OPENMP_FOUND)
|
||||
endif (OPTION_OMP)
|
||||
|
||||
if (UNIX)
|
||||
install (PROGRAMS rtstart DESTINATION ${BINDIR})
|
||||
endif (UNIX)
|
||||
|
||||
install (FILES AUTHORS.txt DESTINATION ${CREDITSDIR})
|
||||
install (FILES LICENSE.txt DESTINATION ${LICENCEDIR})
|
||||
install (FILES AboutThisBuild.txt DESTINATION ${BINDIR})
|
||||
|
||||
add_subdirectory (rtexif)
|
||||
add_subdirectory (rtengine)
|
||||
add_subdirectory (rtgui)
|
||||
add_subdirectory (rtdata)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
# the default target is 'Debug'
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "")
|
||||
set (CMAKE_BUILD_TYPE Debug CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif ()
|
||||
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# By default, we don't use specific processor target, so PROC_TARGET_NUMBER is set to 0. If can specify other values to select specific
|
||||
# processor targets, which list can be found in ProcessorTargets.cmake.
|
||||
set (PROC_TARGET_NUMBER 0 CACHE STRING "Selected target processor from the list above (taken from ProcessorTargets.cmake)")
|
||||
|
||||
# The following line set special compilation flags for RTEngine, and will be added to CMAKE_CXX_FLAGS
|
||||
# It were moved away from rtengine/CMakefiles.txt, because some users may want to remove -ffast_math :
|
||||
# this flag speeds up the floating-point operations, but with a little bite less precisions. This default value
|
||||
# gives the same result/behaviour as before.
|
||||
set (RTENGINE_CXX_FLAGS "-ffast-math -funroll-loops" CACHE STRING "Special compilation flags for RTEngine")
|
||||
|
||||
#loading the processor targets list
|
||||
set (PROC_LABEL "undefined")
|
||||
set (PROC_FLAGS "")
|
||||
if (PROC_TARGET_NUMBER GREATER 0)
|
||||
include (ProcessorTargets.cmake)
|
||||
set (PROC_LABEL ${PROC_TARGET_${PROC_TARGET_NUMBER}_LABEL})
|
||||
set (PROC_FLAGS ${PROC_TARGET_${PROC_TARGET_NUMBER}_FLAGS})
|
||||
endif (PROC_TARGET_NUMBER GREATER 0)
|
||||
|
||||
# if it exists, the PROC_FORCED_LABEL value is loaded in PROC_LABEL to override the one of ProcessorTargets
|
||||
if (DEFINED PROC_FORCED_LABEL)
|
||||
set (PROC_LABEL ${PROC_FORCED_LABEL})
|
||||
endif (DEFINED PROC_FORCED_LABEL)
|
||||
|
||||
# adding the proc flags to the build flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROC_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROC_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PROC_FLAGS}")
|
||||
|
||||
if (APPLE)
|
||||
# SET (CMAKE_OSX_ARCHITECTURES "i386;x86_64;" )
|
||||
# SET (CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386;x86_64;" )
|
||||
SET (CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
|
||||
SET (CMAKE_OSX_DEPLOYMENT_TARGET "10.5")
|
||||
endif (APPLE)
|
||||
|
||||
option (AUTOMATED_BUILD_SYSTEM "TRUE if built by an automate" OFF)
|
||||
|
||||
option (BUILD_SHARED "Build rawtherapee with shared libraries" OFF)
|
||||
option (WITH_RAWZOR "Build with Rawzor support" OFF)
|
||||
option (WITH_MYFILE_MMAP "Build using memory mapped file" OFF)
|
||||
option (OPTION_OMP "Build with OpenMP support" ON)
|
||||
|
||||
# set install directories
|
||||
if (NOT DEFINED DATADIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (DATADIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (DATADIR ${CMAKE_INSTALL_PREFIX}/share/rawtherapee)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED DATADIR)
|
||||
|
||||
if (NOT DEFINED BINDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (BINDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED BINDIR)
|
||||
|
||||
if (NOT DEFINED LIBDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
# Respect CMAKE_INSTALL_LIBDIR if set
|
||||
if (DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set (LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
else (DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set (LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif (DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED LIBDIR)
|
||||
|
||||
if (NOT DEFINED DOCDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (DOCDIR ${CMAKE_CURRENT_SOURCE_DIR}/release/doc)
|
||||
else (WIN32 OR APPLE)
|
||||
set (DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED DOCDIR)
|
||||
|
||||
if (NOT DEFINED CREDITSDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (CREDITSDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (CREDITSDIR ${CMAKE_INSTALL_PREFIX}/share/doc)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED CREDITSDIR)
|
||||
|
||||
if (NOT DEFINED LICENCEDIR)
|
||||
if (WIN32 OR APPLE)
|
||||
set (LICENCEDIR ${CMAKE_CURRENT_SOURCE_DIR}/release)
|
||||
else (WIN32 OR APPLE)
|
||||
set (LICENCEDIR ${CMAKE_INSTALL_PREFIX}/share/doc)
|
||||
endif (WIN32 OR APPLE)
|
||||
endif (NOT DEFINED LICENCEDIR)
|
||||
|
||||
# check for libraries
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules (GTK REQUIRED gtk+-2.0>=2.12)
|
||||
pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.16)
|
||||
pkg_check_modules (GLIBMM REQUIRED glibmm-2.4>=2.16)
|
||||
pkg_check_modules (GTKMM REQUIRED gtkmm-2.4>=2.12)
|
||||
pkg_check_modules (GIO REQUIRED gio-2.0>=2.16)
|
||||
pkg_check_modules (GIOMM REQUIRED giomm-2.4>=2.12)
|
||||
pkg_check_modules (GTHREAD REQUIRED gthread-2.0>=2.16)
|
||||
pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.16)
|
||||
pkg_check_modules (SIGC REQUIRED sigc++-2.0)
|
||||
# NOTE: dependencies should be handled by pkg_check_modules and FIND_PACKAGE
|
||||
# on windows too but I don't want to break current build chain
|
||||
if (WIN32)
|
||||
set (EXTRA_LIBDIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
set (EXTRA_INCDIR "${CMAKE_CURRENT_SOURCE_DIR}/winclude")
|
||||
set (EXTRA_LIB "-lws2_32")
|
||||
set (IPTCDATA_LIBRARIES iptcdata)
|
||||
set (LCMS_LIBRARIES liblcms.a)
|
||||
set (JPEG_LIBRARIES libjpeg.a)
|
||||
set (PNG_LIBRARIES libpng.a)
|
||||
set (TIFF_LIBRARIES libtiff.a)
|
||||
set (ZLIB_LIBRARIES libz.a)
|
||||
|
||||
add_definitions (-DWIN32)
|
||||
add_definitions (-D_WIN32)
|
||||
if (MINGW)
|
||||
add_definitions (-D__MINGW32__)
|
||||
endif (MINGW)
|
||||
else (WIN32)
|
||||
pkg_check_modules (IPTCDATA REQUIRED libiptcdata)
|
||||
pkg_check_modules (LCMS REQUIRED lcms)
|
||||
find_package (JPEG REQUIRED)
|
||||
find_package (PNG REQUIRED)
|
||||
find_package (TIFF REQUIRED)
|
||||
find_package (ZLIB REQUIRED)
|
||||
endif (WIN32)
|
||||
|
||||
if (AUTOMATED_BUILD_SYSTEM)
|
||||
|
||||
message(WARNING "Automated build system mode! You have to make sure that AboutThisBuild.txt and rtgui/version.h are up-to-date by building RT at least one time with AUTOMATED_BUILD_SYSTEM=OFF.")
|
||||
|
||||
# Checking for the presence of AboutThisBuild.txt
|
||||
find_file(ABOUT_FILE AboutThisBuild.txt PATHS "${CMAKE_CURRENT_SOURCE_DIR}" NO_DEFAULT_PATH)
|
||||
if (ABOUT_FILE STREQUAL ABOUT_FILE-NOTFOUND)
|
||||
message(FATAL_ERROR "AboutThisBuild.txt not found! You have to build RT at least one time with AUTOMATED_BUILD_SYSTEM=OFF to generate this file.")
|
||||
endif (ABOUT_FILE STREQUAL ABOUT_FILE-NOTFOUND)
|
||||
|
||||
# Checking for the presence of version.h
|
||||
find_file(VERSION_FILE version.h PATHS "${CMAKE_CURRENT_SOURCE_DIR}/rtgui" NO_DEFAULT_PATH)
|
||||
if (VERSION_FILE STREQUAL VERSION_FILE-NOTFOUND)
|
||||
message(FATAL_ERROR "rtgui/version.h not found! You have to build RT at least one time with AUTOMATED_BUILD_SYSTEM=OFF to generate this file.")
|
||||
endif (VERSION_FILE STREQUAL VERSION_FILE-NOTFOUND)
|
||||
|
||||
else (AUTOMATED_BUILD_SYSTEM)
|
||||
|
||||
# set the bit number information of the platform
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(PROC_BIT_DEPTH 32 bits)
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(PROC_BIT_DEPTH 64 bits)
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
|
||||
#generating AboutThisBuild.txt
|
||||
if (WIN32)
|
||||
include (About-Windows.cmake)
|
||||
elseif (APPLE)
|
||||
include (About-Apple.cmake)
|
||||
else (WIN32)
|
||||
include (About-Linux.cmake)
|
||||
endif (WIN32)
|
||||
add_dependencies(AboutFile Debug Release MinSizeRel RelWithDebInfo)
|
||||
|
||||
endif (AUTOMATED_BUILD_SYSTEM)
|
||||
|
||||
# link rawzor
|
||||
if (WITH_RAWZOR)
|
||||
if (WIN32)
|
||||
set (EXTRA_INCDIR ${EXTRA_INCDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win")
|
||||
set (EXTRA_LIBDIR ${EXTRA_LIBDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win")
|
||||
set (EXTRA_LIB ${EXTRA_LIB} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win/rwz_sdk_s.a")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_win/rwz_sdk_s.dll DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ)
|
||||
elseif (APPLE)
|
||||
set (EXTRA_INCDIR "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac")
|
||||
set (EXTRA_LIBDIR "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac")
|
||||
set (EXTRA_LIB "-lrwz_sdk_64")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac/librwz_sdk_64.dylib DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk_64.dylib)
|
||||
if (BUILD_SHARED)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_mac/librwz_sdk_64.dylib DESTINATION ${LIBDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk_64.dylib)
|
||||
endif (BUILD_SHARED)
|
||||
else (WIN32)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set (EXTRA_INCDIR ${EXTRA_INCDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32")
|
||||
set (EXTRA_LIBDIR ${EXTRA_LIBDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32")
|
||||
set (EXTRA_LIB ${EXTRA_LIB} "-lrwz_sdk")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32/librwz_sdk.so DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
if (BUILD_SHARED)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin32/librwz_sdk.so DESTINATION ${LIBDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
endif (BUILD_SHARED)
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (EXTRA_INCDIR ${EXTRA_INCDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64")
|
||||
set (EXTRA_LIBDIR ${EXTRA_LIBDIR} "${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64")
|
||||
set (EXTRA_LIB ${EXTRA_LIB} "-lrwz_sdk")
|
||||
add_definitions (-DRAWZOR_SUPPORT)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64/librwz_sdk.so DESTINATION ${BINDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
if (BUILD_SHARED)
|
||||
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/rawzor_lin64/librwz_sdk.so DESTINATION ${LIBDIR}
|
||||
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME rwz_sdk.so)
|
||||
endif (BUILD_SHARED)
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
endif (WIN32)
|
||||
endif (WITH_RAWZOR)
|
||||
|
||||
if (WITH_MYFILE_MMAP)
|
||||
add_definitions (-DMYFILE_MMAP)
|
||||
endif (WITH_MYFILE_MMAP)
|
||||
|
||||
if (OPTION_OMP)
|
||||
find_package(OpenMP)
|
||||
if (OPENMP_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif (OPENMP_FOUND)
|
||||
endif (OPTION_OMP)
|
||||
|
||||
if (UNIX)
|
||||
install (PROGRAMS rtstart DESTINATION ${BINDIR})
|
||||
endif (UNIX)
|
||||
|
||||
install (FILES AUTHORS.txt DESTINATION ${CREDITSDIR})
|
||||
install (FILES LICENSE.txt DESTINATION ${LICENCEDIR})
|
||||
install (FILES AboutThisBuild.txt DESTINATION ${BINDIR})
|
||||
|
||||
add_subdirectory (rtexif)
|
||||
add_subdirectory (rtengine)
|
||||
add_subdirectory (rtgui)
|
||||
add_subdirectory (rtdata)
|
||||
|
@ -9,7 +9,7 @@ Cmake is actually used to create the Makefiles (scripts that handle the build pr
|
||||
It is designed to find all necessary compilation flags for your specific machine, but everything can be overriden.
|
||||
|
||||
RT's build mechanism will generate a build information file, named "AboutThisBuild.txt", and require some parameters that can't be set by Cmake, so it's
|
||||
done in our build script, and may be aoverriden at your own will. The build process also enable some sort of cross compiling, since you can only choose
|
||||
done in our build script, and may be overriden at your own will. The build process also enable some sort of cross compiling, since you can only choose
|
||||
a specific processor variation of the same type (e.g. core2, athlon64, which are both an x86 architecture). Real cross compiling (e.g. building the windows
|
||||
version on a linux platform) has not been tested.
|
||||
|
||||
@ -17,6 +17,11 @@ By default, no processor is specified, so Cmake/GCC will build RT for your proce
|
||||
download then have to set the processor label manually (set to 'undefined' by default) with the PROC_FORCED_LABEL cmake's parameter (we assume that you know
|
||||
how to specify a cmake parameter).
|
||||
|
||||
Note for developers that handle an automated build system : Mercurial is requested in order to produce the build information file, but you build system will
|
||||
certainly only use the source code without any access to a Mercurial repository. In this case, you have to first build RT like explained below to generates
|
||||
the build information files, then you can tell your build system to run cmake with the following additionnal parameter : -D AUTOMATED_BUILD_SYSTEM:BOOL=ON.
|
||||
Cmake will then pass the files creation step, but will check the presence of the requested files and stop if they're not there.
|
||||
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
@ -23,9 +23,12 @@
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
#include <version.h>
|
||||
#include <ppversion.h>
|
||||
|
||||
#include <safekeyfile.h>
|
||||
|
||||
#define APPVERSION VERSION
|
||||
|
||||
namespace rtengine {
|
||||
namespace procparams {
|
||||
|
||||
@ -223,14 +226,15 @@ raw.preser=0.0;
|
||||
exif.clear ();
|
||||
iptc.clear ();
|
||||
|
||||
version = TAGDISTANCE;
|
||||
ppVersion = PPVERSION;
|
||||
}
|
||||
|
||||
int ProcParams::save (Glib::ustring fname) const {
|
||||
|
||||
SafeKeyFile keyFile;
|
||||
|
||||
keyFile.set_integer ("Version", "Version", TAGDISTANCE);
|
||||
keyFile.set_string ("Version", "AppVersion", APPVERSION);
|
||||
keyFile.set_integer ("Version", "Version", PPVERSION);
|
||||
|
||||
// save tonecurve:
|
||||
keyFile.set_boolean ("Exposure", "Auto", toneCurve.autoexp);
|
||||
@ -495,9 +499,11 @@ int ProcParams::load (Glib::ustring fname) {
|
||||
|
||||
// load tonecurve:
|
||||
|
||||
version = TAGDISTANCE;
|
||||
ppVersion = PPVERSION;
|
||||
appVersion = APPVERSION;
|
||||
if (keyFile.has_group ("Version")) {
|
||||
if (keyFile.has_key ("Version", "Version")) version = keyFile.get_integer ("Version", "Version");
|
||||
if (keyFile.has_key ("Version", "AppVersion")) appVersion = keyFile.get_string ("Version", "AppVersion");
|
||||
if (keyFile.has_key ("Version", "Version")) ppVersion = keyFile.get_integer ("Version", "Version");
|
||||
}
|
||||
|
||||
if (keyFile.has_group ("Exposure")) {
|
||||
@ -513,7 +519,7 @@ if (keyFile.has_group ("Exposure")) {
|
||||
if (keyFile.has_key ("Exposure", "HighlightComprThreshold")) toneCurve.hlcomprthresh = keyFile.get_integer ("Exposure", "HighlightComprThreshold");
|
||||
if (keyFile.has_key ("Exposure", "ShadowCompr")) toneCurve.shcompr = keyFile.get_integer ("Exposure", "ShadowCompr");
|
||||
if (toneCurve.shcompr > 100) toneCurve.shcompr = 100; // older pp3 files can have values above 100.
|
||||
if (version>200)
|
||||
if (ppVersion>200)
|
||||
if (keyFile.has_key ("Exposure", "Curve")) toneCurve.curve = keyFile.get_double_list ("Exposure", "Curve");
|
||||
}
|
||||
|
||||
@ -537,7 +543,7 @@ if (keyFile.has_group ("Luminance Curve")) {
|
||||
if (keyFile.has_key ("Luminance Curve", "AvoidColorClipping")) labCurve.avoidclip = keyFile.get_boolean ("Luminance Curve", "AvoidColorClipping");
|
||||
if (keyFile.has_key ("Luminance Curve", "SaturationLimiter")) labCurve.enable_saturationlimiter= keyFile.get_boolean ("Luminance Curve", "SaturationLimiter");
|
||||
if (keyFile.has_key ("Luminance Curve", "SaturationLimit")) labCurve.saturationlimit = keyFile.get_double ("Luminance Curve", "SaturationLimit");
|
||||
if (version>200)
|
||||
if (ppVersion>200)
|
||||
if (keyFile.has_key ("Luminance Curve", "LCurve")) labCurve.lcurve = keyFile.get_double_list ("Luminance Curve", "LCurve");
|
||||
if (keyFile.has_key ("Luminance Curve", "aCurve")) labCurve.acurve = keyFile.get_double_list ("Luminance Curve", "aCurve");
|
||||
if (keyFile.has_key ("Luminance Curve", "bCurve")) labCurve.bcurve = keyFile.get_double_list ("Luminance Curve", "bCurve");
|
||||
|
@ -446,7 +446,8 @@ class ProcParams {
|
||||
HSVEqualizerParams hsvequalizer; ///< hsv equalizer parameters
|
||||
std::vector<ExifPair> exif; ///< List of modifications appplied on the exif tags of the input image
|
||||
std::vector<IPTCPair> iptc; ///< The IPTC tags and values to be saved to the output image
|
||||
int version; ///< Version of the file from which the parameters have been read
|
||||
Glib::ustring appVersion; ///< Version of the application that generated the parameters
|
||||
int ppVersion; ///< Version of the PP file from which the parameters have been read
|
||||
|
||||
/**
|
||||
* The constructor only sets the hand-wired defaults.
|
||||
|
@ -1,143 +1,143 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <cacheimagedata.h>
|
||||
#include <vector>
|
||||
#include <glib/gstdio.h>
|
||||
#include <safekeyfile.h>
|
||||
|
||||
CacheImageData::CacheImageData ()
|
||||
: md5(""), supported(false), format(FT_Invalid), rank(0), inTrash(false), recentlySaved(false),
|
||||
timeValid(false), exifValid(false), thumbImgType(0) {
|
||||
}
|
||||
|
||||
int CacheImageData::load (const Glib::ustring& fname) {
|
||||
|
||||
rtengine::SafeKeyFile keyFile;
|
||||
|
||||
try {
|
||||
if (!keyFile.load_from_file (fname))
|
||||
return 1;
|
||||
|
||||
if (keyFile.has_group ("General")) {
|
||||
if (keyFile.has_key ("General", "MD5")) md5 = keyFile.get_string ("General", "MD5");
|
||||
if (keyFile.has_key ("General", "Version")) version = keyFile.get_integer ("General", "Version");
|
||||
if (keyFile.has_key ("General", "Supported")) supported = keyFile.get_boolean ("General", "Supported");
|
||||
if (keyFile.has_key ("General", "Format")) format = (ThFileType)keyFile.get_integer ("General", "Format");
|
||||
if (keyFile.has_key ("General", "Rank")) rank = keyFile.get_integer ("General", "Rank");
|
||||
if (keyFile.has_key ("General", "InTrash")) inTrash = keyFile.get_boolean ("General", "InTrash");
|
||||
if (keyFile.has_key ("General", "RecentlySaved")) recentlySaved = keyFile.get_boolean ("General", "RecentlySaved");
|
||||
}
|
||||
|
||||
timeValid = keyFile.has_group ("DateTime");
|
||||
|
||||
if (timeValid) {
|
||||
if (keyFile.has_key ("DateTime", "Year")) year = keyFile.get_integer ("DateTime", "Year");
|
||||
if (keyFile.has_key ("DateTime", "Month")) month = keyFile.get_integer ("DateTime", "Month");
|
||||
if (keyFile.has_key ("DateTime", "Day")) day = keyFile.get_integer ("DateTime", "Day");
|
||||
if (keyFile.has_key ("DateTime", "Hour")) hour = keyFile.get_integer ("DateTime", "Hour");
|
||||
if (keyFile.has_key ("DateTime", "Min")) min = keyFile.get_integer ("DateTime", "Min");
|
||||
if (keyFile.has_key ("DateTime", "Sec")) sec = keyFile.get_integer ("DateTime", "Sec");
|
||||
if (keyFile.has_key ("DateTime", "MSec")) msec = keyFile.get_integer ("DateTime", "MSec");
|
||||
}
|
||||
|
||||
exifValid = false;
|
||||
|
||||
if (keyFile.has_group ("ExifInfo")) {
|
||||
exifValid = true;
|
||||
if (keyFile.has_key ("ExifInfo", "Valid")) exifValid = keyFile.get_boolean ("ExifInfo", "Valid");
|
||||
|
||||
if (exifValid) {
|
||||
if (keyFile.has_key ("ExifInfo", "FNumber")) fnumber = keyFile.get_double ("ExifInfo", "FNumber");
|
||||
if (keyFile.has_key ("ExifInfo", "Shutter")) shutter = keyFile.get_double ("ExifInfo", "Shutter");
|
||||
if (keyFile.has_key ("ExifInfo", "FocalLen")) focalLen = keyFile.get_double ("ExifInfo", "FocalLen");
|
||||
if (keyFile.has_key ("ExifInfo", "ISO")) iso = keyFile.get_integer ("ExifInfo", "ISO");
|
||||
}
|
||||
if (keyFile.has_key ("ExifInfo", "Lens")) lens = keyFile.get_string ("ExifInfo", "Lens");
|
||||
if (keyFile.has_key ("ExifInfo", "Camera")) camera = keyFile.get_string ("ExifInfo", "Camera");
|
||||
}
|
||||
|
||||
if (keyFile.has_group ("FileInfo")) {
|
||||
if (keyFile.has_key ("FileInfo", "Filetype")) filetype = keyFile.get_string ("FileInfo", "Filetype");
|
||||
}
|
||||
|
||||
|
||||
if (format==FT_Raw && keyFile.has_group ("ExtraRawInfo")) {
|
||||
if (keyFile.has_key ("ExtraRawInfo", "ThumbImageType")) thumbImgType = keyFile.get_integer ("ExtraRawInfo", "ThumbImageType");
|
||||
if (keyFile.has_key ("ExtraRawInfo", "ThumbImageOffset")) thumbOffset = keyFile.get_integer ("ExtraRawInfo", "ThumbImageOffset");
|
||||
}
|
||||
else {
|
||||
rotate = 0;
|
||||
thumbImgType = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (Glib::Error) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int CacheImageData::save (const Glib::ustring& fname) {
|
||||
|
||||
rtengine::SafeKeyFile keyFile;
|
||||
|
||||
if (::g_file_test(fname.c_str(),G_FILE_TEST_EXISTS)) keyFile.load_from_file (fname);
|
||||
|
||||
keyFile.set_string ("General", "MD5", md5);
|
||||
keyFile.set_integer ("General", "Version", options.version);
|
||||
keyFile.set_boolean ("General", "Supported", supported);
|
||||
keyFile.set_integer ("General", "Format", format);
|
||||
keyFile.set_integer ("General", "Rank", rank);
|
||||
keyFile.set_boolean ("General", "InTrash", inTrash);
|
||||
keyFile.set_boolean ("General", "RecentlySaved", recentlySaved);
|
||||
|
||||
if (timeValid) {
|
||||
keyFile.set_integer ("DateTime", "Year", year);
|
||||
keyFile.set_integer ("DateTime", "Month", month);
|
||||
keyFile.set_integer ("DateTime", "Day", day);
|
||||
keyFile.set_integer ("DateTime", "Hour", hour);
|
||||
keyFile.set_integer ("DateTime", "Min", min);
|
||||
keyFile.set_integer ("DateTime", "Sec", sec);
|
||||
keyFile.set_integer ("DateTime", "MSec", msec);
|
||||
}
|
||||
|
||||
keyFile.set_boolean ("ExifInfo", "Valid", exifValid);
|
||||
if (exifValid) {
|
||||
keyFile.set_double ("ExifInfo", "FNumber", fnumber);
|
||||
keyFile.set_double ("ExifInfo", "Shutter", shutter);
|
||||
keyFile.set_double ("ExifInfo", "FocalLen", focalLen);
|
||||
keyFile.set_integer ("ExifInfo", "ISO", iso);
|
||||
}
|
||||
keyFile.set_string ("ExifInfo", "Lens", lens);
|
||||
keyFile.set_string ("ExifInfo", "Camera", camera);
|
||||
keyFile.set_string ("FileInfo", "Filetype", filetype);
|
||||
|
||||
if (format==FT_Raw) {
|
||||
keyFile.set_integer ("ExtraRawInfo", "ThumbImageType", thumbImgType);
|
||||
keyFile.set_integer ("ExtraRawInfo", "ThumbImageOffset", thumbOffset);
|
||||
}
|
||||
|
||||
FILE *f = g_fopen (fname.c_str(), "wt");
|
||||
if (!f)
|
||||
return 1;
|
||||
else {
|
||||
fprintf (f, "%s", keyFile.to_data().c_str());
|
||||
fclose (f);
|
||||
return 0;
|
||||
}}
|
||||
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <cacheimagedata.h>
|
||||
#include <vector>
|
||||
#include <glib/gstdio.h>
|
||||
#include <safekeyfile.h>
|
||||
|
||||
CacheImageData::CacheImageData ()
|
||||
: md5(""), supported(false), format(FT_Invalid), rank(0), inTrash(false), recentlySaved(false),
|
||||
timeValid(false), exifValid(false), thumbImgType(0) {
|
||||
}
|
||||
|
||||
int CacheImageData::load (const Glib::ustring& fname) {
|
||||
|
||||
rtengine::SafeKeyFile keyFile;
|
||||
|
||||
try {
|
||||
if (!keyFile.load_from_file (fname))
|
||||
return 1;
|
||||
|
||||
if (keyFile.has_group ("General")) {
|
||||
if (keyFile.has_key ("General", "MD5")) md5 = keyFile.get_string ("General", "MD5");
|
||||
if (keyFile.has_key ("General", "Version")) version = keyFile.get_string ("General", "Version");
|
||||
if (keyFile.has_key ("General", "Supported")) supported = keyFile.get_boolean ("General", "Supported");
|
||||
if (keyFile.has_key ("General", "Format")) format = (ThFileType)keyFile.get_integer ("General", "Format");
|
||||
if (keyFile.has_key ("General", "Rank")) rank = keyFile.get_integer ("General", "Rank");
|
||||
if (keyFile.has_key ("General", "InTrash")) inTrash = keyFile.get_boolean ("General", "InTrash");
|
||||
if (keyFile.has_key ("General", "RecentlySaved")) recentlySaved = keyFile.get_boolean ("General", "RecentlySaved");
|
||||
}
|
||||
|
||||
timeValid = keyFile.has_group ("DateTime");
|
||||
|
||||
if (timeValid) {
|
||||
if (keyFile.has_key ("DateTime", "Year")) year = keyFile.get_integer ("DateTime", "Year");
|
||||
if (keyFile.has_key ("DateTime", "Month")) month = keyFile.get_integer ("DateTime", "Month");
|
||||
if (keyFile.has_key ("DateTime", "Day")) day = keyFile.get_integer ("DateTime", "Day");
|
||||
if (keyFile.has_key ("DateTime", "Hour")) hour = keyFile.get_integer ("DateTime", "Hour");
|
||||
if (keyFile.has_key ("DateTime", "Min")) min = keyFile.get_integer ("DateTime", "Min");
|
||||
if (keyFile.has_key ("DateTime", "Sec")) sec = keyFile.get_integer ("DateTime", "Sec");
|
||||
if (keyFile.has_key ("DateTime", "MSec")) msec = keyFile.get_integer ("DateTime", "MSec");
|
||||
}
|
||||
|
||||
exifValid = false;
|
||||
|
||||
if (keyFile.has_group ("ExifInfo")) {
|
||||
exifValid = true;
|
||||
if (keyFile.has_key ("ExifInfo", "Valid")) exifValid = keyFile.get_boolean ("ExifInfo", "Valid");
|
||||
|
||||
if (exifValid) {
|
||||
if (keyFile.has_key ("ExifInfo", "FNumber")) fnumber = keyFile.get_double ("ExifInfo", "FNumber");
|
||||
if (keyFile.has_key ("ExifInfo", "Shutter")) shutter = keyFile.get_double ("ExifInfo", "Shutter");
|
||||
if (keyFile.has_key ("ExifInfo", "FocalLen")) focalLen = keyFile.get_double ("ExifInfo", "FocalLen");
|
||||
if (keyFile.has_key ("ExifInfo", "ISO")) iso = keyFile.get_integer ("ExifInfo", "ISO");
|
||||
}
|
||||
if (keyFile.has_key ("ExifInfo", "Lens")) lens = keyFile.get_string ("ExifInfo", "Lens");
|
||||
if (keyFile.has_key ("ExifInfo", "Camera")) camera = keyFile.get_string ("ExifInfo", "Camera");
|
||||
}
|
||||
|
||||
if (keyFile.has_group ("FileInfo")) {
|
||||
if (keyFile.has_key ("FileInfo", "Filetype")) filetype = keyFile.get_string ("FileInfo", "Filetype");
|
||||
}
|
||||
|
||||
|
||||
if (format==FT_Raw && keyFile.has_group ("ExtraRawInfo")) {
|
||||
if (keyFile.has_key ("ExtraRawInfo", "ThumbImageType")) thumbImgType = keyFile.get_integer ("ExtraRawInfo", "ThumbImageType");
|
||||
if (keyFile.has_key ("ExtraRawInfo", "ThumbImageOffset")) thumbOffset = keyFile.get_integer ("ExtraRawInfo", "ThumbImageOffset");
|
||||
}
|
||||
else {
|
||||
rotate = 0;
|
||||
thumbImgType = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (Glib::Error) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int CacheImageData::save (const Glib::ustring& fname) {
|
||||
|
||||
rtengine::SafeKeyFile keyFile;
|
||||
|
||||
if (::g_file_test(fname.c_str(),G_FILE_TEST_EXISTS)) keyFile.load_from_file (fname);
|
||||
|
||||
keyFile.set_string ("General", "MD5", md5);
|
||||
keyFile.set_string ("General", "Version", options.version);
|
||||
keyFile.set_boolean ("General", "Supported", supported);
|
||||
keyFile.set_integer ("General", "Format", format);
|
||||
keyFile.set_integer ("General", "Rank", rank);
|
||||
keyFile.set_boolean ("General", "InTrash", inTrash);
|
||||
keyFile.set_boolean ("General", "RecentlySaved", recentlySaved);
|
||||
|
||||
if (timeValid) {
|
||||
keyFile.set_integer ("DateTime", "Year", year);
|
||||
keyFile.set_integer ("DateTime", "Month", month);
|
||||
keyFile.set_integer ("DateTime", "Day", day);
|
||||
keyFile.set_integer ("DateTime", "Hour", hour);
|
||||
keyFile.set_integer ("DateTime", "Min", min);
|
||||
keyFile.set_integer ("DateTime", "Sec", sec);
|
||||
keyFile.set_integer ("DateTime", "MSec", msec);
|
||||
}
|
||||
|
||||
keyFile.set_boolean ("ExifInfo", "Valid", exifValid);
|
||||
if (exifValid) {
|
||||
keyFile.set_double ("ExifInfo", "FNumber", fnumber);
|
||||
keyFile.set_double ("ExifInfo", "Shutter", shutter);
|
||||
keyFile.set_double ("ExifInfo", "FocalLen", focalLen);
|
||||
keyFile.set_integer ("ExifInfo", "ISO", iso);
|
||||
}
|
||||
keyFile.set_string ("ExifInfo", "Lens", lens);
|
||||
keyFile.set_string ("ExifInfo", "Camera", camera);
|
||||
keyFile.set_string ("FileInfo", "Filetype", filetype);
|
||||
|
||||
if (format==FT_Raw) {
|
||||
keyFile.set_integer ("ExtraRawInfo", "ThumbImageType", thumbImgType);
|
||||
keyFile.set_integer ("ExtraRawInfo", "ThumbImageOffset", thumbOffset);
|
||||
}
|
||||
|
||||
FILE *f = g_fopen (fname.c_str(), "wt");
|
||||
if (!f)
|
||||
return 1;
|
||||
else {
|
||||
fprintf (f, "%s", keyFile.to_data().c_str());
|
||||
fclose (f);
|
||||
return 0;
|
||||
}}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class CacheImageData {
|
||||
|
||||
// basic informations
|
||||
Glib::ustring md5;
|
||||
int version;
|
||||
Glib::ustring version;
|
||||
bool supported;
|
||||
ThFileType format;
|
||||
char rank;
|
||||
|
@ -75,7 +75,7 @@ void Options::setDefaults () {
|
||||
fbShowHidden = false;
|
||||
fbArrangement = 0;
|
||||
multiUser = false;
|
||||
version = TAGDISTANCE;
|
||||
version = VERSION;
|
||||
thumbSize = 80;
|
||||
thumbSizeTab = 80;
|
||||
showHistory = true;
|
||||
@ -181,7 +181,7 @@ if (keyFile.has_group ("General")) {
|
||||
if (keyFile.has_key ("General", "StoreLastProfile")) savesParamsAtExit = keyFile.get_boolean ("General", "StoreLastProfile");
|
||||
if (keyFile.has_key ("General", "DualProcSupport")) rtSettings.dualThreadEnabled = keyFile.get_boolean ("General", "DualProcSupport");
|
||||
if (keyFile.has_key ("General", "MultiUser")) multiUser = keyFile.get_boolean ("General", "MultiUser");
|
||||
// if (keyFile.has_key ("General", "Version")) version = keyFile.get_integer ("General", "Version");
|
||||
if (keyFile.has_key ("General", "Version")) version = keyFile.get_string ("General", "Version");
|
||||
if (keyFile.has_key ("General", "Language")) language = keyFile.get_string ("General", "Language");
|
||||
if (keyFile.has_key ("General", "Theme")) theme = keyFile.get_string ("General", "Theme");
|
||||
if (keyFile.has_key ("General", "UseSystemTheme")) useSystemTheme = keyFile.get_boolean ("General", "UseSystemTheme");
|
||||
@ -324,7 +324,7 @@ int Options::saveToFile (Glib::ustring fname) {
|
||||
keyFile.set_string ("General", "Language", language);
|
||||
keyFile.set_string ("General", "Theme", theme);
|
||||
keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme);
|
||||
keyFile.set_integer ("General", "Version", TAGDISTANCE);
|
||||
keyFile.set_string ("General", "Version", VERSION);
|
||||
keyFile.set_boolean ("General", "FirstRun", firstRun);
|
||||
keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath);
|
||||
keyFile.set_boolean ("General", "Verbose", rtSettings.verbose);
|
||||
|
@ -84,7 +84,7 @@ class Options {
|
||||
int fbArrangement;
|
||||
bool multiUser;
|
||||
static Glib::ustring rtdir;
|
||||
int version;
|
||||
Glib::ustring version;
|
||||
int thumbSize,thumbSizeTab;
|
||||
bool showHistory;
|
||||
int showFilePanelState; // 0: normal, 1: maximized, 2: normal, 3: hidden
|
||||
|
7
rtgui/ppversion.h
Normal file
7
rtgui/ppversion.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef _PPVERSION_
|
||||
#define _PPVERSION_
|
||||
|
||||
// This number have to be incremented whenever the PP3 file format is modified
|
||||
#define PPVERSION 300
|
||||
|
||||
#endif
|
@ -73,7 +73,7 @@ void ProfileStore::parseDir (const Glib::ustring& pdir) {
|
||||
}
|
||||
ProcParams* pp = new ProcParams ();
|
||||
int res = pp->load (fname);
|
||||
if (!res && pp->version>=220)
|
||||
if (!res && pp->ppVersion>=220)
|
||||
pparams[name] = pp;
|
||||
else
|
||||
delete pp;
|
||||
|
@ -158,7 +158,7 @@ void Thumbnail::loadProcParams () {
|
||||
if (options.paramsLoadLocation==PLL_Input) {
|
||||
// try to load it from params file next to the image file
|
||||
int ppres = pparams.load (fname + paramFileExtension);
|
||||
pparamsValid = !ppres && pparams.version>=220;
|
||||
pparamsValid = !ppres && pparams.ppVersion>=220;
|
||||
if (!pparamsValid)
|
||||
pparamsValid = !pparams.load (getCacheFileName ("profiles")+paramFileExtension);
|
||||
}
|
||||
@ -168,7 +168,7 @@ void Thumbnail::loadProcParams () {
|
||||
// if no success, load it from params file next to the image file
|
||||
if (!pparamsValid) {
|
||||
int ppres = pparams.load (fname + paramFileExtension);
|
||||
pparamsValid = !ppres && pparams.version>=220;
|
||||
pparamsValid = !ppres && pparams.ppVersion>=220;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -565,4 +565,4 @@ bool Thumbnail::openDefaultViewer(int destination) {
|
||||
return false;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user