Print an error if the godot-cpp submodule hasn't been initialized

This makes the error that is printed easier to understand, with
a command given as a solution to run.

The error message is also colored to match how core Godot displays
this kind of build errors.
This commit is contained in:
Hugo Locurcio
2024-08-09 00:19:52 +02:00
parent 9074766ffe
commit 577353609c
2 changed files with 68 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
#!/usr/bin/env python
import os
import sys
from methods import print_error
def normalize_path(val, env):
@@ -48,6 +51,19 @@ compilation_db = env.CompilationDatabase(
)
env.Alias("compiledb", compilation_db)
submodule_initialized = False
dir_name = 'godot-cpp'
if os.path.isdir(dir_name):
if os.listdir(dir_name):
submodule_initialized = True
if not submodule_initialized:
print_error("""godot-cpp is not available within this folder, as Git submodules haven't been initialized.
Run the following command to download godot-cpp:
git submodule update --init --recursive""")
sys.exit(1)
env = SConscript("godot-cpp/SConstruct", {"env": env, "customs": customs})
env.Append(CPPPATH=["src/"])