|
| 1 | +# Compilation |
| 2 | +This document explains how to compile HDRMerge. |
| 3 | + |
| 4 | +## Dependencies |
| 5 | +- [ALGLIB](http://www.alglib.net/) |
| 6 | +- [Boost](http://www.boost.org/) |
| 7 | +- [CMake](https://cmake.org/) |
| 8 | +- [exiv2](http://www.exiv2.org/) |
| 9 | +- [gettext](http://www.gnu.org/software/gettext/) |
| 10 | +- [libexpat](http://expat.sourceforge.net/) |
| 11 | +- [libiconv](https://www.gnu.org/software/libiconv/) |
| 12 | +- [LibRaw](http://www.libraw.org/) |
| 13 | +- [Qt](http://qt-project.org/) 4.8 |
| 14 | +- [zlib](http://www.zlib.net/) |
| 15 | + |
| 16 | +Install the dependencies and proceed to the next section. |
| 17 | + |
| 18 | +### Arch and derivatives |
| 19 | +```bash |
| 20 | +sudo pacman -Syy |
| 21 | +sudo pacman -S --needed cmake libraw pacaur qt4 |
| 22 | +pacaur -S alglib |
| 23 | +``` |
| 24 | + |
| 25 | +### Debian/Ubuntu and derivatives |
| 26 | +```bash |
| 27 | +sudo apt update |
| 28 | +sudo apt install build-essential cmake git libalglib-dev libboost-all-dev libexiv2-dev libexpat-dev libraw-dev qt4-default zlib1g-dev |
| 29 | +``` |
| 30 | + |
| 31 | +### Gentoo and derivatives |
| 32 | +```bash |
| 33 | +sudo emerge -uva sci-libs/alglib dev-libs/boost dev-util/cmake media-gfx/exiv2 dev-vcs/git media-libs/libraw sys-devel/gettext dev-libs/expat virtual/libiconv dev-qt/qtcore:4 sys-libs/zlib |
| 34 | +``` |
| 35 | + |
| 36 | +## Compilation in Windows |
| 37 | +- Download ALGLIB from http://www.alglib.net/download.php and set the base path in `ALGLIB_ROOT`. |
| 38 | +- Install NSIS from http://nsis.sourceforge.net/Download |
| 39 | + If you install it to a custom folder, make sure it is accessible from your `PATH` environment variable. |
| 40 | + |
| 41 | +Install all other dependencies. |
| 42 | + |
| 43 | +After the `cmake` process, open `${PROJECT_BINARY_DIR}\setup.nsi` and replace all backslashes with forward slashes in the following: |
| 44 | +- All `MUI_` variables. |
| 45 | +- The lines following `File "hdrmerge.exe"` |
| 46 | + |
| 47 | +Now you can `make install`. |
| 48 | + |
| 49 | +You have finished. |
| 50 | + |
| 51 | +## Compilation in Linux for Linux |
| 52 | +Once you have installed the dependencies, run the following to clone and compile HDRMerge: |
| 53 | +```bash |
| 54 | +mkdir ~/programs |
| 55 | +git clone https://github.com/jcelaya/hdrmerge.git ~/programs/code-hdrmerge |
| 56 | +cd ~/programs/code-hdrmerge |
| 57 | +./build-hdrmerge |
| 58 | +``` |
| 59 | + |
| 60 | +HDRMerge will be ready for use in `~/programs/hdrmerge/hdrmerge` |
| 61 | +You have finished. |
| 62 | + |
| 63 | +## Compilation in Linux for Windows |
| 64 | +These instructions are meant to be a guide to cross-compile HDRMerge on Debian for the Windows platform, both 32- and 64-bit editions. |
| 65 | + |
| 66 | +It is assumed that you are installing your cross-compiled libraries in `$HOME/usr/x86_64-w64-mingw32`. |
| 67 | +For the 32-bit version, substitute `x86_64-w64-mingw32` for `i686-w64-mingw32` everywhere it appears. |
| 68 | + |
| 69 | +You will need to build/download the following libraries: |
| 70 | +- Qt |
| 71 | +Unpack Qt and build it as: |
| 72 | + ```bash |
| 73 | + ./configure -static -xplatform win32-g++ -device-option CROSS_COMPILE=x86_64-w64-mingw32- -prefix $HOME/usr/x86_64-w64-mingw32/Qt-4.8.6-static -opensource -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-openssl -no-nis -no-cups -no-dbus -qt-freetype -make libs -nomake tools -nomake examples -nomake tests -qtlibinfix 4 |
| 74 | + make install |
| 75 | + ``` |
| 76 | +- LibRaw |
| 77 | +For the libraries that can be built with CMake, you can use the toolchain file that is shipped with HDRMerge. There are two versions, one for 32-bit and another for 64-bit. You probably do not need to change them, but they include some paths that may be different in your system. In particular, you must set the variable `PREFIX` (or pass it as parameter to CMake) to where you want CMake to look for additional software. |
| 78 | +Once LibRaw is uncompressed, it is built with GNU Autoconf: |
| 79 | + ```bash |
| 80 | + ./configure --prefix=$HOME/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-shared --enable-openmp --disable-jpeg --disable-jasper --disable-lcms --disable-examples |
| 81 | + make install |
| 82 | + ``` |
| 83 | +- zlib |
| 84 | +ZLib is built using a Makefile in the win32 directory: |
| 85 | + ```bash |
| 86 | + make -f win32/Makefile.gcc PREFIX=x86_64-w64-mingw32- BINARY_PATH=$HOME/usr/x86_64-w64-mingw32/bin INCLUDE_PATH=$HOME/usr/x86_64-w64-mingw32/include LIBRARY_PATH=$HOME/usr/x86_64-w64-mingw32/lib install |
| 87 | + ``` |
| 88 | +- libiconv |
| 89 | +GNU libiconv is built with GNU Autoconf: |
| 90 | + ```bash |
| 91 | + ./configure --prefix=$HOME/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-shared |
| 92 | + make install |
| 93 | + ``` |
| 94 | +- libexpat |
| 95 | +libexpat is built with GNU Autoconf: |
| 96 | + ```bash |
| 97 | + ./configure --prefix=$HOME/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-shared |
| 98 | + make install |
| 99 | + ``` |
| 100 | +- gettext |
| 101 | + ```bash |
| 102 | + ./configure --prefix=$HOME/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-shared |
| 103 | + make install |
| 104 | + ``` |
| 105 | +- Exiv2 |
| 106 | + ```bash |
| 107 | + ./configure --prefix=$HOME/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-shared --with-zlib=$HOME/usr/x86_64-w64-mingw32 |
| 108 | + make install |
| 109 | + ``` |
| 110 | + |
| 111 | +Once you have the dependencies installed, you are ready to compile HDRMerge. |
| 112 | +Set the CMake variable `QT_ROOT` to where you have the Qt libraries installed. |
| 113 | + |
| 114 | +```bash |
| 115 | +mkdir build-win64 |
| 116 | +cd build-win64 |
| 117 | +cmake -DCMAKE_TOOLCHAIN_FILE=${HDRMERGE_PATH}/cmake/Windows64.cmake -DPREFIX=$HOME/usr/x86_64-w64-mingw32 -DQT_ROOT=$HOME/usr/x86_64-w64-mingw32/Qt-4.8.6-static ${HDRMERGE_PATH} |
| 118 | +make |
| 119 | +``` |
| 120 | + |
| 121 | +The result of the compilation should be the binaries `hdrmerge.exe` and `hdrmerge-nogui.exe`. |
| 122 | +You have finished. |
0 commit comments