The Allegro Wiki is migrating to github at


From Allegro Wiki
Jump to: navigation, search

SCons is a make replacement that is goal oriented. That is, you define the sources and targets and scons will do the rest for you. There is no need to specifiy explicit dependancies( unless where needed ) and cleaning the build is built into the system.

Scons requires Python to be installed on your system. You can download scons from Quick download links for scons 0.97

* Windows -
* Unix -

Once you have scons installed you can run simply 'scons' to compile Allegro.

$ scons

To clean the build use '-c'. This option will work exactly in reverse to whatever target you specify

$ scons -c # clean everything
$ scons -c library # clean only the library, leave everything else
$ scons -c docs # clean only the docs

To see the various parameters that define how Allegro builds use 'scons -h'

$ scons -h

These options act much in the same way the options to the 'configure' script in unix did. You should also see a list of targets you could build.

target what it does
debug-static Build just the Allegro library in debug mode, statically linked
debug-shared Build just the Allegro library in debug mode, as a shared library
static Build just the Allegro library in optimized mode, statically linked
shared Build just the Allegro library in optimized mode, as a shared library
library Build just the Allegro library using whatever mode is set by shared=X and debug=X
examples Build the examples which will also build the Allegro library
docs Build the docs
demo Build the demo which will also build the Allegro library
install Build everything and install to whatever install=X is set to. /usr/local/lib by default on unix.

To build one of these targets give it as an argument on the command line

$ scons debug-static

There are also options to define what compile time options to use during the build.

option what it does default
static Statically links all targets 0
debug Use the -DDEBUG=1 compile time switch to enable debugging 0
color8 Enable 8-bit color 1
color16 Enable 16-bit color 1
color24 Enable 24-bit color 1
color32 Enable 32-bit color 1
install Installation directory /usr/local/lib
magic_main Use magic main 0
no_asm Disable asm 1
vbeaf Enable VBEAF 0
vga Enable VGA 0
config Configure Allegro. This is only for Unix and does the same job as the old 'configure' script. Some of the above options, such as color8, require this option to be given as config=1. 0

All options are cached so once you decide which options you want you can run 'scons' with no arguments to run that build again. For example if you want to build a statically linked version of Allegro and the examples run

$ scons static=1

All subsequent runs of scons will use static=1, until it is turned off.

$ scons # same as above
$ scons static=0 # back to normal

Run 'scons -h' to see what the options are currently set to. Note that targets are not cached

$ scons debug-shared # build the debug shared version of the library
$ scons # build regular version of library

But since static=X and debug=X are options you can use those instead

$ scons debug=1 static=0 # build the debug shared version
$ scons # build the debug shared version

But the second case will build everything, not just the library as in the first case.

To install, give the install target and optionally an install directory.

$ scons install # will install to the default location
$ scons install install=/tmp/foobar/baz # will install to /tmp/foobar/baz