import os from SCons.Script import DefaultEnvironment, ARGUMENTS, Glob, Dir env = DefaultEnvironment() platform = ARGUMENTS.get("platform", "linux") target = ARGUMENTS.get("target", "template_debug") # or template_release arch = ARGUMENTS.get("arch", "x86_64") HERE = Dir(".").abspath GODOTCPP = os.path.join(HERE, "godot-cpp") inc_paths = [ os.path.join(GODOTCPP, "include"), os.path.join(GODOTCPP, "gen", "include"), ] for extra in ("godot-headers", "gdextension"): p = os.path.join(GODOTCPP, extra) if os.path.isdir(p): inc_paths.append(p) env.Append(CPPPATH=inc_paths) env.Append(LIBPATH=[os.path.join(GODOTCPP, "bin")]) env.Append(CXXFLAGS=["-std=c++17", "-fPIC"]) env.Append(LIBS=[f"godot-cpp.{platform}.{target}.{arch}"]) outdir = os.path.join(HERE, "bin") os.makedirs(outdir, exist_ok=True) soname = f"gol.{platform}.{'debug' if target == 'template_debug' else 'release'}.{arch}" env.SharedLibrary(target=os.path.join(outdir, soname), source=Glob("src/*.cpp"))