Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
230 lines (162 sloc) 7.56 KB
Solarus is an open-source Zelda-like 2D game engine written in C++ and licensed
under GPL v3.
This file explains how to compile and install Solarus.
1 Overview
2 External dependencies
3 Compilation instructions
3.1 Default settings
3.2 Change the install directory
3.3 More about the datapath
3.4 Windows developers
3.5 Mac OS X developers
1 Overview
When it is installed, the project is divided in two parts:
- Solarus (the engine), which is an executable file written in C++ and called
- One (or several) quests, each quest corresponding to a game, represented as a
zip archive called data.solarus and containing all the data of the quest.
This readme is about compiling and installing solarus (the engine).
To execute it, you will also need a quest with all its game data files
(graphics, musics, sounds, scripts, dialogs, etc.). Our quests can be found on
the development blog:
2 External dependencies
The build process of solarus uses cmake.
To compile Solarus, you obviously need a C++ compiler.
The following libraries are required to compile and to execute Solarus:
Note that two other libraries are directly embedded in the source code:
SimpleIni, an ini file parsing library which consists in only two header files
(no source files), and snes_spc, an SPC music decoding library.
Linux developers:
Just install the corresponding packages. For example, with Ubuntu or Debian:
libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev liblua5.1-0-dev
libphysfs-dev libopenal-dev libvorbis-dev libmodplug-dev
Windows developers:
Download the binary version of each one of the development libraries listed
above, on their official websites.
Install the header files (the .h files) in your compiler's include directory.
This may be something like
C:\Program Files\Microsoft Visual Studio 9.0\VC\include.
Similarly, install the library files (the .lib files) in your compiler's lib
This may be something like C:\Program Files\Microsoft Visual Studio 9.0\VC\lib.
Install the dynamic library files (the .dll files) in your system32 directory
(which may be C:\WINDOWS\system32).
The directory libraries/win32 contains some required static and dynamic
libraries that are not provided as binaries by their authors, but I don't
guarantee they are up-to-date.
Mac OS X developers:
The directory libraries/macosx contains some required static and dynamic
libraries that are not provided as binaries by their authors, but I don't
guarantee they are up-to-date.
The lua readme recommends to link statically against lua, so you shouldn't
embed it.
Also, the OpenAL framework is already part of the OSX system since 10.4, so you
don't have to embed this one too.
You can use both .dylib or .framework for the other ones, but just remember
that you have to check the version number, runpath search, architecture and
backward compatibility if you want to deploy your application.
3 Compilation instructions
3.1 Default settings
To compile solarus with cmake, go to the solarus directory and type:
$ cmake -DCMAKE_BUILD_TYPE=Release .
This generates the appropriate Makefiles for your system.
The -DCMAKE_BUILD_TYPE=Release parameter optimizes the compilation and
disables debugging assertions. Games will run significantly faster.
Then you can compile the engine with:
$ make
and install it with (as root):
# make install
This installs the solarus binary in /usr/local/bin
(assuming that the install directory is /usr/local).
Then, to execute a quest, type
$ solarus path/to/your/quest
The argument must be a directory containing the "data" subdirectory of your
quest, or containing the "data.solarus" archive of your quest.
3.2 Change the install directory
You may want to install solarus in another directory
(e.g. so that no root access is necessary). You can specify this directory
as a parameter of cmake:
$ cmake -DCMAKE_INSTALL_PREFIX=/home/your_directory .
$ make
$ make install
This installs the solarus binary like above, with the /usr/local prefix
replaced by the one you specified.
3.3 More about the quest path
There are several ways to make the engine find the data of a quest.
If the command-line argument is set (see above), then the engine looks into
the directory specified (and expects a "data" subdirectory or a "data.solarus"
zip archive).
If the command-line argument is not specified, the preprocessor constant
The DEFAULT_QUEST constant can be configured from your cmake command by using:
$ cmake -DDEFAULT_QUEST=/path/to/your/quest .
Finally, if the DEFAULT_QUEST constant is not set either, then the engine looks
into the current directory.
This DEFAULT_QUEST constant may be used if you want the engine to launch a
default quest when it is called without command-line arguments.
You can still launch another quest by using the command-line argument,
which overwrites the DEFAULT_QUEST constant.
3.4 Windows developers
I have managed to compile Solarus with Code::Blocks, without using CMake.
It is necessary to additionally link with libz.
3.5 Mac OS X developers
* Compile on OSX
The Apple port of solarus currently doesn't use XCode, so you can compile
solarus just by doing the default setting with cmake.
If you got some error on the cmake part, you can edit the CMakeCache.txt to
manually write the include and library directories that cmake did not find.
You can compile for YOUR Mac with the default command, but you probably wish
to distribute the application on other systems. To do so, use this command
to prepare the deployment (change 10.5 by the min version)
$ export MACOSX_DEPLOYMENT_TARGET=10.5 && cmake -DCMAKE_BUILD_TYPE=Release .
* Deploy on OSX
To deploy a bundle, you need to add a few things to your project.
The final application is a .app suffixed folder, which typcially contains
the executable and all resources it needs. We usually make it once, so you
should use the one from the official application available on the solarus
website, but you perfectly can make your own one.
All non-Mac-native frameworks are placed in
and the main binary and its quest in
First, you have to check if dependencies search path are correctly integrated,
just by doing
$ otool -L /dylib/or/binary/I/want/to/check
This command is to use on all dylib, framework binary and the main binary.
(if you use the "official" bundle, just do it on main binary).
It show the search path for every dependencies. Just look on the one you embed.
If one of them has a wrong path, you can modify it with
$ install_name_tool -id new_path /dylib/or/binary/I/want/to/modify
$ install_name_tool -change old_path new_path /dylib/or/binary/I/want/to/modify
The new_path string usually looks like @rpath/The_dylib.dylib or
@rpath/The_framework.framework/Version/A/The_binary on Mac 10.5+.
Replace @rpath/ by @executable_path/../Frameworks/ on earlier OSX versions.
The last thing you have to do to deploy Solarus is to compile it for every
processor architecture.
But if you set the MACOSX_DEPLOYMENT_TARGET environment variable and have the
10.5 SDK installed on your system, you already have a "universal" application
(Intel 32+64bit, and PPC 32bit).
Check what is your binary compatibility with
$ file /dylib/or/binary/I/want/to/check
Something went wrong with that request. Please try again.