Configure SConstruct to download redot-cpp repo in gdextension mode
This commit is contained in:
38
SConstruct
38
SConstruct
@@ -2,8 +2,30 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import pathlib
|
||||||
|
|
||||||
env = SConscript("godot-cpp/SConstruct")
|
|
||||||
|
redot_cpp_git = "https://github.com/speratus/redot-cpp"
|
||||||
|
redot_target_version = '26.1'
|
||||||
|
artifact_name = "libgdextension"
|
||||||
|
|
||||||
|
p = pathlib.Path("redot-cpp")
|
||||||
|
|
||||||
|
if not p.exists():
|
||||||
|
print("Directory redot-cpp/ is missing. Cloning repository...")
|
||||||
|
import subprocess
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "clone", "-b", redot_target_version, redot_cpp_git],
|
||||||
|
check=True
|
||||||
|
)
|
||||||
|
if result.returncode != 0:
|
||||||
|
print("Cloning redot-cpp repository failed.")
|
||||||
|
Exit(1)
|
||||||
|
else:
|
||||||
|
print("Finished cloning redot-cpp repository.")
|
||||||
|
|
||||||
|
|
||||||
|
env = SConscript("redot-cpp/SConstruct")
|
||||||
|
|
||||||
# For reference:
|
# For reference:
|
||||||
# - CCFLAGS are compilation flags shared between C and C++
|
# - CCFLAGS are compilation flags shared between C and C++
|
||||||
@@ -14,19 +36,19 @@ env = SConscript("godot-cpp/SConstruct")
|
|||||||
# - LINKFLAGS are for linking flags
|
# - LINKFLAGS are for linking flags
|
||||||
|
|
||||||
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
||||||
env.Append(CPPPATH=["src/"])
|
# env.Append(CPPPATH=["src/"])
|
||||||
|
|
||||||
# Context-specific define for GDExtension
|
# Context-specific define for GDExtension
|
||||||
env.Append(CPPDEFINES=["GD_EXTENSION_BUILD"])
|
env.Append(CPPDEFINES=["GD_EXTENSION_BUILD"])
|
||||||
sources = Glob("src/*.cpp")
|
sources = Glob("*.cpp")
|
||||||
|
|
||||||
if env["platform"] == "macos":
|
if env["platform"] == "macos":
|
||||||
library = env.SharedLibrary(
|
library = env.SharedLibrary(
|
||||||
"demo/bin/{}.{}.{}.framework/{}.{}.{}".format(
|
"demo/bin/{}.{}.{}.framework/{}.{}.{}".format(
|
||||||
project_config.lib_name(),
|
artifact_name,
|
||||||
env["platform"],
|
env["platform"],
|
||||||
env["target"],
|
env["target"],
|
||||||
project_config.lib_name(),
|
artifact_name,
|
||||||
env["platform"],
|
env["platform"],
|
||||||
env["target"]
|
env["target"]
|
||||||
),
|
),
|
||||||
@@ -35,17 +57,17 @@ if env["platform"] == "macos":
|
|||||||
elif env["platform"] == "ios":
|
elif env["platform"] == "ios":
|
||||||
if env["ios_simulator"]:
|
if env["ios_simulator"]:
|
||||||
library = env.StaticLibrary(
|
library = env.StaticLibrary(
|
||||||
"demo/bin/{}.{}.{}.simulator.a".format(project_config.lib_name(), env["platform"], env["target"]),
|
"demo/bin/{}.{}.{}.simulator.a".format(artifact_name, env["platform"], env["target"]),
|
||||||
source=sources,
|
source=sources,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
library = env.StaticLibrary(
|
library = env.StaticLibrary(
|
||||||
"demo/bin/{}.{}.{}.a".format(project_config.lib_name(), env["platform"], env["target"]),
|
"demo/bin/{}.{}.{}.a".format(artifact_name, env["platform"], env["target"]),
|
||||||
source=sources,
|
source=sources,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
library = env.SharedLibrary(
|
library = env.SharedLibrary(
|
||||||
"demo/bin/{}{}{}".format(project_config.lib_name(), env["suffix"], env["SHLIBSUFFIX"]),
|
"demo/bin/{}{}{}".format(artifact_name, env["suffix"], env["SHLIBSUFFIX"]),
|
||||||
source=sources,
|
source=sources,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user