Compilation of OpenPref Source Code

Why should I build OpenPref from sources?

You need to build OpenPref from sources if you want to test very latest (“bleeding edge”) version. Early testing is crucial for preventing of bugs and regressions from being released. Please join mailing list openpref-devel@lists.sourceforge.net to get information about features that need testing (see also Contact us page).

Also you can build OpenPref from sources to get it running on any OS platform not supported by OpenPref maintainers.

Build requirements

In order to build OpenPref you need reasonably modern C++ compiler. G++ 4.x (including MinGW version) and Intel >= 10.x (Linux) were tested.

You also need to have Qt4 (>=4.4.0) libraries with appropriate development packages. Earlier versions may work, but were not tested. Make sure you have qmakemocuic, and rccexecutables installed (package qt4-dev-tools on some Linux distributions). And, of course, you need to download source code :)

You also may want to install CMake build system.

Building with QMake

QMake is a part of Qt development tools and standard build system for Qt applications. To build OpenPref, run the next commands in source directory:

lrelease openpref.pro
qmake openpref.pro
make

If no error occur, after this actions you will have openpref executable in current directory. Run it with command

./openpref

To install OpenPref, run

make install

with root privileges. By default, OpenPref binary will be installed to /usr/local/games directory to prevent collision with version, installed from repositories. To change installation path, specify the next parameters in command line of qmake:

PREFIX

specifies the installation prefix (default /usr/local)

BIN_INSTALL_DIR

specifies the installation path for resulting binary inside prefix (default games, which installs it into PREFIX/games).

For example, the next command sets installation directory to /usr/bin:

qmake PREFIX=/usr BIN_INSTALL_DIR=bin

Building with CMake

To build with cmake, you need cmake >= 2.4-patch 8 . You can get cmake at
http://www.cmake.org or in your repository.

There are two ways to build OpenPref with cmake:  inside the source tree or outside it. Out of source tree builds have the advantage that you can have builds with different options or using different compilers from one source directory.

To build OpenPref outside of the source tree:

mkdir build
cd build
cmake ..
make
make install

To build OpenPref inside the source tree:

cmake .
make
make install

To change build options, you can either pass the options on the command line:

cmake .. -DOPTION=value

or use the ccmake frontend which displays all options with their cached values.

ccmake ..

Available settings

-DCMAKE_INSTALL_PREFIX

specifies the installation prefix (default /usr/local)

-DBIN_INSTALL_DIR

specifies the installation path for resulting binary inside prefix (default games, which installs it into ${CMAKE_INSTALL_PREFIX}/games)