Menu

CompilingPlugin

Tomassino Ferrauto Gianluca Stefano Nolfi
Prev: Running the Exemplificative Experiments Up: Running the Exemplificative Experiments Next: Configuring an Experiment

Table of contents

Introduction

In the following section we provide the instructions for compiling a FARSA plugin under the Windows, Linux, or MAC OS operating systems. We will use one of the exemplificative experiments that come with the FARSA distribution, but the same procedure applies to all plugins. We assume that you already installed FARSA either through a binary release or compiling the sources code. If not, follow the instructions in this page.

In this guide we will use SOURCE_DIR to indicate the directory with the source files of the plugin and BUILD_DIR to indicate the directory where the plugin is compiled (which can be wherever you like). While the two may be coincident, it is advisable to keep them separatate: this way it is easy to start from scratch by removing all files from the BUILD_DIR. We will show how to compile an exemplificative experiment from the FARSA release, but the same instructions can be applied to any other plugin.

Windows

If you already installed and compiled the Source release of FARSA you can skip directly to Step 2.

Step 1: Install all necessary programs and libraries

  • Install Visual Studio 2010 for C++.
  • Install CMake, a tool that allows to generate the Visual Studio project file, by downloading and running the installer.

Step 2: Download the source code and generate the project for the compiler

  • Download and extract the source release of the exemplificative experiments farsa-example-x.y.z .zip or .tar.gz file (sourceforge.net). We will compile the BraintenbergExperiment plugin, so the SOURCE_DIR will be directory BraintenbergExperiment inside the directory where the package with exemplificative experiments has been extracted.
  • Generate the Visual Studio solution/projects for the exerimental plugin that you want to compile by using CMake. You only need to specify the source directory (SOURCE_DIR), the build directory (BUILD_DIR) and the generator (you should select the one matching the version of Visual Studio you have installed). All the other parameters can be left to their default values (you can set BUILD_TESTING to OFF in case you get warnings during the configuration phase).
  • Run the Visual Studio application.
  • Open the solution file called "BraitenbergExperiment.sln" contained in the BUILD_DIR directory. This file has been generated by CMake.
  • Run the "build all" or "build solution" target.
  • Verify that the compiler has correctly produced a "BraitenbergExperiment.farsaPlugin.dll" file in the BUILD_DIR\Release or BUILD_DIR\Debug, depending on how you compiled the plugin

You are now ready to run the corresponding experiment from the total99 application by loading the configuration file contained in the SOURCE_DIR\conf directory, by setting the right plugin directory in which the .dll file is located.

Step 3 (optional): Install the plugin

In addition to the steps above, you can also install the plugin. This has the advantage that you only need to specify its name in configuration files and not its full path. If the plugin also provides some example configurations, those will be installed as well and they will be listed in the main page of total99. Installing the plugin is compulsory in case other plugins depend on it (as is the case of the iCub plugin). To install the plugin simply build the "INSTALL" target in Visual Studio.

Linux

You will need the development package of FARSA to compile your plugins. If you installed farsa from binaries, you can simply install the FARSA-devel or farsa-dev package (refer to the Linux Binary Installation page for more information). If you installed and compiled the source release of FARSA you can already have all that is needed.

Step 1: Download the source code and generate the project for the compiler

  • Download and extract the source release of the exemplificative experiments farsa-example-x.y.z .zip or .tar.gz file (sourceforge.net). We will compile the BraintenbergExperiment plugin, so the SOURCE_DIR will be directory BraintenbergExperiment inside the directory where the package with exemplificative experiments has been extracted.
  • Generate the makefiles for the exerimental plugin that you want to compile by using CMake. All the parameters can be left to their default values. If needed, you can change the CMAKE_BUILD_TYPE parameter to "Debug" or "Release" for a debug and release build, respectively. You can also set BUILD_TESTING to OFF in case you get warnings during the configuration phase.
  • Compile and install the plugin with the following commands:

    cd BUILD_DIR
    make
    

    If you setted CMake to generate project file for your IDE, then you do not have to run the make command above, but instead open the generated project file with your IDE and start the compilation and installation of the Plugin

  • Verify that the compiler has correctly produced a "BraitenbergExperiment.farsaPlugin.so" file in the build directory

You are now ready to run the corresponding experiment from the total99 application by loading the configuration file contained in the SOURCE_DIR/conf directory, by setting the right plugin directory in which the .so file is located.

Step 3 (optional): Install the plugin

In addition to the steps above, you can also install the plugin. This has the advantage that you only need to specify its name in configuration files and not its full path. If the plugin also provides some example configurations, those will be installed as well and they will be listed in the main page of total99. Installing the plugin is compulsory in case other plugins depend on it (as is the case of the iCub plugin). To install the plugin simply run the command "make install" from inside the build directory.

MAC OS

Step 1: Download the source code and generate the project for the compiler

  • Download and extract the source release of the exemplificative experiments farsa-example-x.y.z .zip or .tar.gz file (sourceforge.net). We will compile the BraintenbergExperiment plugin, so the SOURCE_DIR will be directory BraintenbergExperiment inside the directory where the package with exemplificative experiments has been extracted.
  • Generate the makefiles for the exerimental plugin that you want to compile by using CMake. Use the settings below:

    Source directory = *SOURCE\_DIR*
    Build directory = *BUILD\_DIR*
    BUILD_TESTING = OFF
    CMAKE_BUILD_TYPE = Release # or Debug if you want a debug build
    CMAKE_EXE_LINKER_FLAGS = -L/opt/local/lib
    CMAKE_SHARED_LINKER_FLAGS = -L/opt/local/lib
    

    The last two options are visible only if the advanced mode of CMake is active.

  • Compile and install the plugin with the following commands:

    cd BUILD_DIR
    make
    

    If you setted CMake to generate project file for XCode, then you do not have to run the make command above, but instead open the generated project file with XCode and start the compilation and installation of FARSA

  • Verify that the compiler has correctly produced a "BraitenbergExperiment.farsaPlugin.so" file in the build directory

You are now ready to run the corresponding experiment from the total99 application by loading the configuration file contained in the SOURCE_DIR/conf directory, by setting the right plugin directory in which the .so file is located.

Step 3 (optional): Install the plugin

In addition to the steps above, you can also install the plugin. This has the advantage that you only need to specify its name in configuration files and not its full path. If the plugin also provides some example configurations, those will be installed as well and they will be listed in the main page of total99. Installing the plugin is compulsory in case other plugins depend on it (as is the case of the iCub plugin). To install the plugin simply run the command "make install" from inside the build directory.


Related

Manual: Configuring an Experiment
Manual: Home
Manual: Installation
Manual: RunningExperiments

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB