Log in Page Discussion History Go to the site toolbox

Create a new development project

From WikIRI

back to main page of the robotics lab

Create a Repository

If you are creating a new project for the group you have to save your work in the repository. Follow the instructions to create a SVN repository. Once done, a new empty folder (except for the hidden .svn folder) with the given name should appear on the local computer.

Next, follow the steps on the next section to populate the folder with the default structure and files.

If not, ask for where to save your work.

Generate the project structure

The recommended procedure to create a project from the beginning is as follows:

0. Create a folder for the new project

mkdir <project name>
cd <project name>

1. Download the following file into the new project folder. This can be done in the console using

wget http://www.iri.upc.edu/people/shernand/template.tar.gz

2. Extract its contents into the new project folder:

tar -zxvf template.tar.gz 

3. Execute the new_project.sh script. This scripts has several parameters that must be provided:

  • -t <project type>: this parameter is required. It specifies which kind of project is to be created. At the moment, only two project types types are allowed:
    • application: generates the necessary structure to create a binary file.
    • driver: generates the necessary structure to create a shared library that can be used in other driver or applications.
  • -p <project name>: this parameter is required. It specifies the name or short description of the project. This parameter will appear in all the associated documentation. For multi-word values, use the double quote:
-p "this is a multi-word project description"
  • -n <driver or application name>: this parameter is required. It specifies the name of the shared library or the binary file to be generate by the project. This parameter must not have any whitespace characters.
./new_project.sh -t driver -p exemple -n exemple

4. The script should execute without any problem, providing as a result the new project folder fully configured.

5. Default source and header files are automatically created using the application or driver name so the new project can be compiled right away. Users may modify this files to accommodate their needs, but then the CMakeLists.txt files have to be changed accordingly.

Build the new project

This section describes the necessary steps to build the new project once it has been created.

1. Go to the trunk/build directory inside the new project.

cd trunk/build
  1. 2. If the working copy of the repository is in the branches folder because changes are being done, go to the branches/<name of the branch>/build folder instead:
cd branches/<name of the branch>/build

3. Execute the cmake command using the CMakeList.txt file in the project root path. This step will generate the Makefile script which will be used afterwards.

cmake ..

Important: at this point the cmake script will try to locate the required dependencies. If one or more of the dependencies are not found, the script reports it with an error, and crashes. It will be necessary to install by hand all the dependencies.

4. Build the project using the following command:

make

If all the dependencies are correct, the project should build successfully and the output files (shared library or binary file) created.

5. In case it is a driver, install it into the system so that it can be used by all applications and users.

sudo make install

Site Toolbox:

Personal tools
This page was last modified on 18 April 2012, at 10:45. - This page has been accessed 3,077 times. - Disclaimers - About WikIRI