#!/bin/sh
# autopkgtest check: Build and run a program against urdfdom,
# to verify that the headers and pkg-config file are installed
# correctly
# (C) 2013 Thomas Moulard
# Author: Thomas Moulard <thomas.moulard@gmail.com>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > urdfdomtest.cpp
#include <urdf_parser/urdf_parser.h>

int main()
{
    try {
    urdf::parseURDF("<robot name=''><link name='dummy'/></robot>");
    } catch (...) { }
    return 0;
}
EOF

g++ -o urdfdomtest urdfdomtest.cpp \
    `pkg-config --cflags --libs urdfdom`
echo "build: OK"
[ -x urdfdomtest ]
./urdfdomtest
echo "run: OK"
