Skip to content

Commit

Permalink
update SConstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Jan 20, 2024
1 parent 72f5ce9 commit d05595e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions gdext/SConstruct
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
#!/usr/bin/env python
from glob import glob
from pathlib import Path
import shutil
import subprocess

env = SConscript("godot-cpp/SConstruct")
env.Append(CPPDEFINES=['IMGUI_USER_CONFIG="\\"imconfig-godot.h\\""', "IGN_EXPORT"])
env.Append(CPPPATH=["src/", "imgui/", "include/", "gen/"])
env.Replace(CXXFLAGS=str(env["CXXFLAGS"]).replace("c++17", "c++20"))

sources = Glob("src/*.cpp") + Glob("imgui/*.cpp") + Glob("gen/*.cpp")

(extension_path,) = glob("proj/addons/*/*.gdextension")
addon_path = Path(extension_path).parent
project_name = Path(extension_path).stem

config = "release" if env["target"] == "template_release" else "debug"

libpath = env.get("LIBPATH", [])
libs = [env["LIBS"]]

windows = env["platform"] == "windows"
linux = env["platform"] == "linux"
config = "release" if env["target"] == "template_release" else "debug"

if config == "release":
if windows:
Expand All @@ -30,8 +22,21 @@ if windows:
elif linux:
triplet = "x64-linux"
else:
subprocess.call("zsh vcpkg-macos.sh", shell=True)
triplet = "arm64-osx"

subprocess.call("python gds_bindings.py", shell=True)

sources = Glob("src/*.cpp") + Glob("imgui/*.cpp") + Glob("gen/*.cpp")

shutil.copy("imgui-godot-native.gdextension", "../addons/imgui-godot/")
(extension_path,) = glob("../addons/imgui-godot/*.gdextension")
addon_path = Path(extension_path).parent
project_name = Path(extension_path).stem

libpath = env.get("LIBPATH", [])
libs = [env["LIBS"]]

env.Append(CPPPATH=["imgui/misc/freetype/"])
env.Append(CPPPATH=[f"vcpkg_installed/{triplet}/include"])
env.Append(CPPDEFINES=["IMGUI_ENABLE_FREETYPE"]) #, "IMGUI_ENABLE_FREETYPE_LUNASVG"])
Expand Down
2 changes: 1 addition & 1 deletion gdext/src/ImGuiGD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ PackedInt64Array ImGuiGD::GetImGuiPtrs(String version, int ioSize, int vertSize,
if (version != String(ImGui::GetVersion()) || ioSize != sizeof(ImGuiIO) || vertSize != sizeof(ImDrawVert) ||
idxSize != sizeof(ImDrawIdx) || charSize != sizeof(ImWchar))
{
UtilityFunctions::push_error("ImGui version mismatch, use ", ImGui::GetVersion(), "-docking");
UtilityFunctions::push_error("ImGui version mismatch, use v", ImGui::GetVersion(), "-docking");
return {};
}

Expand Down

0 comments on commit d05595e

Please sign in to comment.