#!/bin/bash

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 
# Downloads shaderc from github into contrib/
# 
# Last changed: 24/11/23 (DD/MM/YY)
# 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


SHADERC_VER=v2023.7
SHADERC_REPO=https://github.com/google/shaderc.git

# Check if we are beeing run from scripts/ or from root
if [ ! -f meson.build ]; then
    cd ..
fi

git clone --quiet $SHADERC_REPO contrib/shaderc
pushd contrib/shaderc
git checkout --quiet $SHADERC_VER
python3 ./utils/git-sync-deps
rmdir -rf .git

mkdir build-linux
pushd build-linux
cmake ..
cmake --build . --config Release
popd

popd
