From d1fdd992f73560e12d2579b046aec4120b2a4a77 Mon Sep 17 00:00:00 2001 From: boulant Date: Thu, 3 May 2012 19:05:12 +0000 Subject: [PATCH] Add autotools variables to manage the optional dependency to padder (for the padder plugin) --- adm_local/unix/config_files/check_cgal.m4 | 101 ++++++++++++++++++ adm_local/unix/config_files/check_padder.m4 | 69 ++++++++++++ configure.ac | 19 ++++ .../padder/meshjob/impl/MeshJobManager_i.cxx | 11 +- .../resources/padderexe/envPadder.sh.in | 2 +- src/Tools/padder/spadderpy/configreader.py | 18 +++- src/Tools/padder/spadderpy/padder.cfg.in | 4 +- src/Tools/padder/unittests/autotest.sh.in | 2 +- .../unittests/usecase_meshJobManager.py | 18 ++-- 9 files changed, 226 insertions(+), 18 deletions(-) create mode 100644 adm_local/unix/config_files/check_cgal.m4 create mode 100644 adm_local/unix/config_files/check_padder.m4 diff --git a/adm_local/unix/config_files/check_cgal.m4 b/adm_local/unix/config_files/check_cgal.m4 new file mode 100644 index 000000000..2ec433615 --- /dev/null +++ b/adm_local/unix/config_files/check_cgal.m4 @@ -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 index 000000000..ab30fecab --- /dev/null +++ b/adm_local/unix/config_files/check_padder.m4 @@ -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 diff --git a/configure.ac b/configure.ac index a7d618821..c4a80f6aa 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx index 19deaac5b..72520fbab 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx @@ -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 !" <