Clone godot-cpp if not found during scons build

This commit is contained in:
Serhii Snitsaruk 2024-08-09 14:13:01 +02:00
parent 80e3ff705d
commit 1e1fb5adaf
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
3 changed files with 28 additions and 19 deletions

View File

@ -101,18 +101,11 @@ LimboAI can be used as either a C++ module or as a GDExtension shared library. G
#### For GDExtension #### 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). - You'll need SCons build tool and a C++ compiler. See also [Compiling](https://docs.godotengine.org/en/stable/contributing/development/compiling/index.html).
- Clone godot-cpp repository into `limboai/godot-cpp/` directory, and switch to a supported release tag or branch.
- Run `scons target=editor` to build the plugin library for your current platform. - 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/` - By default, built targets are placed in the demo project: `demo/addons/limboai/bin/`
- Check `scons -h` for other options and targets. - Check `scons -h` for other options and targets.
```bash
git clone https://github.com/limbonaut/limboai
cd limboai/
git clone -b master https://github.com/godotengine/godot-cpp.git
scons target=editor
```
## 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)

View File

@ -1,15 +1,32 @@
#!/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
# This is SConstruct file for building GDExtension variant using SCons build system. # Check if godot-cpp/ exists
# For module variant, see SCsub file. if not os.path.exists("godot-cpp"):
print("Directory godot-cpp/ not found. Cloning repository...")
# Use --project=DIR to customize output path for built targets. result = subprocess.run(
# - Built targets are placed into "DIR/addons/limboai/bin". ["git", "clone", "-b", godot_cpp_ref, "https://github.com/godotengine/godot-cpp.git"],
# - For example: scons --project="../my_project" check=True,
# - built targets will be placed into "../my_project/addons/limboai/bin". # capture_output=True
# - 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",
@ -32,7 +49,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(1) Exit(2)
# Parse LimboAI-specific variables. # Parse LimboAI-specific variables.
vars = Variables() vars = Variables()
@ -63,8 +80,6 @@ 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()

View File

@ -5,6 +5,7 @@ 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