From 5019051f01d6680e919c1c222e55f7cef9eba0cd Mon Sep 17 00:00:00 2001 From: gdd Date: Tue, 13 Sep 2011 14:26:28 +0000 Subject: [PATCH] rnc : added a macro .m4 for detection of the opencv library --- adm_local/unix/config_files/check_OpenCV.m4 | 96 +++++++++++++++++++++ configure.ac | 13 ++- src/EntityGUI/Makefile.am | 8 +- src/GEOMGUI/Makefile.am | 4 +- 4 files changed, 111 insertions(+), 10 deletions(-) create mode 100644 adm_local/unix/config_files/check_OpenCV.m4 diff --git a/adm_local/unix/config_files/check_OpenCV.m4 b/adm_local/unix/config_files/check_OpenCV.m4 new file mode 100644 index 000000000..02b9e4861 --- /dev/null +++ b/adm_local/unix/config_files/check_OpenCV.m4 @@ -0,0 +1,96 @@ +dnl Copyright (C) 2007-2011 CEA/DEN, EDF R&D +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 + +dnl File : check_OpenCV.m4 +dnl Author : Renaud NEDELEC, Open CASCADE S.A.S (renaud.nedelec@opencascade.com) +dnl +AC_DEFUN([CHECK_OPENCV],[ + +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl + +AC_CHECKING([for OPENCV product]) + +AC_LANG_SAVE +AC_LANG_C + +OPENCV_INCLUDES="" +OPENCV_LIBS="" + +AC_ARG_WITH([opencv], + [ --with-opencv=DIR root directory path of OPENCV installation]) + +opencv_ok=no + +if test "$with_opencv" != "no" ; then + if test "$with_opencv" == "yes" || test "$with_opencv" == "auto"; then + OPENCV_HOME="" + else + OPENCV_HOME="$with_opencv" + fi + + if test "$OPENCV_HOME" == "" ; then + if test "x$OPENCVHOME" != "x" ; then + OPENCV_HOME=$OPENCVHOME + fi + fi + + if test "x$OPENCV_HOME" != "x"; then + + LOCAL_INCLUDES="-I$OPENCV_HOME/include -I$OPENCV_HOME/include/opencv" + LOCAL_LIBS="-L$OPENCV_HOME/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann" + + CPPFLAGS_old="$CPPFLAGS" + CXXFLAGS_old="$CXXFLAGS" + CPPFLAGS="$LOCAL_INCLUDES $CPPFLAGS" + CXXFLAGS="$LOCAL_INCLUDES $CXXFLAGS" + + AC_MSG_CHECKING([for OPENCV library]) + + LDFLAGS_old="$LDFLAGS" + LDFLAGS="-L. $LOCAL_LIBS $LDFLAGS" + + LDFLAGS="$LDFLAGS_old" + + opencv_ok=yes + + AC_MSG_RESULT([$opencv_ok]) + + CPPFLAGS="$CPPFLAGS_old" + CXXFLAGS="$CXXFLAGS_old" + + fi +fi + +if test "x$opencv_ok" == xno ; then + AC_MSG_RESULT([for OPENCV: no]) + AC_MSG_WARN([OPENCV includes or libraries are not found or are not properly installed]) + AC_MSG_WARN([Cannot build without OPENCV. Use --with-opencv option to define OPENCV installation.]) +else + OPENCV_INCLUDES=$LOCAL_INCLUDES + OPENCV_LIBS=$LOCAL_LIBS + AC_MSG_RESULT([for OPENCV: yes]) +fi + +AC_SUBST(OPENCV_INCLUDES) +AC_SUBST(OPENCV_LIBS) + +AC_LANG_RESTORE + +])dnl diff --git a/configure.ac b/configure.ac index 15d84b478..24a133154 100644 --- a/configure.ac +++ b/configure.ac @@ -331,6 +331,13 @@ echo --------------------------------------------- echo CHECK_SPHINX +echo +echo --------------------------------------------- +echo testing Opencv +echo --------------------------------------------- +echo +CHECK_OPENCV + echo echo --------------------------------------------- echo Testing Kernel @@ -348,11 +355,11 @@ echo echo Configure if test "${gui_ok}" = "yes"; then - variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok gui_ok" + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok sphinx_ok opencv_ok Kernel_ok gui_ok" elif test "${SalomeGUI_need}" != "no"; then - variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok gui_ok" + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok opencv_ok Kernel_ok gui_ok" else - variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok opencv_ok Kernel_ok" fi for var in $variables diff --git a/src/EntityGUI/Makefile.am b/src/EntityGUI/Makefile.am index 694c1acaa..4a43d7283 100644 --- a/src/EntityGUI/Makefile.am +++ b/src/EntityGUI/Makefile.am @@ -83,6 +83,7 @@ libEntityGUI_la_CPPFLAGS = \ $(GUI_CXXFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ + $(OPENCV_INCLUDES) \ -I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../DlgRef \ -I$(srcdir)/../GEOMBase \ @@ -93,9 +94,7 @@ libEntityGUI_la_CPPFLAGS = \ -I$(srcdir)/../SKETCHER \ -I$(srcdir)/../GEOM \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I/home/palmco/OpenCV/OpenCV-2.3.0/install/include/opencv \ - -I/home/palmco/OpenCV/OpenCV-2.3.0/install/include + -I$(top_builddir)/idl libEntityGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ @@ -104,5 +103,4 @@ libEntityGUI_la_LDFLAGS = \ ../GEOMGUI/libGEOM.la \ $(QT_MT_LIBS) \ $(CAS_TKTopAlgo) -lTKernel \ - -L/home/palmco/OpenCV/OpenCV-2.3.0/install/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann - + $(OPENCV_LIBS) diff --git a/src/GEOMGUI/Makefile.am b/src/GEOMGUI/Makefile.am index 5ca89f58f..305b4e856 100644 --- a/src/GEOMGUI/Makefile.am +++ b/src/GEOMGUI/Makefile.am @@ -75,8 +75,8 @@ libGEOM_la_CPPFLAGS = \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMImpl \ - -I$(top_builddir)/idl \ - -I$(top_builddir) \ + -I$(top_builddir)/idl \ + -I$(top_builddir) \ -I/home/palmco/OpenCV/OpenCV-2.3.0/install/include/opencv \ -I/home/palmco/OpenCV/OpenCV-2.3.0/install/include -- 2.39.2