Add changes to build on Mac

This commit is contained in:
rodolpheh 2023-10-26 19:35:45 +01:00
parent 71639b8dc9
commit 0c58581a5e

View file

@ -17,15 +17,31 @@ env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")
if env["platform"] == "macos":
target = "demo/addons/godot_ultraleap_plugin/bin/libgdultraleap.{}.{}.framework/libgdultraleap.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
)
library = env.SharedLibrary(
"demo/addons/godot_ultraleap_plugin/bin/libgdultraleap.{}.{}.framework/libgdultraleap.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
target,
source=sources,
)
env.Append(LIBS=['LeapC'])
# I am not sure about this path. Replace this with the path where you can find libLeapC.dylib
env.Append(LIBPATH = ['/usr/lib/ultraleap-hand-tracking-service'])
env.Append(LIBPATH = ["/Applications/Ultraleap Hand Tracking Service.app/Contents/LeapSDK/lib"])
env.Append(CPPPATH = ["/Applications/Ultraleap Hand Tracking Service.app/Contents/LeapSDK/include"])
def sys_exec(args):
proc = subprocess.Popen(args, stdout=subprocess.PIPE, text=True)
(out, err) = proc.communicate()
return out.rstrip("\r\n").lstrip()
def change_rpath(self, arg, env, executor = None):
sys_exec(["install_name_tool", "-change", "@rpath/%s" % "libLeapC.5.dylib", "@loader_path/../%s" % "libLeapC.5.dylib", target])
change_rpath_action = Action('', change_rpath)
AddPostAction(library, change_rpath_action)
else:
library = env.SharedLibrary(
"demo/addons/godot_ultraleap_plugin/bin/libgdultraleap{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),