1#!/bin/bash 2# Generate MEX files by compiling from Matlab 3# This scripts intends to automate the compilation process 4# by following the instructions provided in 5# http://laurentkneip.github.io/opengv/page_installation.html#sec_installation_5 6# We assume the installation configuration is standard 7# so that every dependency can be found in an automated way 8 9# We assume a launcher command is available: matlab 10# Add OpenGV library directory to the path 11export LD_LIBRARY_PATH=../build/lib:$LD_LIBRARY_PATH 12 13# Find path to Eigen library (assumes CMake has cached EIGEN_INCLUDE_DIRS) 14# See https://stackoverflow.com/questions/8474753/how-to-get-a-cmake-variable-from-the-command-line 15EigenPath=$(cmake -L ../build | grep EIGEN_INCLUDE_DIRS | cut -d "=" -f2) 16 17# Call Matlab with the compilation command 18matlab -nodisplay -nosplash -nodesktop \ 19-r "mex -I../include -I${EigenPath} -L../build/lib -lopengv opengv.cpp -cxx, mex -I../include -I${EigenPath} -L../build/lib -lopengv opengv_donotuse.cpp -cxx, exit" 20 21 22