You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
[iOS/macOS] Add option to automatically build (and sign / archive) bundles.
This commit is contained in:
@@ -140,3 +140,108 @@ def generate_export_icons(platform_path, platform_name):
|
||||
wf = export_path + "/" + name + "_svg.gen.h"
|
||||
with open(wf, "w") as svgw:
|
||||
svgw.write(svg_str)
|
||||
|
||||
|
||||
def get_build_version(short):
|
||||
import version
|
||||
|
||||
name = "custom_build"
|
||||
if os.getenv("BUILD_NAME") != None:
|
||||
name = os.getenv("BUILD_NAME")
|
||||
v = "%d.%d" % (version.major, version.minor)
|
||||
if version.patch > 0:
|
||||
v += ".%d" % version.patch
|
||||
status = version.status
|
||||
if not short:
|
||||
if os.getenv("GODOT_VERSION_STATUS") != None:
|
||||
status = str(os.getenv("GODOT_VERSION_STATUS"))
|
||||
v += ".%s.%s" % (status, name)
|
||||
return v
|
||||
|
||||
|
||||
def lipo(prefix, suffix):
|
||||
from pathlib import Path
|
||||
|
||||
target_bin = ""
|
||||
lipo_command = ["lipo", "-create"]
|
||||
arch_found = 0
|
||||
|
||||
for arch in architectures:
|
||||
bin_name = prefix + "." + arch + suffix
|
||||
if Path(bin_name).is_file():
|
||||
target_bin = bin_name
|
||||
lipo_command += [bin_name]
|
||||
arch_found += 1
|
||||
|
||||
if arch_found > 1:
|
||||
target_bin = prefix + ".fat" + suffix
|
||||
lipo_command += ["-output", target_bin]
|
||||
subprocess.run(lipo_command)
|
||||
|
||||
return target_bin
|
||||
|
||||
|
||||
def get_mvk_sdk_path(osname):
|
||||
def int_or_zero(i):
|
||||
try:
|
||||
return int(i)
|
||||
except:
|
||||
return 0
|
||||
|
||||
def ver_parse(a):
|
||||
return [int_or_zero(i) for i in a.split(".")]
|
||||
|
||||
dirname = os.path.expanduser("~/VulkanSDK")
|
||||
if not os.path.exists(dirname):
|
||||
return ""
|
||||
|
||||
ver_min = ver_parse("1.3.231.0")
|
||||
ver_num = ver_parse("0.0.0.0")
|
||||
files = os.listdir(dirname)
|
||||
lib_name_out = dirname
|
||||
for file in files:
|
||||
if os.path.isdir(os.path.join(dirname, file)):
|
||||
ver_comp = ver_parse(file)
|
||||
if ver_comp > ver_num and ver_comp >= ver_min:
|
||||
# Try new SDK location.
|
||||
lib_name = os.path.join(os.path.join(dirname, file), "macOS/lib/MoltenVK.xcframework/" + osname + "/")
|
||||
if os.path.isfile(os.path.join(lib_name, "libMoltenVK.a")):
|
||||
ver_num = ver_comp
|
||||
lib_name_out = os.path.join(os.path.join(dirname, file), "macOS/lib/MoltenVK.xcframework")
|
||||
else:
|
||||
# Try old SDK location.
|
||||
lib_name = os.path.join(
|
||||
os.path.join(dirname, file), "MoltenVK/MoltenVK.xcframework/" + osname + "/"
|
||||
)
|
||||
if os.path.isfile(os.path.join(lib_name, "libMoltenVK.a")):
|
||||
ver_num = ver_comp
|
||||
lib_name_out = os.path.join(os.path.join(dirname, file), "MoltenVK/MoltenVK.xcframework")
|
||||
|
||||
return lib_name_out
|
||||
|
||||
|
||||
def detect_mvk(env, osname):
|
||||
mvk_list = [
|
||||
get_mvk_sdk_path(osname),
|
||||
"/opt/homebrew/Frameworks/MoltenVK.xcframework",
|
||||
"/usr/local/homebrew/Frameworks/MoltenVK.xcframework",
|
||||
"/opt/local/Frameworks/MoltenVK.xcframework",
|
||||
]
|
||||
if env["vulkan_sdk_path"] != "":
|
||||
mvk_list.insert(0, os.path.expanduser(env["vulkan_sdk_path"]))
|
||||
mvk_list.insert(
|
||||
0,
|
||||
os.path.join(os.path.expanduser(env["vulkan_sdk_path"]), "macOS/lib/MoltenVK.xcframework"),
|
||||
)
|
||||
mvk_list.insert(
|
||||
0,
|
||||
os.path.join(os.path.expanduser(env["vulkan_sdk_path"]), "MoltenVK/MoltenVK.xcframework"),
|
||||
)
|
||||
|
||||
for mvk_path in mvk_list:
|
||||
if mvk_path and os.path.isfile(os.path.join(mvk_path, osname + "/libMoltenVK.a")):
|
||||
mvk_found = True
|
||||
print("MoltenVK found at: " + mvk_path)
|
||||
return mvk_path
|
||||
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user