Menu

Compiling

Giovanni Squillero Jany Belluz

Compiling and Installing

ugp3 (ugp3.exe under win32) is the default front-end for µGP. It is a console application controlled by a set of configuration files in XML and a few command line options.

The build process is managed with CMake (a utility that can create makefiles or project files for different IDEs, such as Code::Blocks or Microsoft VisualStudio). Go to http://www.cmake.org/ to find the latest version of the tool and all the documentation.

Notable CMake options (platform independent)

CMAKE_INSTALL_PREFIX: Where to install all executables. The default is usually correct, but some people prefers to keep them locally.

CMAKE_BUILD_TYPE:

  • RELEASE (default) to get an optimized version of µGP
  • XWIN32 if you need to prepare Windows executables from GNU/Linux
  • DEBUG if you plan to hack the code
  • RelWithDebInfo if you want to debug with GDB a segmentation fault that happens after a very long time and you can't afford to wait through the lengthy internal coherency checks of the DEBUG build.

Instructions for GNU/Linux, BSD, and other un*x systems

You need to install the latest version of CMake. Since the tool is included in most Linux distros, you probably only have to use your favorite package manager.

Go to the directory where you extracted ugp3 tarball. From there, simply give the command:

$ cmake .

You may tweak several parameters and options (check CMake documentation). For instance:

# Install all the executables in your local bin directory under ~/bin
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME .

# Build the toolkit with all the debugging symbols and internal coherency checks
$ cmake -DCMAKE_BUILD_TYPE=DEBUG .

# Build the "normal" optimized version of toolkit
$ cmake -DCMAKE_BUILD_TYPE=RELEASE .

# Deactivate LuaJIT in favor of vanilla Lua
$ cmake -DUGP3_USE_LUAJIT=OFF .

# Deactivate Lua altogether
$ cmake -DUGP3_USE_LUA=OFF -DUGP3_USE_LUAJIT=OFF .

CMake will produce some output while configuring your system. If everything goes as expected, you will only have to execute:

$ make

The executable file produced will be in µGP directory>/Frontends/ugp3/

You can then install µGP on your system (copying the executable in your /bin directory) by going to µGP directory and typing the command:

$ sudo make install

Instructions for Windows

Note: If you manage to compile µGP under different IDEs or with different compilers, let us know and contribute to this Wiki!

Creating a Code::Blocks project with CMake

Code::Blocks is a free IDE, that can be downloaded from here. It is strongly recommended to download the version including the compiler MinGW. CMake can be used to generate a Code::Blocks project.

Open CMake, and select the directory where you extracted the µGP zip file. Then, choose a directory where the binary output files will be copied. In the example below, I’ve chosen the same one.

Then, click on "Configure", accepting to eventually create a new directory. From the new window, choose "CodeBlocks - MinGW Makefiles" and "Use default native compilers", then click on "Finish".

We will probably have to manually specify some parameters. In this example, CMake was not able to find the executable for Code::Blocks.

So, I had to specify the path manually and click "Configure" again. When you have no more red lines, you can proceed to "Generate".

Once the configuration is done, click on Generate. You will obtain a ugp3.cbp (Code::Blocks project file) in the specified directory. Open the .cbp file with Code::Blocks and click on "Build". You will see something like this (it may take a while to complete).

At the end of the compiling process, you will find your executable in the /Frontends/ugp3 sub-directory of your ugp3 folder.

The companion executable ugp3-extractor.exe, is found in the sub-directory /Contrib/ugp3-extractor of the main ugp3 folder.

Bare MinGW

If you have CMake and MinGW installed (and you think that graphical interfaces are for wimps), open the console and follow the instructions for Linux. Different compilers should also work, let us know if you try.

Instructions for MacOS

Open a shell (terminal) and follow the instructions for Compiling µGP under Linux. As usual, you will need a C++ compiler and CMake.

Alternatively, you may ask CMake to generate a Xcode project and then use the Apple's IDE:

$ cmake -G Xcode .

Related

Wiki: Home