Clone godot-cpp if not found during scons build
This commit is contained in:
parent
80e3ff705d
commit
1e1fb5adaf
|
@ -101,18 +101,11 @@ LimboAI can be used as either a C++ module or as a GDExtension shared library. G
|
|||
#### 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).
|
||||
- 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.
|
||||
- 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.
|
||||
|
||||
```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
|
||||
|
||||
- [Online Documentation](https://limboai.readthedocs.io/en/latest/index.html)
|
||||
|
|
37
SConstruct
37
SConstruct
|
@ -1,15 +1,32 @@
|
|||
#!/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 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.
|
||||
# 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.
|
||||
# Check if godot-cpp/ exists
|
||||
if not os.path.exists("godot-cpp"):
|
||||
print("Directory godot-cpp/ not found. Cloning repository...")
|
||||
result = subprocess.run(
|
||||
["git", "clone", "-b", godot_cpp_ref, "https://github.com/godotengine/godot-cpp.git"],
|
||||
check=True,
|
||||
# capture_output=True
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("Error: Cloning godot-cpp repository failed.")
|
||||
Exit(1)
|
||||
print("Finished cloning godot-cpp repository.")
|
||||
|
||||
AddOption(
|
||||
"--project",
|
||||
|
@ -32,7 +49,7 @@ Help(help_text)
|
|||
project_dir = GetOption("project")
|
||||
if not os.path.isdir(project_dir):
|
||||
print("Project directory not found: " + project_dir)
|
||||
Exit(1)
|
||||
Exit(2)
|
||||
|
||||
# Parse LimboAI-specific variables.
|
||||
vars = Variables()
|
||||
|
@ -63,8 +80,6 @@ for o in vars.options:
|
|||
env = SConscript("godot-cpp/SConstruct")
|
||||
|
||||
# Generate version header.
|
||||
from limboai_version import generate_module_version_header
|
||||
|
||||
print("Generating LimboAI version header...")
|
||||
generate_module_version_header()
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ minor = 2
|
|||
patch = 0
|
||||
status = "dev"
|
||||
doc_branch = "latest"
|
||||
godot_cpp_ref = "master"
|
||||
|
||||
# Code that generates version header
|
||||
|
||||
|
|
Loading…
Reference in New Issue