If you have problems with the compilation, please ask on the appropriated RawTherapee forum :
http://www.rawtherapee.com/forum/viewforum.php?f=10


Windows
-------

	The toolchain:

		There is 2 method to compile RawTherapee, and they each rely on different and common packages. They are
		now referred to METHOD 1 and METHOD 2.
		Of course, you'll have to install the package for the build method explained later in this document.

		The rest of this document assumes that you've installed MinGW, MSYS and Gtkmm respectively to "C:\mingw",
		"C:\msys" and "C:\Gtkmm". 
		This tutorial assume that you've installed the packages in a paths THAT DOES NOT CONTAIN SPACES.

		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)
			- Gtkmm2.22 (http://ftp.se.debian.org/pub/gnome/binaries/win32/gtkmm/2.22/)

		METHOD 2:
			- MinGW-TDM (http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-4.5.1.exe/download)
			- CMake     (http://www.cmake.org/cmake/resources/software.html)
			- Gtkmm2.22 (http://ftp.se.debian.org/pub/gnome/binaries/win32/gtkmm/2.22/)

		Additionnal steps:
			When all the packages of your preferred method are installed:
			- 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.

	Dependancies:

		RawTherapee rely on libraries that may not be part of the Gtkmm or MinGW package. There is two ways of installing
		thoses libraries.

		The simple way:

			For your convenience, those libraries has been precompiled and are downloadable at :

			         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.

			Just unpack the content of this archive to the base installation dir of MinGW, and everything
			should work fine.

		The "Do It Yourself" way:

			The MSYS package is required to build the libraries. See above for the download link.

			Before building them, look if they are already installed in your Gtkmm and MinGW directories. There shouldn't be
			two versions of the same library in different place.

			Open an MSYS console, that will create a Linux environment, and compile the dependancies in that order:

			zlib:
			If you have Gtkmm2.22 installed, you can skip this section
			- download: http://zlib.net/
			- how to build:
			  cd to the unarchiving directory of zlib-1.2.5
			  make -f win32/Makefile.gcc

				Then, manually copy the files as follows:

				cp -iv zlib1.dll /mingw/bin
				cp -iv zconf.h zlib.h /mingw/include
				cp -iv libz.a /mingw/lib
				cp -iv libzdll.a /mingw/lib/libz.dll.a

			libpng:
			If you have Gtkmm2.22 installed, you can skip this section
			- download:     http://sourceforge.net/projects/libpng/files/
			                (please note that libpng 1.5 has not been tested yet)
			- how to build:
			  cd to the unarchiving directory of lpng144

				There's two options to build libpng :
				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:/gtkmm -DCMAKE_BUILD_TYPE:STRING=Release

				Then build and install:
				   make
				   make install

			libjpeg:
			- download:     http://www.ijg.org/
			- how to build:
			  cd to the unarchiving directory of jpeg-8b
			  ./configure --prefix=/mingw
			  copy the content of jconfig.txt to jconfig.h (overwrite the existing file)
			  make
			  make install

			libtiff:
			- download:     ftp://ftp.remotesensing.org/pub/libtiff/
			- how to build:
			  ./configure --prefix=/mingw
			  make
			  cd libtiff
			  make install

			libiptcdata:
			- download:     http://libiptcdata.sourceforge.net/
			- how to build:
			  ./configure --prefix=/mingw

			  Edit the "Makefile" file from the root dir of libiptcdata, and search for "DIST_SUBDIRS ="
			  and "SUBDIRS =". You should only find one line for each search. From those lines, remove "iptc", then

			  make
			  make install

			lcms:
			- download v1.x (v2.x is not supported yet): http://sourceforge.net/projects/lcms/files/
			- how to build:
			  ./configure --prefix=/mingw
			  make
			  make install

			Rawzor:
			provided in RT's source tree (downloaded from http://www.rawzor.com/developers/)

			IMPORTANT:
			   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) :
					-- checking for module 'libiptcdata'
					--   found libiptcdata, version 1.0.4
					-- checking for module 'lcms<=1.99'
					--   found lcms, version 1.19
					-- Found JPEG: C:/mingw/lib/libjpeg.dll.a
					-- 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:

		METHOD 1:
			Requirements:
			- MinGW + MSYS (FIXME: Do we talk
			- CMake
			- GTK and GTKMM development environments

			Compile:
			- Start an MSYS command line interface
			- Enter the root directory of the RawTherapee source tree (type: cd "/C/Absolute/Path/To/RawTherapee_sourceTree")
			- Type: cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -Ccmo.txt .
			- Type: make install
			- You'll find the compiled program in the subdirectory named like the value of CMAKE_BUILD_TYPE ("Release" in this example)

		METHOD 2:
			Requirements:
			- MinGW-TDM (http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-4.5.1.exe/download)
			- CMake     (http://www.cmake.org/cmake/resources/software.html)
			- Mercurial (http://mercurial.selenic.com/wiki/WindowsInstall)
			- Gtkmm     (http://ftp.se.debian.org/pub/gnome/binaries/win32/gtkmm/2.22/)

			Compile:
			- Start a standard DOS command line interface (WIN + "R" -> "cmd")
			- Enter the root directory of the RawTherapee source tree (type: cd C:\Absolute\Path\To\RawTherapee_sourceTree)
			- Type: cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -Ccmo.txt .
			- Type: mingw32-make.exe install
			- You'll find the compiled program in the subdirectory named like the value of CMAKE_BUILD_TYPE ("Release" in this example)

Linux
-----

	Requirements:
		- CMake
		- GTK and GTKMM development packages
		- libtiff, libpng, libjpeg, lcms, libiptcdata development packages
		- ...did I forget something?

	On Ubuntu/Debian the requirements can be installed by running:
		sudo apt-get install build-essential cmake libgtk2.0-dev libgtkmm-2.4-dev libtiff-dev libpng-dev libjpeg-dev liblcms-dev libiptcdata-dev mercurial

	Compile:
		- Enter the root directory of the RawTherapee source tree
		- Type: cmake -DCMAKE_INSTALL_PREFIX=./release -DBINDIR=. -DDATADIR=. -DLIBDIR=.
		- Type: make install
		- You find the compiled program in the release directory (you can copy it anywhere you want)

	(By changing the cmake flags, you can change where the release is.  By removing all flags it should go to the standard system install location).


	Using Eclipse under Linux:
	
		Eclipse mercurial plugin:
			click Help -> Install new Software.
			The Eclipse Update Site for MercurialEclipse is available at this URL:
			http://cbes.javaforge.com/update

		Import the rawtherapee mercurial repository:
			File->new->'other'->mercurial->Clone existing repository
			fill in URL: https://rawtherapee.googlecode.com/hg

		Enter root directory of RawTherapee source tree from a terminal window.
		configure the source for Eclipse with:
			cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_INSTALL_PREFIX=./release -DBINDIR=. -DDATADIR=. -DLIBDIR=. -DCMAKE_BUILD_TYPE=Release

		Eclipse does not do 'make install' but only 'make all' so to get the release there are 2 ways.
			1. type 'make install' in the console or,
			2. in 'Project'->'properties'->'C/C++ Make Project'->'Build (incremental build)' change 'all' to 'install'

OSX
---

Requirements:
- XCode Development Tools (you only need a subset of these, but it is probably easier to just install all of them)
- MacPorts
	- Set /opt/local/etc/macports/variants.conf to include "+no_x11 +quartz"
	- If you want to build for multiple architectures, add +universal to variants.conf.  Note that this will increase the size of the final application substantially.
		- Set /opt/local/etc/macports/macports.conf key 'universal_archs' to the architectures you wish to build for.  Possible values
		  include "i386 x86_64 ppc ppc64"
		- Edit beginning of CMakeLists.txt to enable the same architectures as you added to variants.conf
	- Run "sudo port install cairomm pango-devel gtk2 cmake glibmm gtkmm lcms libiptcdata" to install all needed libraries and tools
	- If you don't already have Mercurial installed, run "sudo port install mercurial"
	- If you want to try OpenMP builds, run "sudo port install gcc45"

Compile:
- Enter root directory of RawTherapee source tree
- Type: cmake -D CMAKE_C_COMPILER=gcc-mp-4.5 -D CMAKE_CXX_COMPILER=g++-mp-4.5 . (to enable OpenMP, assuming you have installed gcc45) OR:
        cmake -D OPTION_OMP=false . (to disable OpenMP and use the default compiler)
- Type: make install
- Type: ./tools/osx/make-app-bundle
- You will find a RawTherapee.dmg file in release/ folder; this is the distribution release and can be run on any machine which meets the 
  architecture requirements you specified in variants.conf earlier.

For any bugs or patches to the OSX build, please contact Wyatt <wyatt@digitalcave.ca>
