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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><title>
Building Allegro with CMake
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" title="Default" type="text/css" href="../allegro.css"></head><body bgcolor=white text=black link="#0000ee" alink="#ff0000" vlink="#551a8b">
<p><br>
<h1><a name="Building Allegro 4.4 with CMake">Building Allegro 4.4 with CMake</a></h1>
<p>
CMake is a cross-platform tool that can generate native makefiles and
workspaces that can be used in the compiler environment of your choice.
Allegro 4.4 uses CMake as its build system. The process is essentially the
same for all compilers. You will need CMake 2.6 or later.
The CMake web site is <a href="http://www.cmake.org/">http://www.cmake.org/</a>.
<ol><li>
Create a temporary directory to build in. This is optional but recommended.
If something goes wrong you can delete the build directory and try again.
<code>
<p>
$ mkdir Build
<p>
$ cd Build
</code>
<p>
<li>Run CMake in the build directory. This will detect your compiler
environment and generate makefiles or workspaces for you. You may pass some
options to customise the build (see later), but the defaults should be fine.
You may need to tell CMake which type of files it should generate, using the
-G option. You can call CMake using the --help option to see a list of
available generators.
<p>
Examples (you only need one):
<code>
<p>
$ cmake ..
<p>
$ cmake -G "MinGW Makefiles" ..
</code>
<p>
On Unix/Mac you can use `ccmake` which will present you with a console
program to adjust the options. On Windows you can use `cmake-gui` instead
(it should be listed in the Start menu or on the desktop).
<p>
If you are missing any dependencies, CMake will tell you at this point. You
can continue without building all of the addons, or install the dependencies
and retry. You may need to delete the `CMakeCache.txt` file first.
<p>
<li>Use the generated makefiles or workspaces to build Allegro. If using
makefiles, type `make` or `mingw32-make`. If using workspaces, open them in
your IDE. If using Xcode, you can use `xcodebuild` from the command-line or
the IDE.
<p>
<li>Optionally install the libraries and header files to your system.
<code>
<p>
$ make install
</code>
<p>
DESTDIR is supported, e.g.
<code>
<p>
$ make install DESTDIR=/tmp/package-allegro
</code></ol>
<p><br>
<h1><a name="Build options">Build options</a></h1>
<p>
Here are some build options you may be interested in. You can set them on
the command line like so, or using one of the front ends:
<code>
<p>
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
</code>
<p>
<dt><b>CMAKE_BUILD_TYPE</b> (default: RelWithDebInfo)</dt><dd>
Selects release, debug or profiling configurations. Valid values are:
Release, Debug, RelWithDebInfo, MinSizeRel, Profile.
<p>
<p>
If you are installing multiple configurations in a row, we recommend
installing the Release or RelWithDebInfo configuration last, so that the
installed allegro-config script will default to that configuration.
</dd>
<p>
<dt><b>SHARED</b> (default: on)</dt><dd>
Whether to build the main Allegro library as a shared library (DLL) or as
a static library. Addon libraries are always built as static libraries,
for simplicity.
</dd>
<p>
<dt><b>CMAKE_INSTALL_PREFIX</b> (e.g. /usr/local)</dt><dd>
Where to install the library and header files.
</dd>
<p>
<dt><b>WANT_<addon></b> (default: on)</dt><dd>
Whether you want to build/install each particular addon.
</dd>
<p>
<dt><b>WANT_EXAMPLES</b> (default: off)</dt><dd>
Whether you want the specified addon's example programs to be built.
</dd>
<p>
<dt><b>WANT_FRAMEWORKS</b> (default: off)</dt><dd>
On Mac OS X, whether to build and install frameworks instead of
Unix-style shared libraries.
<p>
<p>
If you want both kinds, you will need to run cmake twice and install
twice.
</dd>
<p>
<dt><b>WANT_EMBED</b> (default: on)</dt><dd>
If building frameworks, whether to build embedded or non-embedded
frameworks. An application bundle that links against an embedded
framework will first search for the framework within the application
bundle, then fall back to system paths.
</dd>
<p>
<dt><b>FRAMEWORK_INSTALL_PREFIX</b></dt><dd>
Where to install frameworks.
</dd>
<p>
<dt>CMAKE_OSX_ARCHITECTURES</dt><dd>
You may set this to a semicolon-separated list of the architectures
to compile for, to produce universal binaries, e.g. "i386;ppc".
</dd>
<p><br>
<h1><a name="Dependencies">Dependencies</a></h1>
<p>
Many of the addons make use of additional libraries. They are not required
to build Allegro, but functionality may be disabled if they are not present.
<p>
Windows users may find some precompiled binaries from
<a href="http://gnuwin32.sourceforge.net/">http://gnuwin32.sourceforge.net/</a>. You need to get the bin and lib
packages. The bin packages contain DLLs, and the lib packages contain the
headers and import libraries.
<p>
Mac users may find some dependencies in Fink or MacPorts.
<a href="http://www.finkproject.org/">http://www.finkproject.org/</a> and
<a href="http://www.macports.org/">http://www.macports.org/</a>
<p>
Linux users likely have all the dependencies already. If your distribution
uses separate development packages, they will need to be installed. The
packages are probably named *-dev or *-devel.
<ul><li>
OpenGL is required for AllegroGL.
<li>
libpng and zlib, for PNG image support.<br>
These are used by loadpng.<br>
Home page: <a href="http://www.libpng.org/pub/png/">http://www.libpng.org/pub/png/</a><br>
Windows binaries: <a href="http://gnuwin32.sourceforge.net/packages/libpng.htm">http://gnuwin32.sourceforge.net/packages/libpng.htm</a>
<li>
Ogg Vorbis, a free lossy audio format. (libogg, libvorbis, libvorbisfile)<br>
This is used by logg.<br>
Home page: <a href="http://www.vorbis.com/">http://www.vorbis.com/</a>
<li>
jpgalleg does not require any additional libraries.
</ul>
<p><br>
<h1><a name="Platform-specific information">Platform-specific information</a></h1>
<p>
Please see the other files in the docs/build directory for additional
information specific to each platform.
</body>
</html>
|