Commit 4ff3dcc3 authored by Rayan Chikhi's avatar Rayan Chikhi
Browse files
parents 814f1db3 56fb07c4
--------------------------------------------------------------------------------
# Introduction
# What is GATB ?
The GATB-CORE project provides a library providing services for genome assembly.
GATB means "Genome Analysis Toolbox with de-Bruijn graph".
All the needed material is contained in the current directory in order to
The GATB-CORE project provides a set of highly efficient algorithms to analyse NGS data sets. These
methods enable the analysis of data sets of any size on multi-core desktop computers, including very
huge amount of reads data coming from any kind of organisms such as bacteria, plants, animals and
even complex samples (e.g. metagenomes). More: https://project.inria.fr/gatb/.
Read more about GATB at <a href="https://project.inria.fr/gatb/">https://project.inria.fr/gatb</a>.
You can download GATB softwares at <a href="https://project.inria.fr/gatb/software/">https://project.inria.fr/gatb/software</a>.
--------------------------------------------------------------------------------
# What is GATB-CORE ?
GATB-CORE is a high-performance and low memory footprint C++ library.
Among others, it supports the following operations natively:
* FASTA/FASTQ parsing
* K-mer counting
* Minimizer computation of k-mers, partitioning of datasets by minimizers
* de Bruijn graph construction
* de Bruijn graph traversal operations (contigs, unitigs)
By itself GATB-CORE is not an NGS data analysis tool. However, it can be
used to create such tools; see below section called 'How to quickly create a project based on gatb-core ?'.
They already exist a set of ready-to-use tools relying on GATB-CORE library: see https://project.inria.fr/gatb/software/
All the needed material of GATB-CORE is contained in the current directory in order to
generate the wanted artifacts:
* dynamic and static libraries holding the services component
......@@ -12,7 +38,7 @@ generate the wanted artifacts:
* wrappers for the components in other languages like java, python, ... (to be done)
Since the compilation is based on CMake, a common way to build all the artifacts is :
Since the compilation is based on CMake (release 2.6+), a common way to build all the artifacts is:
mkdir build ; cd build ; cmake .. ; make
......@@ -80,22 +106,31 @@ For one atomic package (or sub package), we should have:
* directory 'impl' several implementations of the API
--------------------------------------------------------------------------------
# How to quickly create a project based on gatb-core ?
# How to quickly create a project based on GATB-CORE ?
You use GATB-CORE by creating a new tool project, with the following script:
If you want to test gatb-core by creating a new project, you can use the following script:
sh scripts/NewProject/NewProject.sh arg1 arg2
where arg1 is the name of the project and arg2 is the directory where the project will be created.
sh scripts/NewProject/NewProject.sh -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.
By default, the following part will be included in the project:
* a README file explaining how to compile the project
* a 'src' directory holding a default main function
* a 'thirdparty' holding all the material for building GATB-CORE
* a CMakeLists.txt file used for building the project
* a 'tools' directory holding a default source code using GATB-Core
* a 'scripts' directory holding a script to automatically package the tool
* an optional 'thirdparty' directory holding the gatb-core resources
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.
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 for building applications based on GATB-CORE.
More on creating a new GATB-Core based project: http://gatb-core.gforge.inria.fr/doc/api/new_project.html
----------------------------------------------------------------------------------
# Notes for GATB-core developers
......@@ -116,7 +151,6 @@ To run unit tests:
show up in the verbose output, e.g. 'bin/gatb-core-cppunit TestBank'.
To upload the documentation to the http://gatb-core.gforge.inria.fr/ website, type:
To upload the documentation to the http://gatb-core.gforge.inria.fr/doc/api website, type:
mkdir build && cd build && cmake .. && make doc
scp doc/html/index.html edrezen@scm.gforge.inria.fr:/home/groups/gatb-core/htdocs/
mkdir build ; cd build ; cmake .. ; make doc ; make deploy-doc
......@@ -13,8 +13,8 @@ if (DOXYGEN_FOUND)
ADD_CUSTOM_TARGET (deploy-doc
COMMAND tar -zcf ${CMAKE_BINARY_DIR}/doc/doc.tgz -C ${CMAKE_BINARY_DIR}/doc/html .
COMMAND scp ${CMAKE_BINARY_DIR}/doc/doc.tgz $ENV{USER}@scm.gforge.inria.fr:/home/groups/gatb-core/
COMMAND ssh $ENV{USER}@scm.gforge.inria.fr "rm -rf /home/groups/gatb-core/htdocs/*"
COMMAND ssh $ENV{USER}@scm.gforge.inria.fr "tar -xf /home/groups/gatb-core/doc.tgz --no-overwrite-dir -C /home/groups/gatb-core/htdocs"
COMMAND ssh $ENV{USER}@scm.gforge.inria.fr "rm -rf /home/groups/gatb-core/htdocs/doc/api/*"
COMMAND ssh $ENV{USER}@scm.gforge.inria.fr "tar -xf /home/groups/gatb-core/doc.tgz --no-overwrite-dir -C /home/groups/gatb-core/htdocs/doc/api"
)
INSTALL (CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} doc)")
......
......@@ -22,20 +22,26 @@
****************************************************************************************************
* \section intro What is GATB ?
*
* GATB means "Genome Analysis Toolbox with de-Bruijn graph".
* GATB means "Genome Analysis Toolbox with de-Bruijn graph".
*
* The GATB-CORE project provides a set of highly efficient algorithms to analyse NGS data sets. These
* methods enable the analysis of data sets of any size on multi-core desktop computers, including very
* huge amount of reads data coming from any kind of organisms such as bacteria, plants, animals and
* even complex samples (e.g. metagenomes). More: https://project.inria.fr/gatb/.
*
* It can be seen as software components providing services for assembling and analyzing genomes of various kinds.
* GATB is made two main parts:
*
* Read more about GATB at <a href="https://project.inria.fr/gatb/">https://project.inria.fr/gatb</a>.
*
* You can download GATB softwares at <a href="https://project.inria.fr/gatb/software/">https://project.inria.fr/gatb/software</a>.
* - the GATB-CORE library: for development purpose, GATB-CORE enables the creation of new software tools
* - the GATB-Tools: contains ready-to-use softwares relying on GATB-CORE. More <a href="https://project.inria.fr/gatb/software/">here</a>.
*
* The GATB project has been published in <a href="http://bioinformatics.oxfordjournals.org/content/30/20/2959">BioInformatics in 2014</a>.
* There are also several publications about GATB use cases and tools available <a href="https://project.inria.fr/gatb/publications/">here</a>.
*
****************************************************************************************************
****************************************************************************************************
* \section purpose Purpose of the GATB core library
*
*
* First, gatb::core holds a C++ library that provides an easy way to create bioinformatics programs.
* gatb::core is a high-performance and low memory footprint C++ library.
*
* It supports the following operations natively:
* - FASTA/FASTQ parsing
......@@ -44,22 +50,14 @@
* - de Bruijn graph construction
* - de Bruijn graph traversal operations (contigs, unitigs)
*
* One structure is central to the GATB project: the <a href="http://en.wikipedia.org/wiki/De_Bruijn_graph">De Bruijn graph</a>.
* This sort of data structure is today widely used in NGS software (like assembly software).
*
* First, gatb::core holds a C++ library that provides an easy way to handle a central structure in the
* GATB project: the <a href="http://en.wikipedia.org/wiki/De_Bruijn_graph">De Bruijn graph</a>.
* This kind of data structure is today widely used in
* <a href="http://en.wikibooks.org/wiki/Next_Generation_Sequencing_(NGS)">NGS</a>
* software (like assembly software).
* One structure is central to the GATB project: the <a href="http://en.wikipedia.org/wiki/De_Bruijn_graph">De Bruijn graph</a>.
* This sort of data structure is today widely used in NGS software (like assembly softwares).
*
* More precisely, the library provides means to build and use De Bruijn graphs with a low memory footprint,
* which comes initially from the <a href="http://minia.genouest.org">minia</a> assembly tool.
* So, one can say that GATB-CORE library provides means to build and use De Bruijn graphs with a low memory footprint,
* which comes initially from the <a href="https://project.inria.fr/gatb/software/minia/">minia</a> assembly tool.
*
* The documentation you are reading is the official documentation of the gatb::core reference API. The
* audience is therefore developers interested in creating bio-informatics software.
*
* The GATB project has been published in <a href="http://bioinformatics.oxfordjournals.org/content/early/2014/06/30/bioinformatics.btu406.abstract?keytype=ref&ijkey=koXTzqbf4Nt1kVO">BioInformatics in 2014</a>.
* audience is therefore developers interested in creating bioinformatics softwares.
*
****************************************************************************************************
****************************************************************************************************
......@@ -77,7 +75,7 @@
*
****************************************************************************************************
****************************************************************************************************
* \section howto How can I use the GATB core library ?
* \section howto How can I make a new software using GATB core library ?
*
* As a starting point, it is strongly recommended to have a look at \ref snippets_page. You will find
* there information about the compilation process and how to create a new project based on gatb::core.
......@@ -91,8 +89,8 @@
*
* You can get support on the BioStars forum <a href="http://www.biostars.org/p/101393">here</a>.
*
* You can also have general information about the <a href="http://gatb.inria.fr">GATB project</a>. You will
* find <a href="http://gatb.inria.fr/tutorials">here</a> high level tutorials about GATB.
* You can also have general information about the <a href="https://project.inria.fr/gatb/">GATB project</a>. You will
* find <a href="https://project.inria.fr/gatb/tutorials">here</a> high level tutorials about GATB.
*
****************************************************************************************************
****************************************************************************************************
......
......@@ -90,54 +90,91 @@
* \page new_project Quick project creation
************************************************************************************
*
* It is possible to create a new project based on gatb::core with a script provided in
* the distribution (see directory 'scripts').
* \section project_create Project creation
*
* You have to provide a name for the project and the location of the generated directory holding
* all the needed material. For instance:
* You use GATB-CORE by creating a new tool project, with the following script:
*
* \code
* sh scripts/NewProject/NewProject.sh MyProject /tmp
* ./[path-to-gatb-core]/scripts/NewProject/NewProject.sh -d directory -n toolName
* \endcode
*
* Then you can go in the generated directory and browse its content:
* \code
* cd /tmp/MyProject; ls -l
* \endcode
*
* By default, the generated project is designed to produce two binaries called
* MyProject_1 and MyProject_2. For instance, the associated sources for the MyProject_1
* tool are located in the directory tools/MyProject_1/src. The sources may be used as
* a skeleton to build an application based on gatb::core.
*
* Note that you can keep only one tool, for instance MyProject_1 and rename it as you
* want. You can also add as many tools as you want in the 'tools' directory.
*
* You can set a version number to your project by editing the CMakeLists.txt file located
* in the archive main directory. This is done by changing the default "1.0.0" value of
* the CPACK_PACKAGE_VERSION variable.
*
* For compiling the project, you have to follow the same process than compiling the
* distribution (note that you can set a version number with the variable CPACK_PACKAGE_VERSION):
* \code
* cd /tmp/MyProject; mkdir build ; cd build ; cmake -DCPACK_PACKAGE_VERSION="3.14.92" .. ; make
* \endcode
*
*
* 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.
*
* \section project_organisation 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
*
* \section project_source 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.
*
* \section project_compilation 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.
*
* \section project_version 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:
* \code
* cmake -DMAJOR=1 -DMINOR=1 -DPATCH=0 ..
* \endcode
*
* \section project_packaging Project packaging
*
* You can prepare your tool for distribution using:
* \code
* ./[path-to-tool-home]/scripts/package_tool.sh -M X -m Y -p Z
* \endcode
*
* Finally, you have two targets to archive the project:
* - make package => package of the binaries
* - make package_source => package of the sources
*
* The source archive holds all the material needed for compilation.
*
* Note that the version number (set with CPACK_PACKAGE_VERSION) will be used for naming the archive files.
* With X, Y and Z being major, minor and patch release numbers, respectively.
*
* If you finally want to put the archive files on the GATB server, you can use "make delivery". Note
* that it is possible only if you have a GForge INRIA account and have been defined as a
* GATB contributor.
* 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.
*
************************************************************************************
************************************************************************************
......
......@@ -3,13 +3,28 @@ project(XXX)
cmake_minimum_required(VERSION 2.6)
################################################################################
# Shortcuts
# The version number.
################################################################################
SET (GATB_CORE_HOME ${PROJECT_SOURCE_DIR}/thirdparty/gatb-core)
SET (gatb-tool_VERSION_MAJOR 1)
SET (gatb-tool_VERSION_MINOR 0)
SET (gatb-tool_VERSION_PATCH 0)
IF (DEFINED MAJOR)
SET (gatb-tool_VERSION_MAJOR ${MAJOR})
ENDIF()
IF (DEFINED MINOR)
SET (gatb-tool_VERSION_MINOR ${MINOR})
ENDIF()
IF (DEFINED PATCH)
SET (gatb-tool_VERSION_PATCH ${PATCH})
ENDIF()
set (gatb-tool-version ${gatb-tool_VERSION_MAJOR}.${gatb-tool_VERSION_MINOR}.${gatb-tool_VERSION_PATCH})
################################################################################
# Define cmake modules directory
################################################################################
SET (GATB_CORE_HOME ${PROJECT_SOURCE_DIR}GGGGG)
SET (CMAKE_MODULE_PATH ${GATB_CORE_HOME}/cmake)
################################################################################
......@@ -38,30 +53,31 @@ include (GatbCore)
ADD_SUBDIRECTORY(tools)
################################################################################
# DELIVERY
# Packaging
################################################################################
# If your current login name is different from your GForge login name, you have
# to overwrite the CPACK_USER_NAME to be the same as your GForge login
#SET (CPACK_USER_NAME "your_gforge_login")
# We set the version number
#SET (CPACK_PACKAGE_VERSION "1.0.0")
# We have to tell what is the server name
SET (CPACK_GFORGE_PROJECT_NAME "gatb-tools")
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "gatb-tool ${PROJECT_NAME}")
SET (CPACK_PACKAGE_VENDOR "Genscale team (INRIA)")
SET (CPACK_PACKAGE_VERSION_MAJOR "${gatb-tool_VERSION_MAJOR}")
SET (CPACK_PACKAGE_VERSION_MINOR "${gatb-tool_VERSION_MINOR}")
SET (CPACK_PACKAGE_VERSION_PATCH "${gatb-tool_VERSION_PATCH}")
SET (CPACK_PACKAGE_VERSION "${gatb-tool-version}")
# We set the kind of archive
SET (CPACK_GENERATOR "TGZ")
SET (CPACK_SOURCE_GENERATOR "TGZ")
# We ignore unwated files for the source archive
# Packaging the source ; we ignore unwanted files
SET (CPACK_SOURCE_IGNORE_FILES
"^${PROJECT_SOURCE_DIR}/build/"
"^${GATB_CORE_HOME}/.project"
"^${GATB_CORE_HOME}/.gitignore"
"^${GATB_CORE_HOME}/doc/design"
"^${GATB_CORE_HOME}/doc"
"^${GATB_CORE_HOME}/DELIVERY.md"
)
include (Delivery)
# Packaging the binary ; we want to include some additional files
INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENCE DESTINATION .)
INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/THIRDPARTIES.md DESTINATION .)
include (CPack)
#!/bin/bash
echo ""
echo "--------------------------------------------------------------------------------"
echo " CREATE PROJECT '"$1"' in directory '"$2"'"
echo "--------------------------------------------------------------------------------"
echo ""
# We get the directory of the script (absolute path)
#*****************************************************************************************
# GATB-CORE: new tool script.
#
# This script is used to create a new software relying on GATB-CORE library.
#
# Usage: run script with -h as argument.
#
# Author: Patrick Durand, Inria
# Created: February 2016
#*****************************************************************************************
# This script directory (absolute path)
_scripts_dir=$( cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P )
# We define the new project directory
_project_dir="$2/$1"
# We set the GATB-CORE directory
_gatb_core_dir="$_scripts_dir/../.."
# We check that we found the GATB-CORE submodule directory
[ ! -d "$_gatb_core_dir" ] && { echo "Error: Directory for GATB-CORE submodule not found"; exit 2; }
# We check that the new project doesn't already exist
[ -d "$_project_dir" ] && { echo "Error: Directory '$_project_dir' for new project already exists"; exit 2; }
# We create the project directory
mkdir $_project_dir
# We create the tools directory and two sub directory for two different tools
mkdir $_project_dir/tools
mkdir $_project_dir/tools/$1_1
mkdir $_project_dir/tools/$1_2
# We create the source directory for two tools
mkdir $_project_dir/tools/$1_1/src
mkdir $_project_dir/tools/$1_2/src
# We create the script directory and copy the delivery script
mkdir $_project_dir/scripts
cp $_gatb_core_dir/scripts/delivery.sh $_project_dir/scripts/
# If no $3 argument is provided, we copy GATB-CORE as thirdparty.
# => in GATB-TOOLS context, we can provide a $3 argument and so
# we don't have a copy of GATB-CORE
if test -z "$3"
then
# We copy gatb-core as thirdparty
mkdir $_project_dir/thirdparty
mkdir $_project_dir/thirdparty/gatb-core
cp -r $_gatb_core_dir/cmake $_project_dir/thirdparty/gatb-core/
cp -r $_gatb_core_dir/src $_project_dir/thirdparty/gatb-core/
cp -r $_gatb_core_dir/tools $_project_dir/thirdparty/gatb-core/
cp -r $_gatb_core_dir/thirdparty $_project_dir/thirdparty/gatb-core/
cp -r $_gatb_core_dir/examples $_project_dir/thirdparty/gatb-core/
cp -r $_gatb_core_dir/doc $_project_dir/thirdparty/gatb-core/
cp -r $_gatb_core_dir/CMakeLists.txt $_project_dir/thirdparty/gatb-core/
# Some global variables
INCLUDE_GATB_COPY="false"
INSTALL_DIRECTORY=""
TOOL_NAME=""
GATB_CORE_PATH="${_scripts_dir}/../.."
NB_TOOLS=1
PROJECT_DIR=""
GATB_CMAKE_PATH=""
ERR=0
# Some error messages and corresponding exit codes
ERR_MSG_2=("/!\ Error: tool installation directory not provided" "2")
ERR_MSG_3=("/!\ Error: tool name not provided" "3")
ERR_MSG_4=("/!\ Error: Directory for GATB-CORE submodule not found:" "4")
ERR_MSG_5=("/!\ Error: Directory for new project already exists:" "5")
ERR_MSG_6=("/!\ Error: unable to prepare source template" "6")
ERR_MSG_7=("/!\ Error: unable to copy scripts" "7")
ERR_MSG_8=("/!\ Error: unable to prepare CMake files" "8")
ERR_MSG_9=("/!\ Error: unable to prepare GATB-Core" "9")
ERR_MSG_10=("/!\ Error: unable to copy other files" "10")
ERR_MSG_11=("/!\ Error: unable to create project directory:" "11")
# ========================================================================================
# Section: utility function declarations
# --------
# FUNCTION: display help message
function help(){
printf "\n[$0]: a tool to create a new software relying on GATB-Core library.\n\n"
printf "usage: [-h] [-t <number_of_binaries>] -d <install_directory> -n <tool_name>\n\n"
printf " -d <install_directory> : the directory where to place the new software; use absolute path.\n"
printf " -n <tool_name> : the tool name; use alpha-num characters only.\n"
printf " -t <number_of_binaries> : number of binaries making the tool (default is 1).\n"
printf " -h : this message.\n\n"
printf "This script will automatically create the path made of <install_directory>/<tool_name>. For these\n"
printf "two values, we recommand you do not use space characters.\n\n"
printf "From time to time, you may need to organize your tool using more than one binaries. In such a case\n"
printf "you may be interested in organizing your source codes using a dedicated source folder, one for each\n"
printf "binary. In such a case, use -t <number_of_binaries>.\n"
exit 0
}
# --------
# FUNCTION: creates directory to host tool source codes
# args: step number
# return: nothing
function createToolSourceDirectory(){
ERR=0
printf "$1- Preparing template source code...\n"
if [[ $NB_TOOLS == 1 ]]; then
mkdir -p $PROJECT_DIR/tools/${TOOL_NAME}/src || ERR=1
cat $_scripts_dir/main.cpp | sed s/XXX/${TOOL_NAME}/g > $PROJECT_DIR/tools/${TOOL_NAME}/src/main.cpp || ERR=1
cat $_scripts_dir/XXX.hpp | sed s/XXX/${TOOL_NAME}/g > $PROJECT_DIR/tools/${TOOL_NAME}/src/${TOOL_NAME}.hpp || ERR=1
cat $_scripts_dir/XXX.cpp | sed s/XXX/${TOOL_NAME}/g > $PROJECT_DIR/tools/${TOOL_NAME}/src/${TOOL_NAME}.cpp || ERR=1
else
for ((i=0;i<${NB_TOOLS};++i)); do
# We create the tools directory and two sub directory for two different tools
mkdir -p $PROJECT_DIR/tools/${TOOL_NAME}_${i}/src || ERR=1
cat $_scripts_dir/main.cpp | sed s/XXX/${TOOL_NAME}_${i}/g > $PROJECT_DIR/tools/${TOOL_NAME}_${i}/src/main.cpp || ERR=1
cat $_scripts_dir/XXX.hpp | sed s/XXX/${TOOL_NAME}_${i}/g > $PROJECT_DIR/tools/${TOOL_NAME}_${i}/src/${TOOL_NAME}_${i}.hpp || ERR=1
cat $_scripts_dir/XXX.cpp | sed s/XXX/${TOOL_NAME}_${i}/g > $PROJECT_DIR/tools/${TOOL_NAME}_${i}/src/${TOOL_NAME}_${i}.cpp || ERR=1
done
fi
printf " done\n"
}
# --------
# FUNCTION: creates directory to host tool scripts
# args: step number
# return: nothing
function createToolScriptDirectory(){
ERR=0
printf "$1- Copying utility scripts...\n"
mkdir -p $PROJECT_DIR/scripts || ERR=1
# only copy required scripts (do not use *.sh: we cannot include NewProject.sh into new tool!)
cp $_scripts_dir/package_tool.sh $PROJECT_DIR/scripts/ || ERR=1
printf " done\n"
}
# --------
# FUNCTION: copy and update CMake files
# args: step number
# return: nothing
function createCMakeFiles(){
ERR=0
printf "$1- Preparing CMake files...\n"
# We copy the top level CMakeLists.txt
cat $_scripts_dir/CMakeLists.txt | sed s/XXX/${TOOL_NAME}/g | sed "s|GGGGG|${GATB_CMAKE_PATH}|g" > $PROJECT_DIR/CMakeLists.txt || ERR=1
# We copy the 'tools' CMakeLists.txt
cat $_scripts_dir/CMakeLists_tools.txt | sed s/XXX/${TOOL_NAME}/g > $PROJECT_DIR/tools/CMakeLists.txt || ERR=1
printf " done\n"
}
# --------
# FUNCTION: creates directory to host a hard copy of gatb-core
# args: step number
# return: nothing
function createGatbCoreDirectory(){
ERR=0
if [ "$INCLUDE_GATB_COPY" == "true" ] ; then
printf "$1- Including hard copy of GATB-Core library...\n"
mkdir -p $PROJECT_DIR/thirdparty/gatb-core || ERR=1
cp -r $GATB_CORE_PATH/cmake $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp -r $GATB_CORE_PATH/doc $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp -r $GATB_CORE_PATH/examples $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp -r $GATB_CORE_PATH/src $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp -r $GATB_CORE_PATH/thirdparty $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp -r $GATB_CORE_PATH/tools $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp $GATB_CORE_PATH/CMakeLists.txt $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp $GATB_CORE_PATH/LICENCE $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp $GATB_CORE_PATH/README.md $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
cp $GATB_CORE_PATH/THIRDPARTIES.md $PROJECT_DIR/thirdparty/gatb-core/ || ERR=1
else
printf "$1- Preparing GATB-Core link...\n"
fi
printf " done\n"
}
# --------
# FUNCTION: copy and/or update other files
# args: step number
# return: nothing
function createOtherFiles(){
ERR=0
local MSG1="Place here the documentation of your tool, then remove this file."
local MSG2="Place here any other third-party librairies this tool relies on."
printf "$1- Copying other files...\n"
# We copy the default README
cat $_scripts_dir/README.md | sed s/XXX/${TOOL_NAME}/g > $PROJECT_DIR/README.md || ERR=1
cp $GATB_CORE_PATH/LICENCE $PROJECT_DIR/ || ERR=1
mkdir $PROJECT_DIR/doc || ERR=1
echo $MSG1 | tee $PROJECT_DIR/doc/README || ERR=1
if [[ ! -e $PROJECT_DIR/thirdparty ]]; then
mkdir $PROJECT_DIR/thirdparty || ERR=1
fi
echo $MSG2 | tee $PROJECT_DIR/thirdparty/README || ERR=1
cp $GATB_CORE_PATH/THIRDPARTIES.md $PROJECT_DIR/thirdparty || ERR=1
printf " done\n"
}
# --------
# FUNCTION: display final msg to provide user with some help to start with the project
# args: none
# return: nothing
function displayEndingMsg(){
printf "\n*** SUCCESS: project '$TOOL_NAME' has been created in '$PROJECT_DIR'\n\n"
printf " To edit source code: have a look at $PROJECT_DIR/tools/$TOOL_NAME/src\n\n"
printf " To compile source code:\n"
printf " cd $PROJECT_DIR \n"
printf " mkdir build ; cd build ; cmake .. \n"