#!/bin/sh
set -e

# Create a simple C++ source file that uses OMPL.
cat <<'EOF' > test_ompl.cpp
#include <ompl/base/StateSpace.h>
#include <ompl/base/spaces/RealVectorStateSpace.h>
#include <iostream>

int main() {
    // Create a 3-dimensional state space
    auto space = std::make_shared<ompl::base::RealVectorStateSpace>(3);
    std::cout << "Successfully created a " 
              << space->getDimension() 
              << "-dimensional state space." << std::endl;
    return 0;
}
EOF

# Compile the test program.
# It is best practice to use pkg-config so that the proper include and library flags are set.
g++ -o test_ompl test_ompl.cpp $(pkg-config --cflags --libs ompl)
echo "build: OK"
[ -x test_ompl ]
./test_ompl
echo "run: OK"
