Quick project creation

Create a new Project

You use GATB-CORE by creating a new tool project, with the following script:

./[path-to-gatb-core]/scripts/NewProject/ -d directory -n toolName

where 'directory' is the directory where the project will be created and 'toolName' is the name of the project. The script will automatically creates the full path directory/toolName to deploy a self-contained tool.

The directory where the project is created has no link to any external resources. You can therefore move it anywhere you want.

Such a project can be a start point for building applications based on GATB-CORE.

Project organisation

By default, the following part will be included in the project:

  • a CMakeLists.txt file used for building the project
  • a 'scripts' directory holding a script to automatically package the tool
  • a 'tools' directory holding a default source code using GATB-Core
  • a 'thirdparty' directory holding the gatb-core resources
  • a 'doc' directory

The 'thirdparty' directory is only available for tool created outside the GATB-Tools repository. Tools located within GATB-Tools rely on a common GATB-Core sub-module already available in this repository.

It is advised to use:

  • 'scripts' directory to hold any scripts this tool relies on
  • 'doc' directory to hold tool's documentation
  • 'thirdparty' directory to hold any third-party librairies this tool relies on

Project source code

It is worth noting that 'tools' directory is organised using sub-folders; by default, there is at least one such sub-folder called 'toolName'. It holds the source code of the tool.

However, when considering a more complex software, it could be nice to setup several "sub-tools", each of them making a particular feature. In that case, you can easily create several "sub-tool" folders inside "tools", each of them having a "src" folder containing the source code, as well as a "main.cpp", for each feature.

Using this organisation has a big advantage: the provided CMakeLists.txt is aware of that, so you do not have to edit the CMake file when you add a new "sub-tool". As a real example, you can have a look at the DiscoSNP software.

Project building

To build your project, you should do the following

cd [path-to-tool-home]
mkdir build;  cd build;  cmake ..;  make -j8

Then, you should get a binary holding the name of the project within 'build/tools'.

The first compilation should take some time since the GATB-CORE library is generated.

Note that all the needed material is included in the generated project (in particular the gatb::core library and the header files), so you can move it wherever you want. Note also that you won't have to do any tricky configuration to build the binary; you just have to do cmake+make and you will have your binaries in the build/tools directory.

Project version

You can set a version number to your project by editing the beginning of CMakeLists.txt file located in the tool main directory or by running cmake like this:

cmake -DMAJOR=1 -DMINOR=1 -DPATCH=0 ..

Project packaging

You can prepare your tool for distribution using:

./[path-to-tool-home]/scripts/ -M X -m Y -p Z

With X, Y and Z being major, minor and patch release numbers, respectively.

Then, you should get two 'tar.gz' files within 'build', one containing the binary release and the other the source codes.

Note: the script re-built the entire tool from its sources to ensure a clean build process.

Use Eclipse c++ IDE to work on a GATB-TOOL

If you are interested in using an IDE to develop c++ source codes relying on the GATB-Core library, we have written this manual to explain how to setup Eclipse c++ framework: