File: glslang-dev

package info (click to toggle)
glslang 16.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 51,712 kB
  • sloc: cpp: 92,305; yacc: 4,320; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (69 lines) | stat: -rwxr-xr-x 1,347 bytes parent folder | download | duplicates (4)
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
60
61
62
63
64
65
66
67
68
69
#!/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

if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
else
    CROSS_COMPILE=
fi
CXX="${CROSS_COMPILE}g++"
PKG_CONFIG="${CROSS_COMPILE}pkg-config"

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

cat > spirv.cpp <<'EOF'
#include <glslang/SPIRV/GlslangToSpv.h>

int main (void)
{
  std::string s;
  glslang::GetSpirvVersion(s);
  return 0;
}
EOF

# This is hard-coded because there used to be no pkg-config.
"${CXX}" -std=c++17 -o trivial trivial.cpp -lglslang -lMachineIndependent -lGenericCodeGen -lOSDependent -lSPIRV -lpthread
test -x trivial
./trivial

rm trivial

# Or with the pkg-config metadata.
# Deliberately word-splitting the output of pkg-config:
# shellcheck disable=SC2046
"${CXX}" -std=c++17 -o trivial trivial.cpp $("$PKG_CONFIG" --cflags --libs glslang)
test -x trivial
./trivial

# shellcheck disable=SC2046
"${CXX}" -std=c++17 -o spirv spirv.cpp $("$PKG_CONFIG" --cflags --libs spirv)
test -x spirv
./spirv

cd /
rm -fr "$tempdir"