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 48 49 50 51 52 53 54 55 56 57 58 59
|
#!/bin/sh
# autopkgtest check
# (C) 2014 Anton Gladky
set -e
export OMPI_MCA_orte_rsh_agent=/bin/false
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
mkdir src
cd src
cat <<EOF > CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(demo)
find_package(VTK REQUIRED vtkCommonCore vtkIOImage vtkIOXML vtkRenderingOpenGL2 vtkIOLegacy)
include(\${VTK_USE_FILE})
add_executable(demo demo.cpp)
target_link_libraries(demo \${VTK_LIBRARIES})
install(TARGETS demo DESTINATION bin)
EOF
cat <<EOF > demo.cpp
#include <vtkMath.h>
int main(int, char *[])
{
// Create two points.
double p0[3] = {0.0, 0.0, 0.0};
double p1[3] = {1.0, 1.0, 1.0};
// Find the squared distance between the points.
double squaredDistance = vtkMath::Distance2BetweenPoints(p0, p1);
// Take the square root to get the Euclidean distance between the points.
double distance = sqrt(squaredDistance);
// Output the results.
std::cout << "SquaredDistance = " << squaredDistance << std::endl;
std::cout << "Distance = " << distance << std::endl;
return EXIT_SUCCESS;
}
EOF
cd ..
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=./../inst ./../src
make
make install
echo "build: OK"
[ -x demo ]
./demo
echo "run: OK"
|