]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Wed, 13 Feb 2008 14:08:24 +0000 (14:08 +0000)
committerguigues <guigues>
Wed, 13 Feb 2008 14:08:24 +0000 (14:08 +0000)
12 files changed:
kernel/CMakeLists.txt
kernel/appli/CMakeLists.txt
kernel/appli/bbCreatePackage/CMakeLists.txt
kernel/appli/bbCreatePackage/bbCreatePackage.sh.in
kernel/appli/bbCreatePackage/void-bbtk-package.tgz [new file with mode: 0644]
kernel/cmake/BBTKAddDefinitions.cmake
kernel/cmake/BBTKSetBasePaths.cmake
kernel/cmake/BBTKSetDeducedPaths.cmake
kernel/cmake/bbtk_config_build.xml.in
kernel/install/gnome/bbtk-install-gnome.sh [moved from kernel/install/gnome/install-gnome.sh with 100% similarity]
kernel/src/bbtkConfigurationFile.cxx
kernel/src/bbtkConfigurationFile.h

index 47be68f0dbffe46ff3a3598ef49715f7d73a3367..8f7eb3286c37d075e138117cbd3e14c72f4d3780 100644 (file)
@@ -22,3 +22,7 @@ SUBDIRS(cmake)
 #-----------------------------------------------------------------------------
 
 
+#-----------------------------------------------------------------------------
+# System-specific installation tools
+SUBDIRS(install)
+#-----------------------------------------------------------------------------
index bbbb30081ee6a2971ca3967781943eb2eca7276c..d25d04f30b8da8e20055ecf197d7fa4008bacec9 100644 (file)
@@ -9,5 +9,5 @@ SUBDIRS(bbfy)
 
 
 # Utility that creates the file architecture for a new user package 
-#SUBDIRS(bbCreatePackage)
+SUBDIRS(bbCreatePackage)
 
index c0051141f9c00964a4c480b422ca377869c2b7cd..fb6c6ba806e78c9f1c3c0534a0f5b5b2b742b99d 100644 (file)
@@ -2,11 +2,10 @@
 # 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(
@@ -25,22 +24,27 @@ IF(UNIX)
     ${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)
 
 
index 8a258685faddc6af5ec7aedbabb0b9f981e8764f..8556533ad237c07e8f1f44d93a1ee80d316925bf 100755 (executable)
@@ -1,32 +1,43 @@
 #!/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"
diff --git a/kernel/appli/bbCreatePackage/void-bbtk-package.tgz b/kernel/appli/bbCreatePackage/void-bbtk-package.tgz
new file mode 100644 (file)
index 0000000..7f0091f
Binary files /dev/null and b/kernel/appli/bbCreatePackage/void-bbtk-package.tgz differ
index e537dda7d462506091929ab911a4a0abe5844a27..9831d477ee1d59c894215fd2b607ee323ec0cc48 100644 (file)
@@ -1,8 +1,9 @@
 # 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) 
index c0d27b4aa0b7fc0c315aaaf2bae5990e9e733dc3..65d0a3420314b45931f1235a561018419d57c00b 100644 (file)
@@ -46,9 +46,13 @@ IF(WIN32)
   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)   
 #-----------------------------------------------------------------------------
index 56d5e08ba8ec7eb13a1916cabcc444dada3261bf..ca2ceae45c8565cc46f0a7fd8d615ec650adf483 100644 (file)
@@ -8,18 +8,20 @@ SET(BBTK_DOC_BUILD_PATH ${PROJECT_BINARY_DIR}/${BBTK_DOC_REL_PATH})
 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 
index 8a148b7372e5ffcafdb212c36aa2a33069297902..38bdd44b6a43f1584286d11dce267c8edcabcb9a 100644 (file)
@@ -2,15 +2,18 @@
 
   <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>
    
index 167579f37f4636a17b3cf96dcf21309821993424..e3982866e38f4f0ff592f6ef5b17f050cacb1803 100644 (file)
@@ -3,8 +3,8 @@
   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
@@ -42,16 +42,43 @@ ConfigurationFile::ConfigurationFile()
    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";
@@ -123,15 +150,15 @@ void ConfigurationFile::CreateConfigXML( char *rootDirectory )
    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
@@ -376,13 +403,15 @@ void ConfigurationFile::Read(const std::string& filename)
      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;
index 88d8845271ee6857b24ad7aab9d43a249d32b4c1..c9b7caba716077b65bedcc9160054267b01463ff 100644 (file)
@@ -3,8 +3,8 @@
   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
@@ -82,8 +82,16 @@ public:
      { 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
@@ -105,12 +113,35 @@ public:
   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