summaryrefslogtreecommitdiff
path: root/scripts/generate-core-files.sh
blob: 27754306e169dc1e12280fc425a1ade4fa417b89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

set -e
set -o pipefail

echo "# Do not edit. Regenerate this with ./scripts/generate-core-files.sh" > cmake/core-files.cmake
echo "" >> cmake/core-files.cmake
echo "set(MBGL_CORE_FILES" >> cmake/core-files.cmake
PREFIX=
for FILE in $(git ls-files "include/*.hpp" "include/*.h" "src/*.hpp" "src/*.cpp" "src/*.h" "src/*.c" | perl -p -e "s/^((src|include)\/(mbgl\/)?(.+)\/\w+\.\w+)$/\$4#\$1/g" | sort) ; do
    CURRENT_PREFIX="${FILE%#*}"
    if [ "${PREFIX}" != "${CURRENT_PREFIX}" ]; then
        if [ ! -z "${PREFIX}" ]; then echo "" >> cmake/core-files.cmake ; fi
        echo "    # ${CURRENT_PREFIX}" >> cmake/core-files.cmake
        PREFIX="${CURRENT_PREFIX}"
    fi
    echo "    ${FILE#*#}" >> cmake/core-files.cmake
done
echo ")" >> cmake/core-files.cmake
git diff cmake/core-files.cmake