diff --git a/CMakeLists.txt b/CMakeLists.txt index edd224509..d34900ffb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,8 @@ if (APPLE) 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" ON) @@ -134,22 +136,42 @@ find_package (PNG REQUIRED) find_package (TIFF REQUIRED) find_package (ZLIB REQUIRED) -# 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) +if (AUTOMATED_BUILD_SYSTEM) -#generating AboutThisBuild.txt -if (WIN32) + 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) + elseif (APPLE) include (About-Apple.cmake) -else (WIN32) + else (WIN32) include (About-Linux.cmake) -endif (WIN32) -add_dependencies(AboutFile Debug Release MinSizeRel RelWithDebInfo) + endif (WIN32) + add_dependencies(AboutFile Debug Release MinSizeRel RelWithDebInfo) + +endif (AUTOMATED_BUILD_SYSTEM) # link rawzor if (WITH_RAWZOR) diff --git a/COMPILE.txt b/COMPILE.txt index f8a75f354..76b3cc696 100644 --- a/COMPILE.txt +++ b/COMPILE.txt @@ -8,7 +8,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. @@ -16,6 +16,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 ------- diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 63284908b..3e41e4141 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -23,9 +23,12 @@ #include #include #include +#include #include +#define APPVERSION VERSION + namespace rtengine { namespace procparams { @@ -227,14 +230,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); @@ -503,9 +507,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")) { @@ -521,7 +527,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"); } @@ -545,7 +551,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"); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 0ae89adae..5f22d433c 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -455,7 +455,8 @@ class ProcParams { HSVEqualizerParams hsvequalizer; ///< hsv equalizer parameters std::vector exif; ///< List of modifications appplied on the exif tags of the input image std::vector 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. diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index dd4327580..85b49d700 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -100,7 +100,7 @@ int CacheImageData::save (const Glib::ustring& fname) { if (safe_file_test(fname,Glib::FILE_TEST_EXISTS)) keyFile.load_from_file (fname); keyFile.set_string ("General", "MD5", md5); - keyFile.set_integer ("General", "Version", options.version); + 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); diff --git a/rtgui/options.cc b/rtgui/options.cc index 6373344d5..ccb5a6194 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -76,7 +76,7 @@ void Options::setDefaults () { fbShowHidden = false; fbArrangement = 0; multiUser = false; - version = TAGDISTANCE; + version = VERSION; thumbSize = 80; thumbSizeTab = 80; showHistory = true; @@ -186,7 +186,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"); @@ -337,7 +337,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_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath); diff --git a/rtgui/options.h b/rtgui/options.h index 98f9e8c5b..9988004ba 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -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 diff --git a/rtgui/ppversion.h b/rtgui/ppversion.h new file mode 100644 index 000000000..8a98f48b2 --- /dev/null +++ b/rtgui/ppversion.h @@ -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 diff --git a/rtgui/profilestore.cc b/rtgui/profilestore.cc index 7cefa4ca1..a1455bd6f 100644 --- a/rtgui/profilestore.cc +++ b/rtgui/profilestore.cc @@ -74,7 +74,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; diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 700a7d806..0ee858662 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -159,7 +159,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); } @@ -169,7 +169,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; } } } @@ -571,4 +571,4 @@ bool Thumbnail::openDefaultViewer(int destination) { return false; #endif -} \ No newline at end of file +}