]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
rnc : added a macro .m4 for detection of the opencv library
authorgdd <gdd>
Tue, 13 Sep 2011 14:26:28 +0000 (14:26 +0000)
committergdd <gdd>
Tue, 13 Sep 2011 14:26:28 +0000 (14:26 +0000)
adm_local/unix/config_files/check_OpenCV.m4 [new file with mode: 0644]
configure.ac
src/EntityGUI/Makefile.am
src/GEOMGUI/Makefile.am

diff --git a/adm_local/unix/config_files/check_OpenCV.m4 b/adm_local/unix/config_files/check_OpenCV.m4
new file mode 100644 (file)
index 0000000..02b9e48
--- /dev/null
@@ -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
index 15d84b478f8c5ac63cdce3ccd9ca86ddd4dc140d..24a133154a9811e2c84b33875004145b98ed6f6b 100644 (file)
@@ -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
index 694c1acaab6587d849d52599f5cf173dd5e5c614..4a43d72837c9a466cf127cfc8f5986f60c6804e1 100644 (file)
@@ -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)
index 5ca89f58f2124c52c6ca017d2aafb3afa62f4e5a..305b4e85618c6b8ad34943d9eb65a6446b369cbe 100644 (file)
@@ -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