Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Fetching and compiling

BeholdMyGlory edited this page Apr 14, 2014 · 1 revision

Downloading the source code

Install Mercurial

In order to download the fiend source code, you will need the Mercurial application installed. It most likely exists in the repositories of your favourite Linux distribution, but otherwise it can be downloaded and installed from http://mercurial.selenic.com.

Fetching the code

Download the source code by running the following from a terminal:

hg clone http://bitbucket.org/beholdmyglory/fiend

This will create the a "fiend" directory with various directories such as src, release as well as several CMake related files.

Building fiend

Fetching dependencies

Before compiling, you will need to install two dependencies of fiend: Allegro and FMOD Ex. Some Linux distributions may have Allegro, or both Allegro and FMOD Ex, in their official repositories. (Arch Linux includes the packages in the official repositories under the name allegro and fmodex.)

Running CMake

In order to actually build fiend, you need to run CMake which will generate the actual build files. CMake can be downloaded from http://www.cmake.org/cmake/resources/software.html if it's not already in your repositories (which it should be).

After CMake is properly installed, you need to actually run it. In its simplest form, the CMake command is simply

cmake PATH_TO_FIEND_ROOT

where PATH_TO_FIEND_ROOT is the path to the root directory of fiend (the directory containing the topmost CMakeLists.txt). Which directory CMake is run from will depend on the situation, though most often you will want to create a build directory from which you run CMake in order to avoid littering the source directory with build files.

Now, if you've installed Allegro and/or FMOD Ex manually, chances are high that CMake cannot find these libraries. If so, you will need to point CMake to where they are installed by setting the variables CMAKE_INCLUDE_PATH, CMAKE_LIBRARY_PATH and/or CMAKE_PREFIX_PATH. Example:

cmake -DCMAKE_PREFIX_PATH="/path/to/allegro;/path/to/fmodex/api" -DCMAKE_INCLUDE_PATH="/path/to/fmodex/api/inc" PATH_TO_FIEND_ROOT

Here it is assumed that in the directory /path/to/allegro you will have the directories lib and include, as CMake will search in both CMAKE_PREFIX_PATH/lib and CMAKE_PREFIX_PATH/include. It is also assumed that you in the directory /path/to/fmodex have the directory lib. However, as FMOD Ex' include directory per default is named inc, and not include, you must manually specify the path to the include directory using CMAKE_INCLUDE_PATH.

Compiling

Linux - using GNU Make and GCC (recommended; easier)

On Linux CMake will default to generating GNU Makefiles. However, you will probably want to create these files in a separate build directory in order to avoid littering:

cd fiend
mkdir build
cd build
cmake ..
make

And the binaries fiend and mapeditor will be created in the fiend/release directory. Make sure that the current working directory is fiend/release when you run the binaries, as they will otherwise be unable to find the resources needed such as maps and images.

CMake will automatically create two Make targets: fiend and mapeditor. So if you wish to only build one of the two binaries, run either make fiend or make mapeditor instead of simply make.

Linux - using Eclipse CDT (for development)

You will need to tell CMake to use the Eclipse CDT generator. You will probably want to run CMake from the fiend root directory, since it will be easier if the source files and the project files are located at the same place. Also, if you wish to be able to use the built-in visual debugger, tell CMake to generate the project with debugging enabled:

cd fiend
cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .

Make sure you have set up Eclipse properly with CDT and a compiler, and then import the newly generated project by choosing File > Import.... Choose General > Existing Projects into Workspace and then click next. As root directory, choose navigate to the directory containing the fiend root directory. Then check the "fiend" check box and click Finish. The project should build automatically.

In order to run the binaries correctly you will have to set the correct working directory. Right click on the fiend project and select Properties. Under Run/Debug Settings click New... to create a new launch configuration. (Unless you've already tried running one of the binaries, in that case a configuration should have automatically been created; simply select it and click Edit... instead.) Under Main > C/C++ Application, click Search Project... and select the binary you want to create a configuration for. Under Arguments > Working directory, uncheck the Use default check box, and select fiend/release as the working directory, either by navigating the workspace or the file system.