]> Creatis software - bbtk.git/blobdiff - kernel/appli/bbCreatePackage/bbCreatePackage.bat.in
Feature #1774
[bbtk.git] / kernel / appli / bbCreatePackage / bbCreatePackage.bat.in
index 42859182a68199c89083e82e102b2ce3250dca8a..18d6186fae6c07e74c5e5229cb128d377dba2020 100755 (executable)
@@ -1,3 +1,29 @@
+rem # ---------------------------------------------------------------------
+rem #
+rem # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+rem #                        pour la SantÈ)
+rem # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+rem # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+rem # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+rem #
+rem #  This software is governed by the CeCILL-B license under French law and
+rem #  abiding by the rules of distribution of free software. You can  use,
+rem #  modify and/ or redistribute the software under the terms of the CeCILL-B
+rem #  license as circulated by CEA, CNRS and INRIA at the following URL
+rem #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+rem #  or in the file LICENSE.txt.
+rem #
+rem #  As a counterpart to the access to the source code and  rights to copy,
+rem #  modify and redistribute granted by the license, users are provided only
+rem #  with a limited warranty  and the software's author,  the holder of the
+rem #  economic rights,  and the successive licensors  have only  limited
+rem #  liability.
+rem #
+rem #  The fact that you are presently reading this means that you have had
+rem #  knowledge of the CeCILL-B license and that you accept its terms.
+rem # ------------------------------------------------------------------------ */
+rem
+
 @echo off
 
 echo creates the file architecture for a new user package
@@ -6,65 +32,56 @@ echo creates the file architecture for a new user package
 if %0%1==%0 goto ERROR01
 
 
-set BBTKINPUT="@bbCreatePackage_DATA_PATH@"
-set BBTKOUTPUT=%1
-
-
-echo %0
-echo %PWD%
-
-# bbCreatePackage path
-##EED TMP=$(which $0|rev)
-##EED BINPATH=$(echo ${TMP#*/}|rev)
-# Input data path
-set INPUT="${BINPATH}/@bbCreatePackage_DATA_REL_PATH_FROM_BIN@/void-Package"
-
-
+rem bbCreatePackage path
+set BINPATH=%~dp0
+rem Input data path
+set INPUT="%BINPATH%\@bbCreatePackage_DATA_REL_PATH_FROM_BIN@\void-Package"
 
 set OUTPUT=%1
 set PACK=%2
 set AUTHOR=%3
 set DESCRIPTION=%4
-
-echo "output= " %OUTPUT%
-echo "bin   = " %BINPATH%
-echo "input = " %INPUT%
-echo "pack  = " %PACK%
-
-
-echo "----- Creating black box package '%BBTKNAME%' in repository '%BBTKOUTPUT%' -----"
-
-
-IF EXIST %BBTKOUTPUT% GOTO ERROR02
-
-echo "-> Packages repository '%BBTKOUTPUT%' does not exist : creating it"
-mkdir %BBTKOUTPUT%
-
-
-
-    echo "-> Creating file '%BBTKOUTPUT%/CMakeLists.txt' "
-    copy %BBTKINPUT%\PackageCMakeLists.txt %BBTKOUTPUT%\CMakeLists.txt
-    echo "-> Creating file directory '%BBTKOUTPUT%/cmake' "
-    mkdir %BBTKOUTPUT%\cmake
-    echo "-> Coping files in '%BBTKOUTPUT%/cmake' "
-    copy %BBTKINPUT%\cmake\*.cmake %BBTKOUTPUT%\cmake
-    copy %BBTKINPUT%\cmake\*.in %BBTKOUTPUT%\cmake
-
-echo "Done !"
-echo "Edit the file '%BBTKOUTPUT%/CMakeLists.txt' to customize your package"
+set PACK_DIRECTORY=bbtk_%PACK%_PKG
+
+echo output=  %OUTPUT%
+echo bin   =  %BINPATH%
+echo input =  %INPUT%
+echo pack  =  %PACK%
+echo author  =  %AUTHOR%
+echo description  =  %DESCRIPTION%
+echo pack_directory = %PACK_DIRECTORY%
+
+IF EXIST %OUTPUT%\%PACK_DIRECTORY% GOTO ERROR02
+
+echo "** Creating new black box package '%PACK%' in folder '%OUTPUT%'"
+
+mkdir %OUTPUT%\%PACK_DIRECTORY%
+xcopy %INPUT% %OUTPUT%\%PACK_DIRECTORY% /S
+"%BINPATH%\bbSed" %OUTPUT%\%PACK_DIRECTORY%\CMakeLists.txt   WITHOUT_NAME "%PACK%"             > %OUTPUT%\%PACK_DIRECTORY%\CMakeLists2.txt
+"%BINPATH%\bbSed" %OUTPUT%\%PACK_DIRECTORY%\CMakeLists2.txt  WITHOUT_AUTHOR %AUTHOR%           > %OUTPUT%\%PACK_DIRECTORY%\CMakeLists3.txt
+"%BINPATH%\bbSed" %OUTPUT%\%PACK_DIRECTORY%\CMakeLists3.txt  WITHOUT_DESCRIPTION %DESCRIPTION% > %OUTPUT%\%PACK_DIRECTORY%\CMakeLists.txt
+del "%OUTPUT%\%PACK_DIRECTORY%\CMakeLists2.txt" 
+del "%OUTPUT%\%PACK_DIRECTORY%\CMakeLists3.txt"
+
+echo
+echo "Package created !"
+echo
+echo ==>
+echo "==> Edit the file '%OUTPUT%\%PACK_DIRECTORY%\CMakeLists.txt' to customize your package"
+echo ==>
+echo
+echo
 
 
 goto END
 
 
-
-
 :ERROR01
-echo bbCreatePackage.bat "<path-to-package-repository>"
+echo bbCreatePackage.bat "<package-path> <package-name> [author] [description] "
 goto END
 
 :ERROR02
-echo "ERROR : Directory '%BBTKOUTPUT%/%BBTKNAME%' already exists !"  
+echo "ERROR : Directory '%OUTPUT%/%PACK_DIRECTORY%' already exists !"  
 goto end