Fix dylib rpath id on macOS

This commit is contained in:
Wojtek Figat
2023-05-29 17:11:51 +02:00
parent 90603792d7
commit d0bf176178

View File

@@ -378,6 +378,23 @@ namespace Flax.Build.Platforms
lastTask = rpathTask;
}
}
else if (options.LinkEnv.Output == LinkerOutput.SharedLibrary)
{
// Fix rpath for dynamic library
var rpathTask = graph.Add<Task>();
rpathTask.ProducedFiles.Add(outputFilePath);
rpathTask.WorkingDirectory = Path.GetDirectoryName(outputFilePath);
rpathTask.CommandPath = "install_name_tool";
var filename = Path.GetFileName(outputFilePath);
rpathTask.CommandArguments = string.Format("-id \"@rpath/{0}\" \"{0}\"", filename);
rpathTask.InfoMessage = "Fixing rpath id " + filename;
rpathTask.Cost = 1;
rpathTask.DisableCache = true;
rpathTask.DependentTasks = new HashSet<Task>();
rpathTask.DependentTasks.Add(lastTask);
lastTask = rpathTask;
}
// TODO: fix dylib ID: 'install_name_tool -id @rpath/FlaxGame.dylib FlaxGame.dylib'
if (!options.LinkEnv.DebugInformation)
{
// Strip debug symbols