Add autotools variables to manage the optional dependency to padder (for the padder plugin)

This commit is contained in:
boulant 2012-05-03 19:05:12 +00:00
parent 497561723e
commit d1fdd992f7
9 changed files with 226 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -426,6 +426,15 @@ echo
CHECK_CGNS CHECK_CGNS
echo
echo ---------------------------------------------
echo Testing PADDER library
echo ---------------------------------------------
echo
CHECK_CGAL
CHECK_PADDER
echo echo
echo --------------------------------------------- echo ---------------------------------------------
echo Testing TBB library echo Testing TBB library
@ -460,6 +469,16 @@ echo
echo "Default ORB : $DEFAULT_ORB" echo "Default ORB : $DEFAULT_ORB"
echo 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 We don t need to say when we re entering directories if we re using
dnl GNU make becuase make does it for us. dnl GNU make becuase make does it for us.
if test "X$GMAKE" = "Xyes"; then if test "X$GMAKE" = "Xyes"; then

View File

@ -250,6 +250,8 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m
const char * configId) const char * configId)
{ {
beginService("MeshJobManager_i::initialize"); 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 // 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; int jobId = JOBID_UNDEFINED;
try { try {
std::cerr << "#####################################" << std::endl;
std::cerr << "#####################################" << std::endl;
std::cerr << "jobUndef = " << JOBID_UNDEFINED << std::endl;
jobId = _salomeLauncher->createJob(jobParameters); 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 // We register the datetime tag of this job
_jobDateTimeMap[jobId]=jobDatetimeTag; _jobDateTimeMap[jobId]=jobDatetimeTag;
_jobPathsMap[jobId] = jobPaths; _jobPathsMap[jobId] = jobPaths;
@ -442,7 +451,7 @@ bool MeshJobManager_i::start(CORBA::Long jobId) {
_salomeLauncher->launchJob(jobId); _salomeLauncher->launchJob(jobId);
} }
catch (const SALOME::SALOME_Exception & ex) { 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()); //LOG(ex.details.text.in());
return false; return false;
} }

View File

@ -23,5 +23,5 @@
MED_ROOT="@MED3HOME@" MED_ROOT="@MED3HOME@"
HDF_ROOT="@HDF5HOME@" 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" export LD_LIBRARY_PATH="$MED_ROOT/lib:$HDF_ROOT/lib:$CGAL_ROOT/lib:$LD_LIBRARY_PATH"

View File

@ -42,7 +42,7 @@ class ConfigReader:
try: try:
smeshpath=os.environ["SMESH_ROOT_DIR"] smeshpath=os.environ["SMESH_ROOT_DIR"]
except KeyError, ex: 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) pluginspath = os.path.join(smeshpath,CONFIG_RELPATH)
filename = os.path.join(pluginspath,CONFIG_FILENAME) filename = os.path.join(pluginspath,CONFIG_FILENAME)
@ -85,6 +85,14 @@ class ConfigReader:
return TYPE_LOCAL return TYPE_LOCAL
return defaultType 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 # Test runner
@ -124,9 +132,9 @@ def testsuite():
unittester.run(moduleName, "TEST_getDefaultConfig_withError") unittester.run(moduleName, "TEST_getDefaultConfig_withError")
if __name__ == "__main__": if __name__ == "__main__":
import os, sys #import os, sys
pluginspath=os.environ["SALOME_PLUGINS_PATH"] #pluginspath=os.environ["SALOME_PLUGINS_PATH"]
for path in pluginspath.split(":"): #for path in pluginspath.split(":"):
sys.path.insert(0,path) # sys.path.insert(0,path)
testsuite() testsuite()

View File

@ -21,8 +21,8 @@ defaultres = local
# - envpath : the path to the environment file on this resource # - envpath : the path to the environment file on this resource
[localhost] [localhost]
resname = localhost resname = localhost
binpath = @prefix@/share/salome/resources/smesh/padderexe/padder.exe binpath = @PADDERHOME@/padder.exe
envpath = @prefix@/share/salome/resources/smesh/padderexe/envPadder.sh envpath = @PADDERHOME@/padder.env
[venus] [venus]
resname = gboulant@venus resname = gboulant@venus

View File

@ -30,7 +30,7 @@
# directory of the SALOME module. # directory of the SALOME module.
listfiles="\ listfiles="\
configreader.py \ configreader.py \
unittests/test_meshJobManager.py \ unittests/usecase_meshJobManager.py \
gui/inputdata.py" gui/inputdata.py"
INSTALL_DIR=@prefix@ INSTALL_DIR=@prefix@

View File

@ -28,9 +28,13 @@
# Preparing the configuration parameters # Preparing the configuration parameters
# #
import os import os
from salome.smesh.spadder.configreader import ConfigReader, printConfig
configReader = ConfigReader()
defaultConfig = configReader.getDefaultConfig()
printConfig(defaultConfig)
from salome.smesh import spadder 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_concrete=os.path.join(spadder.getTestDataDir(),"concrete.med")
file_steelbar=os.path.join(spadder.getTestDataDir(),"ferraill.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 # the catalog of SPADDER components, then load the component
# MeshJobManager, and finally configure this component. # MeshJobManager, and finally configure this component.
# #
from salome.smesh import spadder
spadder.loadSpadderCatalog() spadder.loadSpadderCatalog()
salome.salome_init() salome.salome_init()
component = salome.lcc.FindOrLoadComponent("FactoryServer","MeshJobManager") component = salome.lcc.FindOrLoadComponent("FactoryServer","MeshJobManager")
config = MESHJOB.ConfigParameter(resname="localhost", config = MESHJOB.ConfigParameter(resname=defaultConfig.resname,
binpath=pathpadderexe, binpath=defaultConfig.binpath,
envpath=pathpadderenv) envpath=defaultConfig.envpath)
component.configure("localhost",config) component.configure("localhost",config)
# #
@ -70,8 +73,7 @@ jobid = component.initialize(meshJobParameterList, "localhost")
# #
# Start the execution of the job identified by its job id. # 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. # This part illustrates how you can follow the execution of the job.