The open source OpenXR runtime
1#!/bin/sh
2# Copyright 2019, Collabora, Ltd.
3# SPDX-License-Identifier: BSL-1.0
4# Author: Ryan Pavlik <ryan.pavlik@collabora.com>
5
6# Formats all the source files in this project
7
8set -e
9
10if [ ! "${CLANGFORMAT}" ]; then
11 for fn in clang-format-11 clang-format-10 clang-format-9 clang-format-8 clang-format-7 clang-format-6.0 clang-format; do
12 if command -v $fn > /dev/null; then
13 CLANGFORMAT=$fn
14 break
15 fi
16 done
17fi
18
19if [ ! "${CLANGFORMAT}" ]; then
20 echo "We need some version of clang-format, please install one!" 1>&2
21 exit 1
22fi
23
24(
25 cd $(dirname $0)/..
26 find \
27 src/xrt/auxiliary \
28 src/xrt/compositor \
29 src/xrt/drivers \
30 src/xrt/include \
31 src/xrt/ipc \
32 src/xrt/state_trackers \
33 src/xrt/targets \
34 tests \
35 \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) \
36 -exec ${CLANGFORMAT} -i -style=file \{\} +
37)