Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Unity locking of DLLs during cross-platform build #252

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Runtime/LLMBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ private static void InitializeOnLoad()
{
Reset();
}

public static void CopyPath(string source, string target)
public static void HandleActionFileRecursive(string source, string target, ActionCallback actionCallback)
{
if (File.Exists(source))
{
File.Copy(source, target, true);
actionCallback(source, target);
}
else if (Directory.Exists(source))
{
Expand All @@ -32,14 +32,24 @@ public static void CopyPath(string source, string target)
filesAndDirs.AddRange(Directory.GetDirectories(source));
foreach (string path in filesAndDirs)
{
CopyPath(path, Path.Combine(target, Path.GetFileName(path)));
HandleActionFileRecursive(path, Path.Combine(target, Path.GetFileName(path)), actionCallback);
}
}
}

public static void CopyWithOverwrite(string source, string target)
{
File.Copy(source, target, true);
}

public static void CopyPath(string source, string target)
{
HandleActionFileRecursive(source, target, CopyWithOverwrite);
}

public static void MovePath(string source, string target)
{
CopyPath(source, target);
HandleActionFileRecursive(source, target, File.Move);
DeletePath(source);
}

Expand Down
1 change: 1 addition & 0 deletions Runtime/LLMLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ static LLMLib()
has_avx = LibraryLoader.GetSymbolDelegate<HasArchDelegate>(archCheckerHandle, "has_avx")();
has_avx2 = LibraryLoader.GetSymbolDelegate<HasArchDelegate>(archCheckerHandle, "has_avx2")();
has_avx512 = LibraryLoader.GetSymbolDelegate<HasArchDelegate>(archCheckerHandle, "has_avx512")();
LibraryLoader.FreeLibrary(archCheckerHandle);
}
catch (Exception e)
{
Expand Down
Loading