2024-01-11 14:08:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-08-07 13:15:59 +00:00
|
|
|
## This script sets up limboai project for development with GDExtension.
|
|
|
|
## It adds missing files to the demo project for development with GDExtension, and downloads godot-cpp.
|
|
|
|
## Tested only on Unix-likes. You can perform similar steps manually, if you are on Windows. Check Overview below.
|
2024-01-11 14:08:11 +00:00
|
|
|
##
|
|
|
|
## Instructions:
|
2024-08-07 13:15:59 +00:00
|
|
|
## 1) Clone the limboai repository:
|
2024-01-11 14:08:11 +00:00
|
|
|
## git clone https://github.com/limbonaut/limboai
|
2024-08-07 13:15:59 +00:00
|
|
|
## 2) From the limboai root directory, run:
|
|
|
|
## bash ./gdextension/setup_gdextension.sh
|
2024-01-11 14:08:11 +00:00
|
|
|
##
|
2024-08-07 13:15:59 +00:00
|
|
|
## Overview:
|
|
|
|
## limboai/ -- LimboAI repository after you clone it - call this script from here.
|
|
|
|
## limboai/godot-cpp/ -- git repo that will be cloned by this script, unless already exists.
|
|
|
|
## limboai/demo/addons/limboai/limboai.gdextension -- symbolic link created (leads to limboai/gdextension/limboai.gdextension).
|
|
|
|
## limboai/demo/addons/limboai/icons/ -- symbolic link created (leads to limboai/icons/).
|
2024-02-18 21:51:22 +00:00
|
|
|
##
|
2024-08-07 13:15:59 +00:00
|
|
|
## Note: Script creates symbolic links unless --copy-all is set, in which case it copies the files.
|
2024-01-11 14:08:11 +00:00
|
|
|
##
|
2024-08-07 13:15:59 +00:00
|
|
|
## Dependencies: bash, git, python3, trash (optional).
|
2024-01-11 14:08:11 +00:00
|
|
|
|
|
|
|
# Script Settings
|
|
|
|
GODOT_CPP_VERSION=4.2
|
|
|
|
PYTHON=python
|
|
|
|
|
|
|
|
# Colors
|
|
|
|
HIGHLIGHT_COLOR='\033[1;36m' # Light Cyan
|
|
|
|
NC='\033[0m' # No Color
|
|
|
|
ERROR_COLOR="\033[0;31m" # Red
|
|
|
|
|
2024-08-07 13:15:59 +00:00
|
|
|
usage() { echo "Usage: $0 [--copy-all] [--trash-old]"; }
|
2024-01-16 09:21:51 +00:00
|
|
|
|
2024-01-11 14:08:11 +00:00
|
|
|
msg () { echo -e "$@"; }
|
|
|
|
highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; }
|
|
|
|
error () { echo -e "${ERROR_COLOR}$@${NC}" >&2; }
|
|
|
|
|
2024-08-07 13:15:59 +00:00
|
|
|
if [ ! -d "${PWD}/demo/" ]; then
|
|
|
|
error Aborting: \"demo\" subdirectory is not found.
|
|
|
|
msg Tip: Run this script from the limboai root directory.
|
|
|
|
msg Command: bash ./gdextension/setup_gdextension.sh
|
2024-01-11 14:08:11 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Interrupt execution and exit on Ctrl-C
|
|
|
|
trap exit SIGINT
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-01-17 11:01:13 +00:00
|
|
|
copy_all=0
|
|
|
|
trash_old=0
|
2024-01-16 09:21:51 +00:00
|
|
|
|
|
|
|
# Parsing arguments
|
|
|
|
for i in "$@"
|
|
|
|
do
|
|
|
|
case "${i}" in
|
2024-01-17 11:01:13 +00:00
|
|
|
--copy-all)
|
|
|
|
copy_demo=1
|
|
|
|
copy_all=1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--trash-old)
|
|
|
|
trash_old=1
|
|
|
|
shift
|
|
|
|
;;
|
2024-01-16 09:21:51 +00:00
|
|
|
*)
|
|
|
|
usage
|
2024-01-17 11:01:13 +00:00
|
|
|
exit 1
|
2024-01-16 09:21:51 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2024-01-11 14:08:11 +00:00
|
|
|
highlight Setup started.
|
|
|
|
|
2024-08-07 13:15:59 +00:00
|
|
|
${PYTHON} gdextension/update_icons.py --silent
|
2024-01-17 16:54:20 +00:00
|
|
|
highlight -- Icon declarations updated.
|
|
|
|
|
2024-01-17 11:01:13 +00:00
|
|
|
transfer="ln -s"
|
|
|
|
transfer_word="Linked"
|
|
|
|
if [ ${copy_all} == 1 ]; then
|
|
|
|
transfer="cp -R"
|
|
|
|
transfer_word="Copied"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${trash_old} == 1 ]; then
|
|
|
|
if ! command -v trash &> /dev/null; then
|
|
|
|
error trash command not available. Aborting.
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-08-07 13:15:59 +00:00
|
|
|
trash demo/addons/limboai || /bin/true
|
2024-01-17 11:01:13 +00:00
|
|
|
highlight -- Trashed old setup.
|
|
|
|
fi
|
|
|
|
|
2024-01-11 14:08:11 +00:00
|
|
|
if [ ! -d "${PWD}/godot-cpp/" ]; then
|
|
|
|
highlight -- Cloning godot-cpp...
|
|
|
|
git clone -b ${GODOT_CPP_VERSION} https://github.com/godotengine/godot-cpp
|
|
|
|
highlight -- Finished cloning godot-cpp.
|
|
|
|
else
|
|
|
|
highlight -- Skipping \"godot-cpp\". Directory already exists!
|
|
|
|
fi
|
|
|
|
|
2024-01-17 11:01:13 +00:00
|
|
|
if [ ! -e "${PWD}/demo/addons/limboai/bin/limboai.gdextension" ]; then
|
|
|
|
mkdir -p ./demo/addons/limboai/bin/
|
|
|
|
cd ./demo/addons/limboai/bin/
|
2024-08-07 13:15:59 +00:00
|
|
|
${transfer} ../../../../gdextension/limboai.gdextension limboai.gdextension
|
2024-01-11 19:16:00 +00:00
|
|
|
cd -
|
2024-01-17 11:01:13 +00:00
|
|
|
highlight -- ${transfer_word} limboai.gdextension.
|
2024-01-11 14:08:11 +00:00
|
|
|
else
|
|
|
|
highlight -- Skipping limboai.gdextension. File already exists!
|
|
|
|
fi
|
|
|
|
|
2024-01-17 11:01:13 +00:00
|
|
|
if [ ! -e "${PWD}/demo/addons/limboai/icons/" ]; then
|
|
|
|
cd ./demo/addons/limboai/
|
2024-08-07 13:15:59 +00:00
|
|
|
${transfer} ../../../icons icons
|
2024-01-11 19:16:00 +00:00
|
|
|
cd -
|
2024-01-17 11:01:13 +00:00
|
|
|
highlight -- ${transfer_word} icons.
|
2024-01-11 16:06:06 +00:00
|
|
|
else
|
2024-01-17 11:01:13 +00:00
|
|
|
highlight -- Skipping icons. File already exists!
|
2024-01-11 16:06:06 +00:00
|
|
|
fi
|
|
|
|
|
2024-01-11 14:08:11 +00:00
|
|
|
highlight Setup complete.
|