This is the INSTALL file for Luminance HDR
-------------------------------------------------------------------
Copyright (C)  	2006-2010, Giuseppe Rota <grota@users.sourceforge.net>
				2010-2017, Davide Anastasia <davideanastasia@users.sourceforge.net>
                           Franco Comida <fcomida@users.sourceforge.net>
                           Daniel Kaneider <danielkaneider@users.sourceforge.net> 

Webpage:       http://qtpfsgui.sourceforge.net
GitHub:        http://github.com/LuminanceHDR/LuminanceHDR
Sourceforge:   http://sourceforge.net/projects/qtpfsgui



Contents
---------
1. Basic compilation of the sources
2. Internationalization
3. Dependencies
4. Enabling Unit Test compilation
5. Note for Packagers

Last update: 2017.04.09

The build system is based on CMake (http://www.cmake.org/).
The build description is contained in the CMakeLists.txt file.

1. Basic compilation of the sources
------------------------------------------------------------------- 
To compile from source execute the following command from an EMPTY folder:

> cmake <luminance source code directory>

to generate the Makefile. We strongly suggest to use an EMPTY folder OUTSIDE the source
directory.

It is also possible to generate specific project files for well known IDEs (Visual Studio,
Xcode and so on). Please, refer to CMake's manual for all the available options.
CMake will also check whether all the dependecies are available or not and it will show
a message accordingly.

Then execute the command:

> make

to compile the source code.

Finally execute (as root) the command:

> make install

to install the luminance executable in /usr/local/bin (if not differently specified during
the configuration command). This last step will also install the icon, the desktop file,
the html documentation and the "qm" translation files used for internationalization.

2. Internationalization
-------------------------------------------------------------------
Luminance HDR source are shipped with updated translation files for internationalization.
These file are stored inside the folder "i18n". Should you make a change inside the source code 
(in particular on the UI), you need to update them.
Enabling updating of translations is performed issuing the following command:

> cmake -DUPDATE_TRANSLATIONS=ON .

if the current working directory (please, refer to 1. of this file) has already been
built, otherwise:

> cmake -DUPDATE_TRANSLATIONS=ON <luminance source code directory>

This command will regenerate the Makefile for translation update. Then:

> make

will update every .ts file.

To bring back the working folder to the original "building mode", you must use this command:

> cmake -DUPDATE_TRANSLATIONS=OFF .

and then

> make

to build correctly the whole source directory.


3. Dependencies
-------------------------------------------------------------------

Luminance has 12 dependencies (eleven are mandatory, one is optional):

1) Qt5 (http://qt-project.org)
Qt5 is the heart of the the graphical user interface (GUI). In the case of the Windows
version, Qt version must agree with the final building environment (Visual Studio or 
*** deprecated *** MinGW)

2) exiv2 (www.exiv2.org)
libexiv2 is a C/C++ library used to extract EXIF tags from LDR and RAW image files, and it is
required in order to extract the aperture, exposure-time and ISO tags from the input
images (and for other EXIF-related functionalities).

3) fftw3 (www.fftw.org)
FFTW is required by the fast implementation of various tonemapping algorithm and anti-ghosting feature. 
Luminance HDR requires the "float" version of fftw3 (usually called fftw3f or fftw3-single on MacPorts).

4) libtiff (http://www.remotesensing.org/libtiff)
libtiff is required because of the tiff load/save feature.

5) libjpeg (http://libjpeg.sourceforge.net/)
libjpeg is required because of the jpeg load/save feature.

6) libpng (http://libpng.org/)
libpng is required because of the png save feature.

7) OpenEXR (www.openexr.com)
OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light &
Magic for use in computer imaging applications. The package is also known as *ilmbase* 
in some GNU/Linux distributions.

8) Gnu Gsl (http://www.gnu.org/software/gsl/)
Gnu GSL is required because Mantiuk08 TMO uses this library.

9) LibRAW (http://www.libraw.org/)
Used to read the vast majority of RAW file on the market.

10) LCMS2 (http://www.littlecms.com/)
Luminance HDR color management engine.

11) Boost (http://www.boost.org/)
Boost provides free peer-reviewed portable C++ source libraries used inside Luminance HDR project.

12) cfitsio (Optional) (http://heasarc.gsfc.nasa.gov/fitsio/)
CFITSIO is a library of C and Fortran subroutines for reading and writing data files in FITS 
(Flexible Image Transport System) data format.
Luminance HDR can optionally support this file format commonly used by the astrophotographers community.
The build system will automatically detect the presence of the library in the system enabling proper support 
for astronomical image processing.


Windows:
Currently, Luminance HDR can be compiled using Microsoft Visual Studio. It either works
using precompiled libraries (supplied at http://sourceforge.net/projects/qtpfsgui/files/DEPs/
for different versions of Visual Studio) or building every dependency and Luminance itself using a script file
(build_files/platforms/msvc/getDependencies.cmd.
More information can be found inside build_files/platforms/msvc/README.txt).

NOTE: depending on your compiler (MinGW GCC or MS Visual Studio), you must either download the
proper version of Qt or build it yourself accordingly.

GNU/Linux:
On GNU/Linux you have to compile the code and you need the aforementioned packages
(and the *devel* or *dev* ones, depending on the distribution's naming convention).
CMake will guide you to correctly understand which dependency are missing and which are not.

Mac OS X:
On Mac OS X, all the dependecies can be obtained using MacPorts, except LibRAW that
must be compiled straight from source, and Qt5 which must be downloaded from the official
website of the Qt project.

4. Enabling Unit Test compilation
-------------------------------------------------------------------
In order to enable the compilation of our testing code pass -DENABLE_UNIT_TEST=ON option to cmake.
Google's framework 'gtest' must be installed in your system, the resulting test executables 
will be placed under <BUILD_ROOT>/test where <BUILD_ROOT> is your building root directory.

5. Note for Packagers
-------------------------------------------------------------------
Luminance's default installation prefix is "/usr/local". You can execute:

> cmake -DCMAKE_INSTALL_PREFIX=/usr

before running make in order to modify the default CMAKE_INSTALL_PREFIX.

Icon luminance-hdr.png will be installed in ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps.
You may need to run update-desktop-database in case Luminance's entry doesn't show up
in the graphical menus. 
Translation files will be installed inside ${CMAKE_INSTALL_PREFIX}/share/luminance-hdr/i18n
Help files will be installed inside ${CMAKE_INSTALL_PREFIX}/share/luminance-hdr/help

Running:

> cmake -DCMAKE_BUILD_TYPE={Debug,Release,RelWithDebInfo}

creates a Makefile that builds Luminance with different debug levels. It is strongly
suggest to use *RelWithDebInfo*: this option will leave inside the final executable all
the info necessary for a proper debug but at the same time will optimize the code as much
as possible for good performance.

The Windows EXE is currently build using Microsoft Visual Studio.
In GNU/Linux you have to compile the code and you need the packages mentioned in Section 3
(and the *devel* or *dev* ones, depending on the distribution's naming convention).
If you want to compile the sources in windows, you need to have a compiled version of all
the dependencies.
Building Luminance from sources on Mac OS X can be performed creating a Makefile or an Xcode
project using CMake. By default, CMake creates a Makefile on Mac OS X.

OpenMP is only available if compiling with GCC 4.3 or newer or with Microsoft Visual Studio
(CMake will correctly find the right option for OpenMP accordingly to your compiler).

Optimisation note: the default compiler flags include SSE2 and [Linux only] OpenMP.
SSE2 is only available on recent CPUs (Pentium 4, Pentium-M or newer).
