From 4eb4b6bbd7079df096c3f4e3d894fee9d58d2fba Mon Sep 17 00:00:00 2001 From: Hombre Date: Sun, 26 Dec 2010 02:08:39 +0100 Subject: [PATCH] Correct a little mistake in COMPILE.txt and let the user choose the build flags for rtengine. --- CMakeLists.txt | 6 ++++++ COMPILE.txt | 18 ++++++++++-------- Win32CMakeOptions-Sample.txt | 5 ++++- rtengine/CMakeLists.txt | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 601bb4472..c9ee86522 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 2.6) set (CMAKE_BUILD_TYPE Debug CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel.") +# 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") + if (APPLE) # SET (CMAKE_OSX_ARCHITECTURES "i386;x86_64;" ) # SET (CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386;x86_64;" ) diff --git a/COMPILE.txt b/COMPILE.txt index eddb21994..2276c628e 100644 --- a/COMPILE.txt +++ b/COMPILE.txt @@ -17,6 +17,9 @@ Windows METHOD 1: - MinGW-TDM (http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-4.5.1.exe/download) + OpenMP seems to be broken in TDM-GCC4.5.1, so when MinGW has been installed, download and install + libgomp form tdm-gcc-4.5.0 + (http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%204.5%20series/Previous/4.5.0-tdm-1%20SJLJ/gcc-4.5.0-tdm-1-openmp.zip/download) - MSYS (http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe) If you have some trouble installing MSYS, see here : http://www.mingw.org/wiki/MSYS - CMake (http://www.cmake.org/cmake/resources/software.html) @@ -32,6 +35,8 @@ Windows - set the GTKMM_BASEPATH user or system environment variable to the installation directory of Gtkmm (the Gtkmm's installer can do it for you) - set the MINGW_BASEPATH user or system environment variable to the installation directory of MinGW32 + - set the PKG_CONFIG_PATH user or system environment variable to the location of the pkgconfig directories: + c:\mingw\lib\pkgconfig;c:\gtkmm\lib\pkgconfig You have to restart the console to take this new variables into account - Copy the "Win32CMakeOptions-sample.txt" file located in the root directory of RT's source tree, to "cmo.txt" (e.g.) You can edit that copy to change the compilation flags to your needs, but the default values should be fine. @@ -45,7 +50,7 @@ Windows For your convenience, those libraries has been precompiled and are downloadable at : - http://www.rawtherapee.com/releases_head/windows/dependancies/ + http://www.rawtherapee.com/releases_head/windows/dependencies_for_creating_builds/ If you don't find a suitable package for your toolchain, take the DIY way or ask a developer to build them for you. @@ -87,7 +92,7 @@ Windows 1. gtkmm doesn't provide zlib so i've compiled it myself cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/mingw -DCMAKE_BUILD_TYPE:STRING=Release 2. gtkmm provide zlib and i want to reuse it (so we're assuming that you didn't compiled zlib like explained here above) - cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/mingw -DCMAKE_PREFIX_PATH:PATH=C:/gtkmm2.22 -DCMAKE_BUILD_TYPE:STRING=Release + cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/mingw -DCMAKE_PREFIX_PATH:PATH=C:/gtkmm -DCMAKE_BUILD_TYPE:STRING=Release Then build and install: make @@ -132,10 +137,7 @@ Windows provided in RT's source tree (downloaded from http://www.rawzor.com/developers/) IMPORTANT: - 1. When all the compilations are done (or even before), don't forget to set the PKG_CONFIG_PATH - user or system environment variable to the location of the pkgconfig dir, usually c:\mingw\lib\pkgconfig - You have to restart the console to take this new variable into account - 2. Make sure that the *.pc files of the dependancies, located in the pkgconfig dir, has the first + Make sure that the lcms.pc and libiptcdata.pc files located in the pkgconfig dir has the first line like this : prefix=/mingw If everything is well installed, you should see the following lines when running the cmake command (see "Building RT" below) : @@ -144,8 +146,8 @@ Windows -- checking for module 'lcms<=1.99' -- found lcms, version 1.19 -- Found JPEG: C:/mingw/lib/libjpeg.dll.a - -- Found ZLIB: C:/gtkmm2.22/lib/libz.dll.a - -- Found PNG: C:/gtkmm2.22/lib/libpng.lib + -- Found ZLIB: C:/gtkmm/lib/libz.dll.a + -- Found PNG: C:/gtkmm/lib/libpng.lib -- Found TIFF: C:/mingw/lib/libtiff.dll.a Building RT: diff --git a/Win32CMakeOptions-Sample.txt b/Win32CMakeOptions-Sample.txt index 765e805ac..3aeb1fd32 100644 --- a/Win32CMakeOptions-Sample.txt +++ b/Win32CMakeOptions-Sample.txt @@ -9,7 +9,7 @@ set(DATADIR . CACHE PATH "Datas installation path") set(BINDIR . CACHE PATH "Binaries installation path") set(LIBDIR . CACHE PATH "Libraries installation path") -set(CMAKE_PREFIX_PATH $ENV{GTKMM_BASEPATH} $ENV{MINGW_BASEPATH} CACHE STRING "Additional search paths") +set(CMAKE_PREFIX_PATH $ENV{MINGW_BASEPATH} $ENV{GTKMM_BASEPATH} CACHE STRING "Additional search paths") set(BUILD_SHARED OFF CACHE BOOL "Should RT generate shared libraries") set(WITH_RAWZOR ON CACHE BOOL "With Rawzor") @@ -24,6 +24,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "-mwindows -DNDEBUG -O2" CACHE STRING "Compiler opti set(CMAKE_CXX_FLAGS_MINSIZEREL "-mwindows -DNDEBUG -Os" CACHE STRING "Compiler options for C++ source files and MinSizeRel target") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Compiler options for C++ source files and RelWithDebInfo target") +# Uncomment the next line and set the right value to override the default value +#set(RTENGINE_CXX_FLAGS "-funroll-loops" CACHE STRING "Special compilation flags for RTEngine") + set(CMAKE_C_FLAGS "-mwin32 -mthreads -march=native" CACHE STRING "Compiler options for C source files") set(CMAKE_C_FLAGS_DEBUG "-O0 -g2" CACHE STRING "Compiler options for C source files and Debug target") set(CMAKE_C_FLAGS_RELEASE "-mwindows -DNDEBUG -O2" CACHE STRING "Compiler options for C source files and Release target") diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index 53adfc87b..998f6b9f5 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -23,7 +23,7 @@ IF (BUILD_SHARED_LIBS) install (TARGETS rtengine DESTINATION ${LIBDIR}) ENDIF (BUILD_SHARED_LIBS) -set_target_properties (rtengine PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -funroll-loops") +set_target_properties (rtengine PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${RTENGINE_CXX_FLAGS}") target_link_libraries (rtengine rtexif ${EXTRA_LIB} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES} ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES}