1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#!/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 pkg-config: OK"
[ -x urdfdomtest ]
./urdfdomtest
echo "run: OK"
cat <<EOF > CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
project(urdfdomtest VERSION 1.0.0)
find_package(urdfdom REQUIRED)
add_executable(urdfdomtest urdfdomtest.cpp)
target_link_libraries(urdfdomtest urdfdom::urdfdom_model)
EOF
cmake .
VERBOSE=1 make
echo "build cmake: OK"
[ -x urdfdomtest ]
./urdfdomtest
echo "run: OK"
|