updated to 4.1.3 (4.1.2/custom downloader for it made macos not compile)
This commit is contained in:
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
[submodule "src/lib/godot-cpp"]
|
||||
path = src/lib/godot-cpp
|
||||
url = https://github.com/godotengine/godot-cpp
|
||||
branch = 4.1
|
33
setup.py
33
setup.py
@@ -3,28 +3,11 @@ from distutils.dir_util import copy_tree
|
||||
import shutil
|
||||
import os
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
godot_cpp_url = "https://github.com/godotengine/godot-cpp/archive/refs/tags/godot-4.1.2-stable.zip"
|
||||
|
||||
godot_cpp_download_path = "src/lib/godot-cpp.zip"
|
||||
|
||||
urllib.request.urlretrieve(godot_cpp_url, godot_cpp_download_path)
|
||||
|
||||
print(f"Downloaded godot-cpp to {godot_cpp_download_path}")
|
||||
|
||||
godot_cpp_zip_file_path = "src/lib/godot-cpp.zip"
|
||||
godot_cpp_destination_dir = "src/lib/godot-cpp/"
|
||||
os.makedirs(godot_cpp_destination_dir, exist_ok=True)
|
||||
with zipfile.ZipFile(godot_cpp_zip_file_path, 'r') as zip_ref:
|
||||
files_to_extract = [f for f in zip_ref.namelist() if f.startswith('godot-cpp-godot-4.1.2-stable/')]
|
||||
for file in files_to_extract:
|
||||
adjusted_path = file.replace('godot-cpp-godot-4.1.2-stable/', '', 1)
|
||||
zip_ref.extract(file, godot_cpp_destination_dir + adjusted_path)
|
||||
|
||||
print("Extracted godot-cpp-godot-4.1.2-stable to src/lib/godot-cpp/")
|
||||
with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref:
|
||||
zip_ref.extractall("src/lib/discord_game_sdk/")
|
||||
|
||||
# Patch the SDK to actually build, since it's missing an include
|
||||
with open("src/lib/discord_game_sdk/cpp/types.h", "r+") as f:
|
||||
s = f.read()
|
||||
f.seek(0)
|
||||
@@ -63,10 +46,16 @@ os.remove("src/lib/discord_game_sdk/README.md")
|
||||
|
||||
if sys.platform == "darwin":
|
||||
# Combine the two libraries into one
|
||||
os.system("lipo src/lib/discord_game_sdk/bin/{discord_game_sdk.dylib,discord_game_sdk_aarch64.dylib} -output src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib -create")
|
||||
os.system(
|
||||
"lipo src/lib/discord_game_sdk/bin/{discord_game_sdk.dylib,discord_game_sdk_aarch64.dylib} -output src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib -create"
|
||||
)
|
||||
# Change the install name to (library's location)/(its new name)
|
||||
os.system("install_name_tool -id '@loader_path/libdiscord_game_sdk.dylib'\
|
||||
src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib")
|
||||
os.system(
|
||||
"install_name_tool -id '@loader_path/libdiscord_game_sdk.dylib'\
|
||||
src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib"
|
||||
)
|
||||
# Remove the ones it's made of
|
||||
os.remove("src/lib/discord_game_sdk/bin/discord_game_sdk.dylib")
|
||||
os.remove("src/lib/discord_game_sdk/bin/discord_game_sdk_aarch64.dylib")
|
||||
|
||||
os.system("git submodule update --init --remote")
|
||||
|
Reference in New Issue
Block a user