Pam Face Authentication Musings : Autotools and Qt Gui Project

Qt projects are usually packaged using a nice utility called qmake.But i am more comfortable with the autotools way. So after some intensive google searching. I finally figure out how to add the UIC (User Interface (.ui) to C Code) and MOC (Meta Object Compiler - which handles the signals and slots)

Configure.ac
  

# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.50)
AC_INIT(pam-face-authentication, 0.3,[http://code.google.com/p/pam_face_authentication/issues/list])
#AC_CONFIG_SRCDIR([pam_face_defines.h])
AM_INIT_AUTOMAKE([1.10.1])

AM_CONFIG_HEADER([config.h])


# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LIBTOOL

# Checks for libraries.

AC_CHECK_HEADER(X11/Xlib.h, check_x11="yes",check_x11="no")
if test x${check_x11} = xno ; then
AC_MSG_ERROR([X11/Xlib.h Not Found.])

fi
if test x${check_x11} = xyes ; then
AC_CHECK_LIB(X11, XOpenDisplay,
[ X11_LIBS="-lX11"
AC_DEFINE(USE_X11, 1, [Define to use X11 copy'n'paste]) ],
[])
AC_SUBST(X11_LIBS)

fi


AC_CHECK_LIB(pam, pam_start, ,AC_MSG_ERROR([PAM library missing]))
AC_CHECK_LIB([pam], [main],,AC_MSG_ERROR(libpam-devel >.99.8 Not Found))
AC_CHECK_HEADER([security/pam_modules.h], ,[AC_MSG_ERROR([PAM headers missing])])

PKG_CHECK_MODULES(QTGUI, QtGui)
AC_SUBST(QTGUI_CFLAGS)
AC_SUBST(QTGUI_LIBS)

PKG_CHECK_MODULES(QTCORE, QtCore)
AC_SUBST(QTCORE_CFLAGS)
AC_SUBST(QTCORE_LIBS)

PKG_CHECK_MODULES(OPENCV, opencv >= 1.0.0)
AC_SUBST(OPENCV_CFLAGS)
AC_SUBST(OPENCV_LIBS)

AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT


Makefile.am

  

DEBUG = -g -O0
INCLUDES = \
-DVERSION=\"".3"\" \
-DPKGDATADIR=\""$(pkgdatadir)"\" \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
$(OPENCV_CFLAGS) \
$(QTCORE_CFLAGS) \
$(QTGUI_CFLAGS)

bin_PROGRAMS = qt-facemanager
qt_facemanager_LDFLAGS = -export-dynamic
qt_facemanager_SOURCES = main.cpp \
qrc_graphics.cpp \
opencvWebcam.cpp \
detector.cpp \
detector.h\
faceDetector.cpp \
faceDetector.h \
eyesDetector.cpp \
eyesDetector.h \
tracker.cpp \
tracker.h \
utils.cpp \
opencvWebcam.h \
faceTrainer.h \
faceTrainerAdvSettings.h \
ui_faceTrainerAdvSettings.h \
ui_faceTrainer.h

qt_facemanager_LDADD = \
$(QTCORE_LIBS) \
$(OPENCV_LIBS) \
$(QTGUI_LIBS)

nodist_qt_facemanager_SOURCES = \
moc_faceTrainer.cpp \
moc_faceTrainerAdvSettings.cpp

#put this file in the package
EXTRA_DIST = \
graphics.qrc


# Convert %.ui files into ui_%.h
ui_%.h: %.ui
uic $< -o $@

# Create moc_%.cpp from *.h
moc_%.cpp: %.h
moc $< -o $@

qrc_graphics.cpp : graphics.qrc
rcc -name graphics graphics.qrc -o qrc_graphics.cpp


CLEANFILES =$(nodist_qt_facemanager_SOURCES) ui_faceTrainerAdvSettings.h ui_faceTrainer.h qrc_graphics.cpp



Orignal from http://qtnode.net/wiki?title=Qt_with_autotools

1 comments:

Ashish said...

why is this post of yours not in English?