INSTALL 2.37 KB
Newer Older
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1 2 3 4 5 6
Installation Instructions
*************************

Basic Installation
==================

7 8 9 10 11
mkdir build
cd build
cmake ..
make
make install
Kristian Høgsberg's avatar
Kristian Høgsberg committed
12 13


14
CMake configuration options can be set using the -D option. eg
Kristian Høgsberg's avatar
Kristian Høgsberg committed
15

16
  cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=release
Kristian Høgsberg's avatar
Kristian Høgsberg committed
17 18


19 20
Build Options
=============
Kristian Høgsberg's avatar
Kristian Høgsberg committed
21

22
Set install prefix:
Kristian Høgsberg's avatar
Kristian Høgsberg committed
23

24
  -DCMAKE_INSTALL_PREFIX=<path>
Kristian Høgsberg's avatar
Kristian Høgsberg committed
25

26 27
Set build type. This sets the standard compiler flags for the build
type.
Kristian Høgsberg's avatar
Kristian Høgsberg committed
28

29
  -DCMAKE_BUILD_TYPE=debug  or  -DCMAKE_BUILD_TYPE=release
Kristian Høgsberg's avatar
Kristian Høgsberg committed
30

31
Set compiler flags:
Kristian Høgsberg's avatar
Kristian Høgsberg committed
32

33
  -DCMAKE_CXX_FLAGS=<flags>   or set CXXFLAGS environment variable
Kristian Høgsberg's avatar
Kristian Høgsberg committed
34

35
Set linker flags:
Kristian Høgsberg's avatar
Kristian Høgsberg committed
36

37
  -DCMAKE_LD_FLAGS=<flags>   or set LDFLAGS environment variable
Kristian Høgsberg's avatar
Kristian Høgsberg committed
38 39


40 41
Optional Features
=================
Kristian Høgsberg's avatar
Kristian Høgsberg committed
42

43
  -D<FEATURE>=<ON|OFF>
Kristian Høgsberg's avatar
Kristian Høgsberg committed
44

45
eg
Kristian Høgsberg's avatar
Kristian Høgsberg committed
46

47
  -DENABLE_SPLASH=ON -DBUILD_GTK_TESTS=OFF
Kristian Høgsberg's avatar
Kristian Høgsberg committed
48

49
A list of all options can be display with the commmand:
Kristian Høgsberg's avatar
Kristian Høgsberg committed
50

51
  egrep '^ *(option|set.*STRING)' CMakeLists.txt
Kristian Høgsberg's avatar
Kristian Høgsberg committed
52

53 54
Alternatively, the options can be edited by running "ccmake ." in the
build directory.
Kristian Høgsberg's avatar
Kristian Høgsberg committed
55 56


57 58
Cross Compiling
===============
Kristian Høgsberg's avatar
Kristian Høgsberg committed
59

60 61
A toolchain file is required to specify the target specific compiler
tools. Run cmake with the option:
Kristian Høgsberg's avatar
Kristian Høgsberg committed
62

63
  -DCMAKE_TOOLCHAIN_FILE=<Toolchain file>
Kristian Høgsberg's avatar
Kristian Høgsberg committed
64

65 66
A sample toolchain for a 64-bit mingw build is shown below. Replace
/path/to/win/root with the install prefix for the target environment.
Kristian Høgsberg's avatar
Kristian Høgsberg committed
67

68 69 70 71 72
  set(CMAKE_SYSTEM_NAME Windows)
  set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
  set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
  set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
  set(CMAKE_FIND_ROOT_PATH  /usr/x86_64-w64-mingw32 /path/to/win/root )
73 74 75
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
76

77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

Debugging Options
=================

Debug Build Types
-----------------
Release build with debugging information:
  -DCMAKE_BUILD_TYPE=relwithdebinfo

Debug build with optimization except for some code re-ordering optimizations:
  -DCMAKE_BUILD_TYPE=debug

Debug build with no optimization:
  -DCMAKE_BUILD_TYPE=debugfull

Release build with debugging and profiling information:
  -DCMAKE_BUILD_TYPE=profile


Address Sanitizer
-----------------
Ensure the extra cmake modules are available (may be a separate
package) then use -DECM_ENABLE_SANITIZERS to specify the santizers. eg

  -DECM_ENABLE_SANITIZERS='address;leak;undefined'

Some options may only be available with clang. Use
-DCMAKE_CXX_COMPILER=clang++ to build with clang.