Repository navigation
Expand file tree
/
Copy pathSCsub
More file actions
106 lines (87 loc) · 3.68 KB
/
Copy pathSCsub
File metadata and controls
106 lines (87 loc) · 3.68 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
#!/usr/bin/env python
from misc.utility.scons_hints import *
import os
import shutil
import time
Import("env")
Import("env_modules")
#region Helpers
def get_addon_platform():
return env["platform"].replace("linuxbsd", "linux")
def get_addon_threads():
return "yes" if env["threads"] else "no"
def get_addon_llvm():
return "yes" if env.get("use_llvm", False) else "no"
def get_addon_devbuild():
return "yes" if env.get("dev_build", False) else "no"
def get_addon_target():
return "template_release" if env["target"] == "editor" else env["target"]
def get_addon_mingw():
return "yes" if env.get("use_mingw", False) else "no"
os.system(f"scons static_build=yes platform={get_addon_platform()} target={get_addon_target()} arch={env['arch']} precision={env['precision']} threads={get_addon_threads()} dev_build={get_addon_devbuild()} use_llvm={get_addon_llvm()} lto={env['lto']} use_mingw={get_addon_mingw()}")
def get_sufix_before():
suffix = f".{get_addon_platform()}.{env['target']}"
if env["dev_build"]:
suffix += ".dev"
if env["precision"] == "double":
suffix += ".double"
suffix += f".{env['arch']}"
if not env["threads"]:
suffix += ".nothreads"
if env.get("use_llvm", False):
suffix += ".llvm"
return suffix
def get_sufix_after():
suffix = f".{get_addon_platform()}.{get_addon_target()}"
if env["dev_build"]:
suffix += ".dev"
if env["precision"] == "double":
suffix += ".double"
suffix += f".{env['arch']}"
if not env["threads"]:
suffix += ".nothreads"
return suffix
os.system("ls -l bin/")
# Rename if target is editor
if env["target"] == "editor" or env["platform"] == "windows":
lib_extension = ".a" if env["platform"] != "windows" else ".lib"
lib_prefix = "lib" if env["platform"] != "windows" else ""
if env.get("use_mingw", False):
lib_extension = ".a"
lib_prefix = "lib"
# Build source and target paths
source_lib = f"bin/libtiny_lobby{get_sufix_after()}{lib_extension}"
target_lib = f"bin/{lib_prefix}tiny_lobby{get_sufix_before()}{lib_extension}"
godotcpp_source = f"godot-cpp/bin/libgodot-cpp{get_sufix_after()}{lib_extension}"
godotcpp_target = f"godot-cpp/bin/{lib_prefix}godot-cpp{get_sufix_before()}{lib_extension}"
# Only rename if source and target are different
if source_lib != target_lib:
# If target lib exists, remove it
if os.path.exists(target_lib):
os.remove(target_lib)
# Rename our lib
if os.path.exists(source_lib):
os.rename(source_lib, target_lib)
if godotcpp_source != godotcpp_target:
# If target lib exists, remove it
if os.path.exists(godotcpp_target):
os.remove(godotcpp_target)
# Rename godot-cpp lib
if os.path.exists(godotcpp_source):
os.rename(godotcpp_source, godotcpp_target)
# Do an ls on bin folder
os.system("ls -l bin/")
#endregion
env_tiny_lobby = env_modules.Clone()
suffix = get_sufix_before()
if env["platform"] == "ios":
tiny_path = f"#modules/tiny_lobby/bin/libtiny_lobby{suffix}.a"
godotcpp_path = f"#modules/tiny_lobby/godot-cpp/bin/libgodot-cpp{suffix}.a"
env.Append(LIBS=[env.File(tiny_path), env.File(godotcpp_path)])
elif env["platform"] != "windows" or env.get("use_mingw", False):
env.Append(LIBPATH=["#modules/tiny_lobby/bin", "#modules/tiny_lobby/godot-cpp/bin"])
env.Append(LIBS=[f"tiny_lobby{suffix}", f"godot-cpp{suffix}"])
else:
env.Append(LIBPATH=["#modules/tiny_lobby/bin", "#modules/tiny_lobby/godot-cpp/bin"])
env.Append(LIBS=["tiny_lobby", "godot-cpp"])
env.add_source_files(env.modules_sources, "register_types.cpp")