Salome HOME
Add autotools variables to manage the optional dependency to padder (for the padder...
authorboulant <boulant>
Thu, 3 May 2012 19:05:12 +0000 (19:05 +0000)
committerboulant <boulant>
Thu, 3 May 2012 19:05:12 +0000 (19:05 +0000)
adm_local/unix/config_files/check_cgal.m4 [new file with mode: 0644]
adm_local/unix/config_files/check_padder.m4 [new file with mode: 0644]
configure.ac
src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx
src/Tools/padder/resources/padderexe/envPadder.sh.in
src/Tools/padder/spadderpy/configreader.py
src/Tools/padder/spadderpy/padder.cfg.in
src/Tools/padder/unittests/autotest.sh.in
src/Tools/padder/unittests/usecase_meshJobManager.py

diff --git a/adm_local/unix/config_files/check_cgal.m4 b/adm_local/unix/config_files/check_cgal.m4
new file mode 100644 (file)
index 0000000..2ec4336
--- /dev/null
@@ -0,0 +1,101 @@
+dnl Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+AC_DEFUN([CHECK_CGAL],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([CHECK_BOOST])
+
+AC_CHECKING(for CGAL)
+
+AC_ARG_WITH(cgal,
+    [  --with-cgal=DIR                 root directory path to CGAL installation ],
+    [CGALHOME="$withval"
+      AC_MSG_RESULT("select $withval as path to CGAL")
+    ])
+
+AC_SUBST(CGAL_INCLUDES)
+AC_SUBST(CGAL_LIBS)
+AC_SUBST(CGALHOME)
+
+CGAL_INCLUDES=""
+CGAL_LIBS=""
+
+cgal_ok=no
+
+LOCAL_INCLUDES=""
+LOCAL_LIBS="-lCGAL"
+
+if test "x$CGALHOME" != "xno"; then
+    if test "x$CGALHOME" == "xyes"; then
+        CGALHOME=""
+    fi
+    if test -z $CGALHOME
+    then
+        AC_MSG_WARN(undefined CGALHOME variable which specify CGAL library installation directory)
+        AC_PATH_PROG(BINDIR, cgal_create_cmake_script)
+        if test "x$BINDIR" != "x" ; then
+            CGALHOME=$BINDIR
+            CGALHOME=`echo ${CGALHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+            CGALHOME=`echo ${CGALHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+        fi
+    fi
+    if test ! -z $CGALHOME
+    then
+        cgal_ok=yes
+        LOCAL_INCLUDES="-I$CGALHOME/include"
+        if test "x$CGALHOME" != "x/usr"; then
+            LOCAL_LIBS="-L$CGALHOME/lib $LOCAL_LIBS"
+        fi
+    fi
+
+dnl check cgallib header
+
+    # CPPFLAGS_old=$CPPFLAGS
+    # CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES -I$BOOSTDIR/include"
+
+    # AC_CHECK_HEADER(algorithm.h,cgal_ok=yes ,cgal_ok=no)
+
+    # CPPFLAGS=$CPPFLAGS_old
+fi
+
+# if  test "x$cgal_ok" = "xyes"
+# then
+# dnl check cgal library
+#   LIBS_old="$LIBS"
+#   LIBS="$LIBS $LOCAL_LIBS"
+#   AC_CHECK_LIB(cgns,cg_open,cgns_ok=yes,cgns_ok=no)
+#   LIBS="$LIBS_old" 
+# fi
+
+if  test "x$cgal_ok" = "xyes"
+then
+  CGAL_LIBS="$LOCAL_LIBS"
+  CGAL_INCLUDES="$LOCAL_INCLUDES"
+  CPPFLAGS="-DWITH_CGAL $CPPFLAGS"
+fi
+
+AC_MSG_RESULT(for CGAL: $cgal_ok)
+
+AM_CONDITIONAL(WITH_CGAL, [test x"$cgal_ok" = xyes])
+
+])dnl
diff --git a/adm_local/unix/config_files/check_padder.m4 b/adm_local/unix/config_files/check_padder.m4
new file mode 100644 (file)
index 0000000..ab30fec
--- /dev/null
@@ -0,0 +1,69 @@
+dnl Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+AC_DEFUN([CHECK_PADDER],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([CHECK_CGAL])
+
+AC_CHECKING(for PADDER)
+
+padder_ok=no
+
+AC_ARG_WITH(padder,
+    [  --with-padder=DIR                 root directory path to PADDER installation ],
+    [PADDERHOME="$withval"
+      AC_MSG_RESULT("select $withval as path to PADDER")
+    ])
+
+if test "x$PADDERHOME" != "xno"; then
+    if test "x$PADDERHOME" == "xyes"; then
+        PADDERHOME=""
+    fi
+    if test -z $PADDERHOME
+    then
+        AC_MSG_WARN(undefined PADDERHOME variable which specify PADDER installation directory)
+        AC_PATH_PROG(BINDIR, padder.exe)
+        if test "x$BINDIR" != "x" ; then
+            PADDERHOME=$BINDIR
+            PADDERHOME=`echo ${PADDERHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+            PADDERHOME=`echo ${PADDERHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+        fi
+    fi
+    if test ! -z $PADDERHOME
+    then
+        AC_CHECK_FILE($PADDERHOME/padder.env,padder_ok=yes,padder_ok=no)
+    fi
+fi
+
+if  test "x$padder_ok" = "xyes"
+then
+  CPPFLAGS="-DWITH_PADDER $CPPFLAGS"
+fi
+
+AC_SUBST(PADDERHOME)
+
+AC_MSG_RESULT(for PADDER: $padder_ok)
+
+AM_CONDITIONAL(WITH_PADDER, [test x"$padder_ok" = xyes])
+
+])dnl
index a7d61882126975abe4526ba0e93c35bf93831b83..c4a80f6aaf646473b751411810a1d52203ee1493 100644 (file)
@@ -426,6 +426,15 @@ echo
 
 CHECK_CGNS
 
+echo
+echo ---------------------------------------------
+echo Testing PADDER library
+echo ---------------------------------------------
+echo
+
+CHECK_CGAL
+CHECK_PADDER
+
 echo
 echo ---------------------------------------------
 echo Testing TBB library
@@ -460,6 +469,16 @@ echo
 echo "Default ORB   : $DEFAULT_ORB"
 echo
 
+echo "Optionnal products (for plugins):"
+optional_vars="cgal_ok padder_ok"
+for var in $optional_vars
+do
+   printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
+   eval echo \$$var
+done
+
+
+
 dnl We don t need to say when we re entering directories if we re using
 dnl GNU make becuase make does it for us.
 if test "X$GMAKE" = "Xyes"; then
index 19deaac5b6f515904acefd97f4ba07ae9526c3ac..72520fbabf811486d528ea35cb196834f4779948 100644 (file)
@@ -250,6 +250,8 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m
                                          const char * configId)
 {
   beginService("MeshJobManager_i::initialize");
+  std::cerr << "##################################### initialize" << std::endl;
+  std::cerr << "#####################################" << std::endl;
 
   //
   // We first analyse the CORBA sequence to store data in C++ vectors
@@ -414,7 +416,14 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m
 
   int jobId = JOBID_UNDEFINED;
   try {
+    std::cerr << "#####################################" << std::endl;
+    std::cerr << "#####################################" << std::endl;
+    std::cerr << "jobUndef = " << JOBID_UNDEFINED << std::endl;
     jobId = _salomeLauncher->createJob(jobParameters);
+    std::cerr << "#####################################" << std::endl;
+    std::cerr << "#####################################" << std::endl;
+    std::cerr << "#####################################" << std::endl;
+    std::cerr << "jobId = " << jobId << std::endl;
     // We register the datetime tag of this job
     _jobDateTimeMap[jobId]=jobDatetimeTag;
     _jobPathsMap[jobId] = jobPaths;
@@ -442,7 +451,7 @@ bool MeshJobManager_i::start(CORBA::Long jobId) {
     _salomeLauncher->launchJob(jobId);
   }
   catch (const SALOME::SALOME_Exception & ex) {
-    LOG("SALOME Exception in createJob !" <<ex.details.text.in());
+    LOG("SALOME Exception in launchjob !" <<ex.details.text.in());
     //LOG(ex.details.text.in());
     return false;
   }
index 30a2f3efc7c5ee804d0d6061804c1b3e19d6cce8..90848a915635ee85c312d127e55e55c8b94609fe 100644 (file)
@@ -23,5 +23,5 @@
 
 MED_ROOT="@MED3HOME@"
 HDF_ROOT="@HDF5HOME@"
-CGAL_ROOT="/usr"
+CGAL_ROOT="@CGALHOME@"
 export LD_LIBRARY_PATH="$MED_ROOT/lib:$HDF_ROOT/lib:$CGAL_ROOT/lib:$LD_LIBRARY_PATH"
index dae4d9a50d92a3c7eb07a67839d5a2d0623424b2..ceacf543fbef327d28ed10e838eb9ef8466d2dc4 100644 (file)
@@ -42,7 +42,7 @@ class ConfigReader:
         try:
             smeshpath=os.environ["SMESH_ROOT_DIR"]
         except KeyError, ex:
-            raise AdminException("You should define the variable SALOME_PLUGINS_PATH")
+            raise AdminException("You should define the variable SMESH_ROOT_DIR")
 
         pluginspath = os.path.join(smeshpath,CONFIG_RELPATH)
         filename    = os.path.join(pluginspath,CONFIG_FILENAME)
@@ -85,6 +85,14 @@ class ConfigReader:
             return TYPE_LOCAL
         return defaultType
 
+
+def printConfig(config):
+    print "PADDER CONFIGURATION:"
+    print "\tconfig.resname = %s"%config.resname
+    print "\tconfig.binpath = %s"%config.binpath
+    print "\tconfig.envpath = %s"%config.envpath
+    
+
 #
 # =========================================================================
 # Test runner
@@ -124,9 +132,9 @@ def testsuite():
     unittester.run(moduleName, "TEST_getDefaultConfig_withError")
     
 if __name__ == "__main__":
-    import os, sys
-    pluginspath=os.environ["SALOME_PLUGINS_PATH"]
-    for path in pluginspath.split(":"):
-        sys.path.insert(0,path)
+    #import os, sys
+    #pluginspath=os.environ["SALOME_PLUGINS_PATH"]
+    #for path in pluginspath.split(":"):
+    #    sys.path.insert(0,path)
     
     testsuite()
index 9a8f5e1dd92a083ae2247fb43e61ac6d4a9dfed1..4962a336a05314a23fc54549cb53c177d4295613 100644 (file)
@@ -21,8 +21,8 @@ defaultres = local
 # - envpath : the path to the environment file on this resource
 [localhost]
 resname = localhost
-binpath = @prefix@/share/salome/resources/smesh/padderexe/padder.exe
-envpath = @prefix@/share/salome/resources/smesh/padderexe/envPadder.sh
+binpath = @PADDERHOME@/padder.exe
+envpath = @PADDERHOME@/padder.env
 
 [venus]
 resname = gboulant@venus
index c92a83ba5850b42ad5b67eab88e81d009270bb83..7ff1ece28d2c54d1b1021c9630ecc7b02abfb467 100644 (file)
@@ -30,7 +30,7 @@
 # directory of the SALOME module.
 listfiles="\
     configreader.py \
-    unittests/test_meshJobManager.py \
+    unittests/usecase_meshJobManager.py \
     gui/inputdata.py"
 
 INSTALL_DIR=@prefix@
index ea953e8486aaf216389df777d8512ea1b965b55f..09a8c09ea18dc63fcda77614c94a1a166a6c2fbf 100644 (file)
 # Preparing the configuration parameters
 #
 import os
+from salome.smesh.spadder.configreader import ConfigReader, printConfig
+
+configReader = ConfigReader()
+defaultConfig = configReader.getDefaultConfig()
+printConfig(defaultConfig)
+
 from salome.smesh import spadder
-pathpadderexe=os.path.join(spadder.getTestDataDir(),"padder.exe")
-pathpadderenv=os.path.join(spadder.getTestDataDir(),"envPadder.sh")
 file_concrete=os.path.join(spadder.getTestDataDir(),"concrete.med")
 file_steelbar=os.path.join(spadder.getTestDataDir(),"ferraill.med")
 
@@ -42,14 +46,13 @@ import MESHJOB
 # the catalog of SPADDER components, then load the component
 # MeshJobManager, and finally configure this component.
 #
-from salome.smesh import spadder
 spadder.loadSpadderCatalog()
 
 salome.salome_init()
 component = salome.lcc.FindOrLoadComponent("FactoryServer","MeshJobManager")
-config = MESHJOB.ConfigParameter(resname="localhost",
-                                 binpath=pathpadderexe,
-                                 envpath=pathpadderenv)
+config = MESHJOB.ConfigParameter(resname=defaultConfig.resname,
+                                 binpath=defaultConfig.binpath,
+                                 envpath=defaultConfig.envpath)
 component.configure("localhost",config)
 
 #
@@ -70,8 +73,7 @@ jobid = component.initialize(meshJobParameterList, "localhost")
 #
 # Start the execution of the job identified by its job id.
 #
-component.start(jobid)
-
+ok=component.start(jobid)
 
 #
 # This part illustrates how you can follow the execution of the job.