mirror of
				https://github.com/bspeice/libcvautomation
				synced 2025-11-04 02:10:35 -05:00 
			
		
		
		
	Fix the build process to support OpenCV 2 (Ubuntu)
This commit is contained in:
		
							
								
								
									
										13
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								configure.ac
									
									
									
									
									
								
							@ -27,7 +27,18 @@ AC_PATH_X
 | 
			
		||||
#AC_CHECK_HEADER(opencv/highgui.h)
 | 
			
		||||
#AC_CHECK_HEADER(X11/Xlib.h)
 | 
			
		||||
#AC_CHECK_HEADER(X11/Xutil.h)
 | 
			
		||||
PKG_CHECK_MODULES([OpenCV], [opencv >= 1.0.0])
 | 
			
		||||
 | 
			
		||||
#Configure OpenCV - version 2+ breaks a lot of things
 | 
			
		||||
PKG_CHECK_MODULES([OpenCV], [opencv >= 2.0.0], [use_opencv2=true], [use_opencv1=true])
 | 
			
		||||
if test "$use_opencv2" != ""; then
 | 
			
		||||
	AM_CONDITIONAL(USEOPENCV2, true)
 | 
			
		||||
	AC_DEFINE(USEOPENCV2)
 | 
			
		||||
fi
 | 
			
		||||
if test "$use_opencv1" != ""; then
 | 
			
		||||
	echo "could not find OpenCV version 2.0.0 or higher, checking for 1.0.0 or higher..."
 | 
			
		||||
	PKG_CHECK_MODULES([OpenCV], [opencv >= 1.0.0])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
PKG_CHECK_MODULES([X11], [x11 >= 1.0.3])
 | 
			
		||||
 | 
			
		||||
AC_ARG_WITH(examples, [  --with-examples         build example programs '['default=yes']'])
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,10 @@
 | 
			
		||||
#Need to include the -Ilibcvautomation so that libcvautomation.h can find everything that it needs
 | 
			
		||||
AM_CFLAGS = -Wall -O2 -I$(top_srcdir)/include #-I$(top_srcdir)/include/libcvautomation
 | 
			
		||||
if USEOPENCV2
 | 
			
		||||
AM_LDFLAGS = -L../libcvautomation/.libs -lcvautomation `pkg-config --libs x11` -lopencv_imgproc -lopencv_core -lopencv_highgui
 | 
			
		||||
else
 | 
			
		||||
AM_LDFLAGS = -L../libcvautomation/.libs -lcvautomation `pkg-config --libs x11` `pkg-config --libs opencv`
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
#Build only if we're building the examples
 | 
			
		||||
bin_PROGRAMS = cva-match
 | 
			
		||||
 | 
			
		||||
@ -21,10 +21,19 @@
 | 
			
		||||
/* C includes */
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#ifdef USEOPENCV2
 | 
			
		||||
/* OpenCV2 includes - some filenames are different */
 | 
			
		||||
#include <opencv2/core/core_c.h>
 | 
			
		||||
#include <opencv2/highgui/highgui_c.h>
 | 
			
		||||
#include <opencv2/imgproc/imgproc_c.h>
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
/* OpenCV includes */
 | 
			
		||||
#include <opencv/cv.h>
 | 
			
		||||
#include <opencv/highgui.h>
 | 
			
		||||
 | 
			
		||||
#endif /* #ifdef OPENCV2 */
 | 
			
		||||
 | 
			
		||||
/* X11 includes */
 | 
			
		||||
#include <X11/Xlib.h>
 | 
			
		||||
#include <X11/Xutil.h>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user