forked from GDRETools/gdsdecomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCsub
77 lines (60 loc) · 2.42 KB
/
SCsub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python
import gdre_icon_builder
from platform_methods import run_in_subprocess
import shutil
from subprocess import Popen, PIPE
Import("env")
Import("env_modules")
mmp3thirdparty_dir = "#thirdparty/minimp3/"
liboggthirdparty_dir = "#thirdparty/libogg/"
webpthirdparty_dir = "#thirdparty/libwebp/"
env_gdsdecomp = env_modules.Clone()
env_gdsdecomp.Append(CPPPATH=["."])
env_gdsdecomp.Append(CPPPATH=["#thirdparty/thorsvg/"])
env_gdsdecomp["BUILDERS"]["MakeGDREIconsBuilder"] = Builder(
action=env_gdsdecomp.Run(
gdre_icon_builder.make_gdre_icons_action, "Generating default project theme icons header."
),
suffix=".h",
src_suffix=".svg",
)
icon_sources = Glob("icons/*.svg")
env_gdsdecomp.Alias(
"gdre_icons",
[env_gdsdecomp.MakeGDREIconsBuilder("editor/gdre_icons.gen.h", icon_sources)],
)
git = shutil.which("git")
version_info = "unknown"
if git == None:
print("GDRE WARNING: cannot find git on path, unknown version will be saved in gdre_version.gen.h")
else:
# git describe --abbrev=6
process = Popen([git, "describe", "--tags", "--abbrev=6"], stdout=PIPE)
(output, err) = process.communicate()
if not err:
version_info = output.decode("utf-8").strip()
else:
print("GDRE WARNING: git failed to run, unknown version will be saved in gdre_version.gen.h")
f = open("editor/gdre_version.gen.h", "w")
# define GDRE_VERSION "dev-poc (for Godot 4.0)"
f.write('#define GDRE_VERSION "')
f.write(version_info)
f.write('"\n')
f.close()
if env["builtin_libogg"]:
env_gdsdecomp.Prepend(CPPPATH=[liboggthirdparty_dir])
if env["builtin_libvorbis"]:
env_gdsdecomp.Prepend(CPPPATH=["#thirdparty/libvorbis"])
# Treat minimp3 headers as system headers to avoid raising warnings. Not supported on MSVC.
if not env.msvc:
env_gdsdecomp.Append(CPPFLAGS=["-isystem", Dir(mmp3thirdparty_dir).path])
else:
env_gdsdecomp.Prepend(CPPPATH=[mmp3thirdparty_dir])
if env["builtin_libwebp"]:
env_gdsdecomp.Prepend(CPPPATH=[webpthirdparty_dir, webpthirdparty_dir + "src/"])
env_gdsdecomp.add_source_files(env.modules_sources, "*.cpp")
env_gdsdecomp.add_source_files(env.modules_sources, "bytecode/*.cpp")
env_gdsdecomp.add_source_files(env.modules_sources, "compat/*.cpp")
env_gdsdecomp.add_source_files(env.modules_sources, "editor/*.cpp")
env_gdsdecomp.add_source_files(env.modules_sources, "utility/*.cpp")
env_gdsdecomp.add_source_files(env.modules_sources, "external/toojpeg/*.cpp")