-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for params context * Add system info print function * Changed script to build CUDA * Update build_cpp.yml * Update build_cpp.yml * Update build_cpp.yml * Added cuda dll * Minor changes * Fix older unity * And this * Update README.md
- Loading branch information
Showing
12 changed files
with
393 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
Packages/com.whisper.unity/Editor/WhisperProjectSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEditor.Build; | ||
using UnityEngine; | ||
|
||
|
||
static class WhisperProjectSettingsProvider | ||
{ | ||
[SettingsProvider] | ||
public static SettingsProvider CreateMyCustomSettingsProvider() | ||
{ | ||
var provider = new SettingsProvider("Project/WhisperSettings", SettingsScope.Project) | ||
{ | ||
label = "Whisper", | ||
guiHandler = (searchContext) => | ||
{ | ||
CudaEnabled = EditorGUILayout.Toggle("Enable CUDA", CudaEnabled); | ||
}, | ||
|
||
keywords = new HashSet<string>(new[] { "CUDA", "cuBLAS" }) | ||
}; | ||
|
||
return provider; | ||
} | ||
|
||
public static bool CudaEnabled | ||
{ | ||
get | ||
{ | ||
#if WHISPER_CUDA | ||
return true; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
set | ||
{ | ||
if (value == CudaEnabled) | ||
return; | ||
|
||
string[] newDefines; | ||
var defines = GetStandaloneDefines(); | ||
|
||
if (value) | ||
{ | ||
if (defines.Contains("WHISPER_CUDA")) | ||
return; | ||
|
||
newDefines = defines.Append("WHISPER_CUDA").ToArray(); | ||
} | ||
else | ||
{ | ||
if (!defines.Contains("WHISPER_CUDA")) | ||
return; | ||
|
||
newDefines = defines.Where(x => x != "WHISPER_CUDA").ToArray(); | ||
} | ||
|
||
SetStandaloneDefines(newDefines); | ||
} | ||
} | ||
|
||
// This is for older Unity compability | ||
private static string[] GetStandaloneDefines() | ||
{ | ||
string[] defines; | ||
|
||
#if UNITY_2021_3_OR_NEWER | ||
PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.Standalone, out defines); | ||
#else | ||
var definesStr = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone); | ||
defines = definesStr.Split(';'); | ||
#endif | ||
|
||
return defines; | ||
} | ||
|
||
private static void SetStandaloneDefines(string[] newDefines) | ||
{ | ||
#if UNITY_2021_3_OR_NEWER | ||
PlayerSettings.SetScriptingDefineSymbols(NamedBuildTarget.Standalone, newDefines); | ||
#else | ||
var definesStr = string.Join(";", newDefines); | ||
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, definesStr); | ||
#endif | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/com.whisper.unity/Editor/WhisperProjectSettings.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
70 changes: 70 additions & 0 deletions
70
Packages/com.whisper.unity/Plugins/Windows/libwhisper_cuda.dll.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.