Skip to content

Commit

Permalink
Remove Cocoa
Browse files Browse the repository at this point in the history
  • Loading branch information
CedNaru committed Dec 30, 2022
1 parent 587897d commit f6218c8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
32 changes: 28 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
import os
import sys
import subprocess

target_path = ARGUMENTS.pop("target_path", "demo/addons/fmod/bin/")
target_path = ARGUMENTS.pop("target_path", "demo/addons/fmod/libs/")
target_name = ARGUMENTS.pop("target_name", "libGodotFmod")
fmod_lib_dir = ARGUMENTS.pop("fmod_lib_dir", "../libs/fmod/")

Expand Down Expand Up @@ -84,8 +84,8 @@ elif env["platform"] == "android":
env.Append(LIBS=[libfmod, libfmodstudio])
env.Append(LIBPATH=[env['fmod_lib_dir'] + 'android/core/lib/' + arch_dir, env['fmod_lib_dir'] + 'android/studio/lib/' + arch_dir])

target = "{}{}.{}.{}".format(
target_path, target_name, env["platform"], env["target"]
target = "{}{}/{}.{}.{}".format(
target_path, env["platform"], target_name, env["platform"], env["target"]
)
if env["platform"] == "macos":
target = "{}.framework/{}.{}.{}".format(
Expand All @@ -102,4 +102,28 @@ else:
)

library = env.SharedLibrary(target=target, source=sources)

#Necessary so the extension library can't find the Fmod libraries
if env["platform"] == "macos":
def sys_exec(args):
proc = subprocess.Popen(args, stdout=subprocess.PIPE, text=True)
(out, err) = proc.communicate()
return out.rstrip("\r\n").lstrip()


lib_name = "{}.{}.{}".format(
target,
target_name,
env["platform"],
env["target"]
)

def change_id(self, arg, env, executor = None):
sys_exec(["install_name_tool", "-id", "@rpath/%s" % lib_name , target])
sys_exec(["install_name_tool", "-change", "@rpath/%s" % libfmodstudio, "@loader_path/../%s" % libfmodstudio, target])
sys_exec(["install_name_tool", "-change", "@rpath/%s" % libfmod, "@loader_path/../%s" % libfmod, target])
change_id_action = Action('', change_id)

AddPostAction(library, change_id_action)

Default(library)
2 changes: 1 addition & 1 deletion demo/addons/fmod/fmod.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ entry_symbol = "fmod_library_init"

[libraries]

macos.editor = "res://addons/fmod/libs/macos/libGodotFmod.macos.editor.dylib"
macos.editor = "res://addons/fmod/libs/macos/libGodotFmod.macos.editor.framework"
windows.editor.x86_32 = "res://addons/fmod/libs/windows/x86/libGodotFmod.windows.editor.x86_32.dll"
windows.editor.x86_64 = "res://addons/fmod/libs/windows/x64/libGodotFmod.windows.editor.x86_64.dll"
linux.editor.x86_64 = "res://addons/fmod/bin/libGodotFmod.linux.editor.x86_64.so"
Expand Down
Empty file.

0 comments on commit f6218c8

Please sign in to comment.