Compare commits
1 Commits
c2a1c33878
...
49005755dc
Author | SHA1 | Date |
---|---|---|
Serhii Snitsaruk | 49005755dc |
10
README.md
10
README.md
|
@ -93,19 +93,13 @@ LimboAI can be used as either a C++ module or as a GDExtension shared library. G
|
||||||
|
|
||||||
### Compiling from source
|
### Compiling from source
|
||||||
|
|
||||||
|
>**🛈 For GDExtension:** Refer to comments in [setup_gdextension.sh](./gdextension/setup_gdextension.sh) file.
|
||||||
|
|
||||||
- Download the Godot Engine source code and put this module source into the `modules/limboai` directory.
|
- Download the Godot Engine source code and put this module source into the `modules/limboai` directory.
|
||||||
- Consult the Godot Engine documentation for instructions on [how to build from source code](https://docs.godotengine.org/en/stable/contributing/development/compiling/index.html).
|
- Consult the Godot Engine documentation for instructions on [how to build from source code](https://docs.godotengine.org/en/stable/contributing/development/compiling/index.html).
|
||||||
- If you plan to export a game utilizing the LimboAI module, you'll also need to build export templates.
|
- If you plan to export a game utilizing the LimboAI module, you'll also need to build export templates.
|
||||||
- To execute unit tests, compile the engine with `tests=yes` and run it with `--test --tc="*[LimboAI]*"`.
|
- To execute unit tests, compile the engine with `tests=yes` and run it with `--test --tc="*[LimboAI]*"`.
|
||||||
|
|
||||||
#### For GDExtension
|
|
||||||
|
|
||||||
- You'll need SCons build tool and a C++ compiler. See also [Compiling](https://docs.godotengine.org/en/stable/contributing/development/compiling/index.html).
|
|
||||||
- Run `scons target=editor` to build the plugin library for your current platform.
|
|
||||||
- SCons will automatically clone the godot-cpp/ repository if it doesn't already exist in the `limboai/godot-cpp` directory.
|
|
||||||
- By default, built targets are placed in the demo project: `demo/addons/limboai/bin/`
|
|
||||||
- Check `scons -h` for other options and targets.
|
|
||||||
|
|
||||||
## Using the plugin
|
## Using the plugin
|
||||||
|
|
||||||
- [Online Documentation](https://limboai.readthedocs.io/en/latest/index.html)
|
- [Online Documentation](https://limboai.readthedocs.io/en/latest/index.html)
|
||||||
|
|
37
SConstruct
37
SConstruct
|
@ -1,32 +1,15 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
|
||||||
This is SConstruct file for building GDExtension variant using SCons build system.
|
|
||||||
For module variant, see SCsub file.
|
|
||||||
|
|
||||||
Use --project=DIR to customize output path for built targets.
|
|
||||||
- Built targets are placed into "DIR/addons/limboai/bin".
|
|
||||||
- For example: scons --project="../my_project"
|
|
||||||
- built targets will be placed into "../my_project/addons/limboai/bin".
|
|
||||||
- If not specified, built targets are put into the demo/ project.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
|
||||||
from limboai_version import generate_module_version_header, godot_cpp_ref
|
|
||||||
|
|
||||||
# Check if godot-cpp/ exists
|
# This is SConstruct file for building GDExtension variant using SCons build system.
|
||||||
if not os.path.exists("godot-cpp"):
|
# For module variant, see SCsub file.
|
||||||
print("Directory godot-cpp/ not found. Cloning repository...")
|
|
||||||
result = subprocess.run(
|
# Use --project=DIR to customize output path for built targets.
|
||||||
["git", "clone", "-b", godot_cpp_ref, "https://github.com/godotengine/godot-cpp.git"],
|
# - Built targets are placed into "DIR/addons/limboai/bin".
|
||||||
check=True,
|
# - For example: scons --project="../my_project"
|
||||||
# capture_output=True
|
# - built targets will be placed into "../my_project/addons/limboai/bin".
|
||||||
)
|
# - If not specified, built targets are put into the demo/ project.
|
||||||
if result.returncode != 0:
|
|
||||||
print("Error: Cloning godot-cpp repository failed.")
|
|
||||||
Exit(1)
|
|
||||||
print("Finished cloning godot-cpp repository.")
|
|
||||||
|
|
||||||
AddOption(
|
AddOption(
|
||||||
"--project",
|
"--project",
|
||||||
|
@ -49,7 +32,7 @@ Help(help_text)
|
||||||
project_dir = GetOption("project")
|
project_dir = GetOption("project")
|
||||||
if not os.path.isdir(project_dir):
|
if not os.path.isdir(project_dir):
|
||||||
print("Project directory not found: " + project_dir)
|
print("Project directory not found: " + project_dir)
|
||||||
Exit(2)
|
Exit(1)
|
||||||
|
|
||||||
# Parse LimboAI-specific variables.
|
# Parse LimboAI-specific variables.
|
||||||
vars = Variables()
|
vars = Variables()
|
||||||
|
@ -80,6 +63,8 @@ for o in vars.options:
|
||||||
env = SConscript("godot-cpp/SConstruct")
|
env = SConscript("godot-cpp/SConstruct")
|
||||||
|
|
||||||
# Generate version header.
|
# Generate version header.
|
||||||
|
from limboai_version import generate_module_version_header
|
||||||
|
|
||||||
print("Generating LimboAI version header...")
|
print("Generating LimboAI version header...")
|
||||||
generate_module_version_header()
|
generate_module_version_header()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
##
|
||||||
|
## Instructions:
|
||||||
|
## 1) Clone the limboai repository:
|
||||||
|
## git clone https://github.com/limbonaut/limboai
|
||||||
|
## 2) From the limboai root directory, run:
|
||||||
|
## bash ./gdextension/setup_gdextension.sh
|
||||||
|
##
|
||||||
|
## 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/).
|
||||||
|
##
|
||||||
|
## Note: Script creates symbolic links unless --copy-all is set, in which case it copies the files.
|
||||||
|
##
|
||||||
|
## Dependencies: bash, git, python3, trash (optional).
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
usage() { echo "Usage: $0 [--copy-all] [--trash-old]"; }
|
||||||
|
|
||||||
|
msg () { echo -e "$@"; }
|
||||||
|
highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; }
|
||||||
|
error () { echo -e "${ERROR_COLOR}$@${NC}" >&2; }
|
||||||
|
|
||||||
|
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
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Interrupt execution and exit on Ctrl-C
|
||||||
|
trap exit SIGINT
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
copy_all=0
|
||||||
|
trash_old=0
|
||||||
|
|
||||||
|
# Parsing arguments
|
||||||
|
for i in "$@"
|
||||||
|
do
|
||||||
|
case "${i}" in
|
||||||
|
--copy-all)
|
||||||
|
copy_demo=1
|
||||||
|
copy_all=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--trash-old)
|
||||||
|
trash_old=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
highlight Setup started.
|
||||||
|
|
||||||
|
${PYTHON} gdextension/update_icon_entries.py --silent
|
||||||
|
highlight -- Icon declarations updated.
|
||||||
|
|
||||||
|
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
|
||||||
|
trash demo/addons/limboai || /bin/true
|
||||||
|
highlight -- Trashed old setup.
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if [ ! -e "${PWD}/demo/addons/limboai/bin/limboai.gdextension" ]; then
|
||||||
|
mkdir -p ./demo/addons/limboai/bin/
|
||||||
|
cd ./demo/addons/limboai/bin/
|
||||||
|
${transfer} ../../../../gdextension/limboai.gdextension limboai.gdextension
|
||||||
|
cd -
|
||||||
|
highlight -- ${transfer_word} limboai.gdextension.
|
||||||
|
else
|
||||||
|
highlight -- Skipping limboai.gdextension. File already exists!
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${PWD}/demo/addons/limboai/icons/" ]; then
|
||||||
|
cd ./demo/addons/limboai/
|
||||||
|
${transfer} ../../../icons icons
|
||||||
|
cd -
|
||||||
|
highlight -- ${transfer_word} icons.
|
||||||
|
else
|
||||||
|
highlight -- Skipping icons. File already exists!
|
||||||
|
fi
|
||||||
|
|
||||||
|
highlight Setup complete.
|
|
@ -5,7 +5,6 @@ minor = 2
|
||||||
patch = 0
|
patch = 0
|
||||||
status = "dev"
|
status = "dev"
|
||||||
doc_branch = "latest"
|
doc_branch = "latest"
|
||||||
godot_cpp_ref = "master"
|
|
||||||
|
|
||||||
# Code that generates version header
|
# Code that generates version header
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue