-
Notifications
You must be signed in to change notification settings - Fork 278
Expand file tree
/
Copy pathconfig.py
More file actions
111 lines (91 loc) · 3.96 KB
/
Copy pathconfig.py
File metadata and controls
111 lines (91 loc) · 3.96 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
def can_build(env, platform):
return True
import os
import sys
import shutil
def _apply_core_patches(env):
import importlib.util
patches_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "build", "patches.py")
spec = importlib.util.spec_from_file_location("gdsdecomp_build_patches", patches_path)
if spec is None or spec.loader is None:
raise ImportError(f"gdsdecomp: failed to load patches module from {patches_path}")
patches_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(patches_module)
patches_module.apply_core_patches(env)
# A terrible hack to force-enable our dependent modules being included on non-editor builds.
# etcpak has dependencies our decompressor requires,
# astcenc has the decompression functions.
# without these, we can't decompress either astc or etc textures.
#
# astcenc and etcpak's can_build functions returns False if the editor_build flag is False,
# and it can't be overridden by any flags. Also, Since they come before us in the modules list,
# we can't monkey patch that.
#
# During configure, env.module_list isn't set, and it's not possible to add modules to it.
# sort_module_list is called right after after env.module_list is set with all the modules,
# so we can monkey patch that to add the modules we need.
def monkey_patch_sort_module_list():
import methods # pyright: ignore[reportMissingImports]
old_sort_module_list = methods.sort_module_list
def sort_module_list(env):
if not "etcpak" in env.module_list:
env.module_list["etcpak"] = "modules/etcpak"
if not "astcenc" in env.module_list:
env.module_list["astcenc"] = "modules/astcenc"
# no need to run configure on etcpak
if not "tinyexr" in env.module_list:
env.module_list["tinyexr"] = "modules/tinyexr"
if not "xatlas_unwrap" in env.module_list:
env.module_list["xatlas_unwrap"] = "modules/xatlas_unwrap"
return old_sort_module_list(env)
methods.sort_module_list = sort_module_list
def configure(env):
_apply_core_patches(env)
if not env.editor_build:
monkey_patch_sort_module_list()
if not "use_static_godot_mono_decomp" in env:
env["use_static_godot_mono_decomp"] = False
if env["use_static_godot_mono_decomp"] and (env["platform"] == "android" or env["platform"] == "macos"):
print(f"Using shared Mono for {env['platform']} because static Mono is not supported for this platform")
env["use_static_godot_mono_decomp"] = False
# hack to force the minimum macOS version to 10.15; it is currently hard-coded to 10.13
# TODO: remove this hack once the minimum macOS version is updated to 10.15
if env["platform"] == "macos" and env["arch"] == "x86_64":
min_version_flag = "-mmacosx-version-min=10.15"
env.Append(CPPFLAGS=[min_version_flag])
env.Append(LINKFLAGS=[min_version_flag])
env.Append(CXXFLAGS=[min_version_flag])
env.Append(ASFLAGS=[min_version_flag])
def get_opts(platform):
from SCons.Variables import BoolVariable
opts = [
BoolVariable("disable_godot_mono_decomp", "Disable Godot Mono Decompilation", False),
BoolVariable("disable_gifski", "Disable Gifski", False),
]
if not (platform == "android" or platform == "macos"):
opts.append(BoolVariable("use_static_godot_mono_decomp", "Build Godot Mono Decomp library as static", False))
return opts
def get_doc_classes():
return [
"GDScriptDecomp",
"Glob",
"SemVer",
"GodotVer",
"GodotREEditorStandalone",
"ImportExporter",
"ImportInfo",
"PckDumper",
"ImportExporter",
"ResourceCompatLoader",
"Exporter",
"ResourceExporter",
"CustomDecryptor",
"AESContextGDRE",
"CamelliaContext",
"AriaContext",
"GDRESettings",
"GDREConfig",
"PckCreator",
]
def get_doc_path():
return "doc_classes"