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
|
#!/bin/sh
# autopkgtest check: Build and run a program against glib, to verify that the
# headers and pkg-config file are installed correctly
# (C) 2012 Jose Luis Rivero
# Author: Jose Luis Rivero <jrivero@osrfoundation.org>
set -e
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > simbodytest.c
#include "Simbody.h"
using namespace SimTK;
int main()
{
// Create the system, with subsystems for the bodies and some forces.
MultibodySystem system;
SimbodyMatterSubsystem matter(system);
GeneralForceSubsystem forces(system);
// Add gravity as a force element.
Rotation x45(Pi/4, XAxis);
Rotation y45(Pi/4, YAxis);
Rotation z45(Pi/4, ZAxis);
Force::UniformGravity gravity(forces, matter, Vec3(10, Real(-9.8), 3));
// Create the body and some artwork for it.
Body::Rigid pendulumBody(MassProperties(1.0, Vec3(0), Inertia(1)));
pendulumBody.addDecoration(Transform(),
DecorativeSphere(Real(0.1)).setColor(Red));
return 0;
}
EOF
g++ -o simbodytest simbodytest.c `pkg-config --cflags --libs simbody` 2>&1
echo "build: OK"
[ -x simbodytest ]
./simbodytest
echo "run: OK"
|