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
|
#!/bin/bash
set -e
if [ -z "${MESON_SOURCE_ROOT}" ]; then
echo "[ERROR] This script can only be ran with meson!"
exit 1
fi
if [ "$#" -lt 1 ]; then
echo "Must provide at least one directory."
echo "get-files <src|include|recipes|examples|tests|wrappers|all>"
exit -1
fi
possible_options=( "src" "include" "recipes" "examples" "tests" "wrappers" "all" )
for arg in "$@"; do
if [[ ! " ${possible_options[*]} " =~ " ${arg} " ]]; then
echo "Each option must be one of the following: src, include, recipes, examples, tests, wrappers, all"
exit -1
fi
done
cd "${MESON_SOURCE_ROOT}"
. scripts/portable_realpath
search_dirs=""
for arg in "$@"; do
case ${arg} in
src)
search_dirs+="src/btllib ";;
include)
search_dirs+="include/btllib ";;
recipes)
search_dirs+="recipes ";;
examples)
search_dirs+="examples ";;
tests)
search_dirs+="tests ";;
wrappers)
search_dirs+="wrappers/python ";;
all)
search_dirs+="src/btllib include/btllib recipes examples tests ";;
*)
echo "Invalid option."
exit -1;;
esac
done
files=$(find ${search_dirs} -type f | grep "\(.*\.h$\)\|\(.*\.hpp$\)\|\(.*\.cpp$\)\|\(.*\.cxx$\)")
for file in $files; do
echo -n "$(portable_realpath $file) "
done
|