Skip to content

Instantly share code, notes, and snippets.

@wil92
Created November 5, 2021 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wil92/fc5d203753d3d290d80135e534462a99 to your computer and use it in GitHub Desktop.
Save wil92/fc5d203753d3d290d80135e534462a99 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
HELP=$(cat <<-END
Usage: ./setup-ogre.sh [OGRE_VERSION_TAG]
Setup Ogre in the system given the tag version.
OGRE_VERSION_TAG: default value is master
.
END
)
is_package_installed() {
PACKAGE=$1;
IS_INSTALL=$(dpkg-query -W --showformat='${Status}\n' $PACKAGE | grep "install ok installed")
echo $(if [ "$IS_INSTALL" = "install ok installed" ]; then echo "yes"; else echo "no"; fi)
}
if [ "$1" = "-h" ] || [ "$1" = "help" ]; then
echo "$HELP"
else
# Set ogre version
OGRE_VERSION_TAG="${OGRE_VERSION_TAG:-master}";
echo "Ogre version: $OGRE_VERSION_TAG"
# Install dependencies if is needed
DEPENDENCIES=(libgles2-mesa-dev libsdl2-dev libxt-dev libxaw7-dev doxygen zziplib-bin cmake-qt-gui cmake git build-essential g++)
for i in "${DEPENDENCIES[@]}"; do
if [ "$(is_package_installed $i)" = "no" ]; then
echo $i
sudo apt install -y $i
fi
done
git clone https://github.com/OGRECave/ogre.git
cd ogre
git checkout $OGRE_VERSION_TAG
# Build ogre
cmake .
cmake --build . --config Release
# Install ogre
sudo cmake --build . --config Release --target install
# Remove ogre repo
cd ..
rm -rf ogre
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment