Building OpenGazer 0.1.2 on OS X 10.6

by Carson Reynolds

For a project in development we’ve been experimenting with OpenGazer. The system needs a bit of coaxing to work on OS X. To help other folks along here is a Makefile which works with the current version of OpenGazer.

# Before running make you first need to do the following:

# sudo port install vxl gtkmm
# svn co\
# /svnroot/opengazer

VXLLIB = /opt/local/lib/vxl/
VERSION = opengazer-0.1.2
CPPFLAGS = -Wall -g -O3
LINKER = -L$(VXLLIB) -L/opt/local/lib -lm -ldl -lvnl -lmvl -lvnl_algo -lvgl -lgthread-2.0 

INCLUDES = -L/opt/local/lib/vxl/ -I{/usr/local/include,/opt/local/include/vxl}{,/core,/vcl,/contrib/oxl}

sources = opengazer.cpp Calibrator.cpp GazeTrackerGtk.cpp HeadTracker.cpp LeastSquares.cpp EyeExtractor.cpp GazeTracker.cpp MainGazeTracker.cpp OutputMethods.cpp PointTracker.cpp FaceDetector.cpp GazeArea.cpp TrackingSystem.cpp GtkStore.cpp Containers.cpp GraphicalPointer.cpp Point.cpp utils.cpp BlinkDetector.cpp FeatureDetector.cpp Alert.cpp 

objects = $(patsubst %.cpp,%.o,$(sources))

%.o.depends: %.cpp
	g++ -MM $< > $@

%.o: %.cpp 
	g++ -c $(CPPFLAGS) -o $@ `pkg-config cairomm-1.0 opencv gtkmm-2.4 --cflags` $(INCLUDES) $< 

opengazer: 	$(objects)
	g++ $(CPPFLAGS) -o $@ `pkg-config cairomm-1.0 opencv gtkmm-2.4 --libs`  $(LINKER) $^

include $(patsubst %.cpp,%.o.depends,$(sources))

TAGS: always
	etags *.cpp *.h

ship: always
	mkdir $(VERSION) || rm -fr $(VERSION)/*
	cp LICENSE README Makefile calpoints.txt haarcascade_frontalface_alt.xml $$(for file in $$(cat $(addsuffix .depends,$(objects))) ; do test -f $$file && echo $$file ; done | sort -u) $(VERSION)/
	tar czf $(VERSION).tar.gz $(VERSION)
	cp $(VERSION).tar.gz README /home/ftp/pub/www/opengazer/

.PHONY: always ship

	rm -rf opengazer
	rm -rf *.o
	rm -rf *.o.depends