#!/bin/sh
# Copyright  2019 Collabora Ltd.
# SPDX-License-Identifier: MIT
# (see debian/copyright)

# Check that the library can be linked.

set -e
set -u
set -x

tempdir="$(mktemp -d)"
cd "$tempdir"

cat > trivial.cpp <<'EOF'
#undef NDEBUG
#include <cassert>

#include <glslang/Public/ShaderLang.h>

int main (void)
{
  ShHandle handle;
  handle = ShConstructUniformMap();
  ShDestruct(handle);
  return 0;
}
EOF

# This is hard-coded because there's no pkg-config, but that matches
# what renderdoc does...
c++ -std=c++11 -o trivial trivial.cpp -lglslang -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
test -x trivial
./trivial

cd /
rm -fr "$tempdir"
