summaryrefslogtreecommitdiff
path: root/doc/building.txt
blob: 7dacafdb4beab874d3ed9101eea7ff3b6b394ccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Quickstart
===========

On Linux, this likely what you want:

    cmake \
        -DCMAKE_LIBRARY_PATH=$(echo $LIBRARY_PATH | sed 's/:/;/g') \
        -Dwaffle_has_glx=1 \
        -Dwaffle_has_x11_egl=1 \
        $WAFFLE_SOURCE_DIR
    make
    make check
    make install


Configuration
=============

To configure Waffle, invoke CMake as `cmake [options] $WAFFLE_SOURCE_DIR`.
Options are given in form `-Dname=value`. CMake stores its configuration in a
top-level file named CMakeCache.txt. To edit cached variables, either edit the
file by hand or call `make edit_cache`.

CMake builtin options:

    CMake has many builtin options. Here is a small subset of important
    options that affect Waffle.

    Unlike Autoconf, CMake doesn't detect environment variables like
    LIBRARY_PATH and CFLAGS. You need to set some of the options below to get
    that behavior.

    - CMAKE_BUILD_TYPE
        [default=?; choices=debug,release]
        This affects compilation flags.

    - CMAKE_C_FLAGS
        [default="--std=c99 -Wall -Werror"]

    - CMAKE_C_FLAGS_DEBUG
        [default="-g3 -O0 -DDEBUG"]
        Flags to append to CMAKE_C_FLAGS when CMAKE_BUILD_TYPE=debug.

    - CMAKE_C_FLAGS_RELEASE
        [default="-g1 -O2 -DNEDEBUG"]
        Flags to append to CMAKE_C_FLAGS when CMAKE_BUILD_TYPE=release.

    - CMAKE_LIBRARY_PATH
        [default=none]
        A semicolon-separated list of directories in which to search for
        libraries.

    - CMAKE_INSTALL_PREFIX
        [default=/usr/local]
        Equivalent to autoconf's --prefix.

Platform options;

    - waffle_has_glx
        [default=0] [choices=0,1]
        Build Waffle with support for GLX.

    - waffle_has_wayland
        [default=0] [choices=0,1]
        Build Waffle with support for Wayland.

    - waffle_has_x11_egl
        [default=0] [choices=0,1]
        Build Waffle with support for X11/EGL.

Install options:

    - waffle_install_includedir
        [default=${CMAKE_INSTALL_PREFIX}/include]
        Directory where libraries will be instaled.

    - waffle_install_libdir
        [default=${CMAKE_INSTALL_PREFIX}/lib]
        Directory where libraries will be installed.

    - waffle_install_docdir
        [default=${CMAKE_INSTALL_PREFIX}/share/doc/waffle]
        Directory where documentation will be instaled.

Miscellaneous options:

    - waffle_build_tests
        [default=1; choices=0,1]
        Build the unit tests and functional tests ran by `make check`.

    - waffle_build_examples
        [default=1; choices=0,1]
        Build the stuff in the /examples directory.


Building and Installing
=======================

To build and install Waffle:

    make
    make install

I strongly recommend you run `make check` before installing.

What follows is a list of significant build targets.

Generic targets:

    - all
        Build everything.

    - check
        Run all tests, unit tests and functional tests.

    - install
        Install libraries and headers.

Libraries:

    - waffle
        Waffle's main library.

    - waffle_test
        Waffle's test framework.

Test programs:

    - waffle-unittest
    - gl_basic_test

Example programs:

    - gl_basic

CMake targets:

    - help
        List all make targets.

    - edit_cache
        Edit CMakeCache.txt.

    - rebuild_cache