#-----------------------------------------------------------------------------
+#-----------------------------------------------------------------------------
+# System-specific installation tools
+SUBDIRS(install)
+#-----------------------------------------------------------------------------
# Utility that creates the file architecture for a new user package
-#SUBDIRS(bbCreatePackage)
+SUBDIRS(bbCreatePackage)
# used to creates the file architecture for a new user package
# go to data which install the input data to the script
-SUBDIRS(data)
+#SUBDIRS(data)
# Sets the data install path
-SET(bbCreatePackage_DATA_PATH
- ${CMAKE_INSTALL_PREFIX}/bin/Data_bbCreatePackage)
+SET(bbCreatePackage_DATA_REL_PATH ../${BBTK_DATA_REL_PATH}/bbCreatePackage)
IF(WIN32)
CONFIGURE_FILE(
${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage
@ONLY IMMEDIATE
)
- CONFIGURE_FILE(
- ${CMAKE_CURRENT_SOURCE_DIR}/bbCreatePackage.bbs
- ${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage.bbs
- @ONLY IMMEDIATE
- )
INSTALL(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage
+ PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage
DESTINATION bin
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
- )
+ # PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ )
INSTALL(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage.bbs
- DESTINATION bin
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
- )
+ FILES void-bbtk-package.tgz
+ DESTINATION ${BBTK_DATA_REL_PATH}/bbCreatePackage
+ )
+
+# CONFIGURE_FILE(
+# ${CMAKE_CURRENT_SOURCE_DIR}/bbCreatePackage.bbs
+# ${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage.bbs
+# @ONLY IMMEDIATE
+# )
+# INSTALL(
+# FILES ${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage.bbs
+# DESTINATION bin
+# PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+# )
ENDIF(UNIX)
#!/bin/bash
# creates the file architecture for a new user package
-if [ $# -ne 1 ]
+if [ $# -lt 2 ]
then
- echo "usage : bbCreatePackage <package-folder-with-complete-path>"
+ echo "usage : bbCreatePackage <package-path> <package-name> [author] [description]"
exit
fi
-INPUT=@bbCreatePackage_DATA_PATH@
+# bbCreatePackage path
+TMP=$(which bbCreatePackage|rev)
+BBCP=$(echo ${TMP#*/}|rev)
+INPUT=${BBCP}/@bbCreatePackage_DATA_REL_PATH@/void-bbtk-package.tgz
OUTPUT=$1
+PACK=$2
+AUTHOR=$3
+DESCRIPTION=$4
-echo "----- Creating new black box package '$1' in repository '$OUTPUT' -----"
-
-if [ -e $OUTPUT ]
+if [ -d $OUTPUT/${PACK} ]
then
- echo "ERROR : Directory '$OUTPUT' already exists !"
+ echo "ERROR : Directory '$OUTPUT/${PACK}' already exists !"
exit
fi
+echo "**ls Creating new black box package '$PACK' in folder '$OUTPUT'"
+
+if [ ! -d $OUTPUT ]
+ then
+ echo "ERROR : Directory '$OUTPUT' does not exist !"
+ exit
+fi
-echo "-> Creating directory '$OUTPUT'"
-mkdir $OUTPUT
-echo "-> Creating file '$OUTPUT/CMakeLists.txt'"
-cp ${INPUT}/PackageCMakeLists.txt ${OUTPUT}/CMakeLists.txt
-echo "-> Creating directory '$OUTPUT/cmake'"
-mkdir ${OUTPUT}/cmake
-echo "-> Copying files in '$OUTPUT/cmake'"
-cp ${INPUT}/cmake/*.cmake ${OUTPUT}/cmake/
-cp ${INPUT}/cmake/*.in ${OUTPUT}/cmake/
+echo "-> Uncompressing package files"
+cd $OUTPUT
+tar zxvf ${INPUT}
+mv void ${PACK}/
+cd ${PACK}
+sed s,WITHOUT_NAME,${PACK}, CMakeLists.txt > CMakeLists2.txt
+sed s,WITHOUT_AUTHOR,"${AUTHOR}", CMakeLists2.txt > CMakeLists3.txt
+sed s,WITHOUT_DESCRIPTION,"${DESCRIPTION}", CMakeLists3.txt > CMakeLists.txt
+rm -f CMakeLists2.txt CMakeLists3.txt
echo "Done !"
-echo "Edit the file '$OUTPUT/CMakeLists.txt' to customize your package"
+echo "Edit the file '$OUTPUT/${PACK}/CMakeLists.txt' to customize your package"
# Set C preprocessor definitions
-ADD_DEF_WITH_VAL(BBTK_SHARE_REL_PATH ${BBTK_SHARE_REL_PATH})
-ADD_DEF_WITH_VAL(BBTK_DOC_REL_PATH ${BBTK_DOC_REL_PATH})
-ADD_DEF_WITH_VAL(BBTK_BBS_REL_PATH ${BBTK_BBS_REL_PATH})
-
+ADD_DEF_WITH_VAL(BBTK_SHARE_REL_PATH "\"${BBTK_SHARE_REL_PATH}\"")
+ADD_DEF_WITH_VAL(BBTK_DOC_REL_PATH "\"${BBTK_DOC_REL_PATH}\"")
+ADD_DEF_WITH_VAL(BBTK_BBS_REL_PATH "\"${BBTK_BBS_REL_PATH}\"")
+#ADD_DEF_WITH_VAL(BBTK_RSC_REL_PATH "\"${BBTK_RSC_REL_PATH}\"")
+ADD_DEF_WITH_VAL(BBTK_DATA_REL_PATH "\"${BBTK_DATA_REL_PATH}\"")
#-----------------------------------------------------------------------------
# messages compilation options
IF (BBTK_COMPILE_MESSAGES)
SET(BBTK_SHARE_REL_PATH)
SET(BBTK_DOC_REL_PATH doc)
SET(BBTK_BBS_REL_PATH bbs)
+ # SET(BBTK_RSC_REL_PATH rsc)
+ SET(BBTK_DATA_REL_PATH data)
ELSE(WIN32)
SET(BBTK_SHARE_REL_PATH share/bbtk)
SET(BBTK_DOC_REL_PATH share/bbtk/doc)
SET(BBTK_BBS_REL_PATH share/bbtk/bbs)
+ # SET(BBTK_RSC_REL_PATH share/bbtk/rsc)
+ SET(BBTK_DATA_REL_PATH share/bbtk/data)
ENDIF(WIN32)
#-----------------------------------------------------------------------------
SET(BBTK_BBDOC_BUILD_PATH ${PROJECT_BINARY_DIR}/${BBTK_BBDOC_REL_PATH})
SET(BBTK_DOXYGEN_BUILD_PATH ${PROJECT_BINARY_DIR}/${BBTK_DOXYGEN_REL_PATH})
SET(BBTK_BBS_BUILD_PATH ${PROJECT_BINARY_DIR}/${BBTK_BBS_REL_PATH})
+SET(BBTK_DATA_BUILD_PATH ${PROJECT_BINARY_DIR}/${BBTK_DATA_REL_PATH})
SET(BBTK_DOC_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${BBTK_DOC_REL_PATH})
SET(BBTK_BBDOC_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${BBTK_BBDOC_REL_PATH})
SET(BBTK_DOXYGEN_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${BBTK_DOXYGEN_REL_PATH})
SET(BBTK_BBS_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${BBTK_BBS_REL_PATH})
+SET(BBTK_DATA_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${BBTK_DATA_REL_PATH})
# Create build directories if necessary
MKDIR(${BBTK_DOC_BUILD_PATH})
MKDIR(${BBTK_BBDOC_BUILD_PATH})
MKDIR(${BBTK_DOXYGEN_BUILD_PATH})
-MKDIR(${BBTK_DOXYGEN_BUILD_PATH})
MKDIR(${BBTK_BBS_BUILD_PATH})
+MKDIR(${BBTK_DATA_BUILD_PATH})
#-----------------------------------------------------------------------------
SET (EXECUTABLE_OUTPUT_PATH
<description> Sets the search directories in the build tree </description>
- <url> @BBTK_DOC_BUILD_PATH@ </url>
+ <url> </url>
+#@BBTK_DOC_BUILD_PATH@ </url>
- <bbs_path> @BBTK_BBS_BUILD_PATH@ </bbs_path>
+ <bbs_path> </bbs_path>
+#@BBTK_BBS_BUILD_PATH@ </bbs_path>
<package_path> @EXECUTABLE_OUTPUT_PATH@ </package_path>
# For windows
<package_path> @EXECUTABLE_OUTPUT_PATH@\Debug </package_path>
<package_path> @EXECUTABLE_OUTPUT_PATH@\Release </package_path>
#
- <data_path> @BBTK_DATA_ROOT@ </data_path>
+ <data_path> </data_path>
+#@BBTK_DATA_ROOT@ </data_path>
<default_temp_dir> @PROJECT_BINARY_DIR@ </default_temp_dir>
Program: bbtk
Module: $RCSfile: bbtkConfigurationFile.cxx,v $
Language: C++
- Date: $Date: 2008/02/06 10:53:02 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/13 14:08:25 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
std::string slash("/");
#endif
-// ==> First we look for bbtk_config.xml in "."
-
+ // ==> Set system paths
+ mBin_path = execPath;
+ mInstall_path = mBin_path + slash + "..";
+ // The relative path to the doc folder (=BBTK_DOC_REL_PATH)
+ mDoc_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH);
+ // The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path)
+ mDoc_path = mInstall_path + slash + mDoc_rel_path;
+ // The relative path to the doc folder (=BBTK_BBS_REL_PATH)
+ mBbs_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_BBS_REL_PATH);
+ // The path to the bbs folder (=mInstall_path+"/"+mBbs_rel_path)
+ mBbs_path = mInstall_path + slash + mBbs_rel_path;
+ // The relative path to the rsc folder (=BBTK_RSC_REL_PATH)
+ // mRsc_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_RSC_REL_PATH);
+ // The path to the rsc folder (=mInstall_path+"/"+mRsc_rel_path)
+ // mRsc_path = mInstall_path + slash + mRsc_rel_path;
+ // The path to the bbtk data folder
+ // Initialized to mInstall_path+"/"+BBTK_DATA_REL_PATH
+ // But can be overriden by value read from bbtk_config.xml
+ mData_path = mInstall_path + slash + BBTK_STRINGIFY_SYMBOL(BBTK_DATA_REL_PATH);
+ // MessageManager::SetMessageLevel("Config",1);
+ bbtkMessage("Config",1," ==> bin : '"<<mBin_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> prefix : '"<<mInstall_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> doc : '"<<mDoc_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> bbs : '"<<mBbs_path<<"'"<<std::endl);
+ // bbtkMessage("Config",1," ==> rsc : '"<<mRsc_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> data : '"<<mData_path<<"'"<<std::endl);
+
+ // ==> First we look for bbtk_config.xml in "."
char buf[2048];
const char *currentDir = getcwd(buf, 2048);
if( !currentDir )
{
std::cerr << "Path was too long to fit on 2048 bytes ?!?" << std::endl;
- /// \todo : what else?
+ // \todo : what else?
// How abort a constructor and warn the caller function?
+ // LG : throw an exception
}
std::string configXmlFullPathName = currentDir + slash + "bbtk_config.xml";
bbtkMessage("Config",1, "in CreateConfigXML[" << configXml << "]" << std::endl);
fp = fopen (configXml, "w");
fprintf(fp, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
- fprintf(fp, "<!DOCTYPE config SYSTEM \"/mnt/windows/bbtk/bbtk_config.xml>\n");
+ // fprintf(fp, "<!DOCTYPE config SYSTEM \"/mnt/windows/bbtk/bbtk_config.xml>\n");
fprintf(fp, "<config>\n");
fprintf(fp, " <description> </description>\n");
- fprintf(fp, " <url> http://www.creatis.insa-lyon.fr/software/bbtk </url>\n");
- fprintf(fp, " <install_path> </install_path>\n");
+ // fprintf(fp, " <url> http://www.creatis.insa-lyon.fr/software/bbtk </url>\n");
+ // fprintf(fp, " <install_path> </install_path>\n");
fprintf(fp, " <bbs_path> </bbs_path>\n");
// fprintf(fp, " <ext_dll_path> </ext_dll_path>\n");
fprintf(fp, " <package_path> </package_path>\n");
- fprintf(fp, " <data_path> %s </data_path>\n", BBTK_DATA_PATH);
+ fprintf(fp, " <data_path> </data_path>\n");//, BBTK_DATA_PATH);
/// \todo find a decent default value !
///fprintf(fp, " <default_temp_dir> %s </default_temp_dir>\n", " ");
// when $ will be found, default_temp_dir value will be replaced
GetTextOrClear(BB.getChildNode((XMLCSTR)"data_path"),mData_path);
// install_path
- if( BB.nChildNode((XMLCSTR)"install_path") )
- GetTextOrClear(BB.getChildNode((XMLCSTR)"install_path"),mInstall_path);
+ // if( BB.nChildNode((XMLCSTR)"install_path") )
+ // GetTextOrClear(BB.getChildNode((XMLCSTR)"install_path"),mInstall_path);
// always add "." (current working directory) at the begining
-
// bbs_paths
mBbs_paths.push_back(".");
+ // add system bbs path
+ mBbs_paths.push_back(mBbs_path);
+
for (i=0,j=0; i<BB.nChildNode((XMLCSTR)"bbs_path"); i++)
{
std::string val;
Program: bbtk
Module: $RCSfile: bbtkConfigurationFile.h,v $
Language: C++
- Date: $Date: 2008/02/06 10:53:02 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/13 14:08:25 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
{ return mData_path;}
inline const std::string& Get_file_separator() const
{ return mFile_separator;}
+
+ inline const std::string& Get_bin_path() const
+ { return mBin_path;}
inline const std::string& Get_install_path() const
{ return mInstall_path;}
+ inline const std::string& Get_doc_path() const
+ { return mDoc_path;}
+ inline const std::string& Get_rsc_path() const
+ { return mRsc_path;}
+
inline const std::vector<std::string>& Get_bbs_paths() const
{ return mBbs_paths;}
inline const std::vector<std::string>& Get_package_paths() const
std::string mDescription;
/// Where is the file bbtk_config.xml
std::string mConfig_xml_full_path;
- /// Where the doc is
- std::string mUrl;
+
+ /// Set automatically :
+ /// The path to the executable (usually bbi)
+ std::string mBin_path;
+ /// The path to the install prefix (=mBinPath+"/..")
std::string mInstall_path;
+ /// The relative path to the doc folder (=BBTK_DOC_REL_PATH)
+ std::string mDoc_rel_path;
+ /// The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path)
+ std::string mDoc_path;
+ /// The relative path to the doc folder (=BBTK_BBS_REL_PATH)
+ std::string mBbs_rel_path;
+ /// The path to the bbs folder (=mInstall_path+"/"+mBbs_rel_path)
+ std::string mBbs_path;
+ /// The relative path to the rsc folder (=BBTK_RSC_REL_PATH)
+ std::string mRsc_rel_path;
+ /// The path to the rsc folder (=mInstall_path+"/"+mRsc_rel_path)
+ std::string mRsc_path;
+ /// The path to the bbtk data folder
+ /// Initialized to mInstall_path+"/"+BBTK_DATA_REL_PATH
+ /// But can be overriden by value read from bbtk_config.xml
std::string mData_path;
+
/// / or \, depending on the OS
std::string mFile_separator;
+
+ /// Read from bbtk_config.xml file
+ /// Where the doc is
+ std::string mUrl;
/// Scripts
std::vector<std::string> mBbs_paths;
/// Package dlls