diff options
Diffstat (limited to 'Examples')
| -rw-r--r-- | Examples/OldMain/OldMain.vcxproj | 11 | ||||
| -rw-r--r-- | Examples/OldMain/OldMain.vcxproj.filters | 7 | ||||
| -rw-r--r-- | Examples/OldMain/Readme.txt | 1 | ||||
| -rw-r--r-- | Examples/OldMain/Utils/Logger.cpp | 40 | ||||
| -rw-r--r-- | Examples/OldMain/Utils/Logger.h | 31 |
5 files changed, 86 insertions, 4 deletions
diff --git a/Examples/OldMain/OldMain.vcxproj b/Examples/OldMain/OldMain.vcxproj index 26f2c71..5f73e2c 100644 --- a/Examples/OldMain/OldMain.vcxproj +++ b/Examples/OldMain/OldMain.vcxproj @@ -44,10 +44,10 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <IncludePath>$(SolutionDir)Whisper\Source\;$(IncludePath)</IncludePath> + <IncludePath>$(ProjectDir);$(SolutionDir)Whisper\Source\;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <IncludePath>$(SolutionDir)Whisper\Source\;$(IncludePath)</IncludePath> + <IncludePath>$(ProjectDir);$(SolutionDir)Whisper\Source\;$(IncludePath)</IncludePath> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> @@ -83,17 +83,22 @@ </Link> </ItemDefinitionGroup> <ItemGroup> + <ClCompile Include="..\..\Whisper\source.compat\ggmlMsvc.c" /> <ClCompile Include="..\..\Whisper\source\ggml.c"> <ExcludedFromBuild>true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="..\..\Whisper\source\ggmlMsvc.c" /> <ClCompile Include="..\..\Whisper\source\whisper.cpp" /> <ClCompile Include="main.cpp" /> + <ClCompile Include="Utils\Logger.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\Whisper\source\ggml.h" /> <ClInclude Include="..\..\Whisper\source\whisper.h" /> <ClInclude Include="dr_wav.h" /> + <ClInclude Include="Utils\Logger.h" /> + </ItemGroup> + <ItemGroup> + <Text Include="Readme.txt" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/Examples/OldMain/OldMain.vcxproj.filters b/Examples/OldMain/OldMain.vcxproj.filters index 78f29f0..0135074 100644 --- a/Examples/OldMain/OldMain.vcxproj.filters +++ b/Examples/OldMain/OldMain.vcxproj.filters @@ -1,14 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClCompile Include="..\..\Whisper\source\ggmlMsvc.c" /> <ClCompile Include="..\..\Whisper\source\whisper.cpp" /> <ClCompile Include="main.cpp" /> <ClCompile Include="..\..\Whisper\source\ggml.c" /> + <ClCompile Include="..\..\Whisper\source.compat\ggmlMsvc.c" /> + <ClCompile Include="Utils\Logger.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\Whisper\source\ggml.h" /> <ClInclude Include="..\..\Whisper\source\whisper.h" /> <ClInclude Include="dr_wav.h" /> + <ClInclude Include="Utils\Logger.h" /> + </ItemGroup> + <ItemGroup> + <Text Include="Readme.txt" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Examples/OldMain/Readme.txt b/Examples/OldMain/Readme.txt new file mode 100644 index 0000000..95c3665 --- /dev/null +++ b/Examples/OldMain/Readme.txt @@ -0,0 +1 @@ +This project builds the original whisper.cpp command-line sample
\ No newline at end of file diff --git a/Examples/OldMain/Utils/Logger.cpp b/Examples/OldMain/Utils/Logger.cpp new file mode 100644 index 0000000..b9217e7 --- /dev/null +++ b/Examples/OldMain/Utils/Logger.cpp @@ -0,0 +1,40 @@ +#include <stdint.h> +#include <vector> +#include <cstdarg> +#include "Logger.h" + +namespace +{ + void logMessage( const char* lvl, const char8_t* pszFormat, std::va_list va ) + { + fprintf( stderr, "%s: ", lvl ); + vfprintf( stderr, (const char*)pszFormat, va ); + fprintf( stderr, "\n" ); + } +} + +#define LOG_MESSAGE_IMPL( lvl ) \ + std::va_list args; \ + va_start( args, pszFormat ); \ + logMessage( lvl, pszFormat, args ); \ + va_end( args ); + +void logError( const char8_t* pszFormat, ... ) +{ + LOG_MESSAGE_IMPL( "Error" ); +} + +void logWarning( const char8_t* pszFormat, ... ) +{ + LOG_MESSAGE_IMPL( "Warning" ); +} + +void logInfo( const char8_t* pszFormat, ... ) +{ + LOG_MESSAGE_IMPL( "Info" ); +} + +void logDebug( const char8_t* pszFormat, ... ) +{ + LOG_MESSAGE_IMPL( "Debug" ); +}
\ No newline at end of file diff --git a/Examples/OldMain/Utils/Logger.h b/Examples/OldMain/Utils/Logger.h new file mode 100644 index 0000000..8a4962f --- /dev/null +++ b/Examples/OldMain/Utils/Logger.h @@ -0,0 +1,31 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +struct ggml_tensor; + +void logError( const char8_t* pszFormat, ... ); +void logWarning( const char8_t* pszFormat, ... ); +void logInfo( const char8_t* pszFormat, ... ); +void logDebug( const char8_t* pszFormat, ... ); + +#ifdef __cplusplus +} + +namespace Tracing +{ + struct ItemName + { + ItemName( const char* str ) { } + ItemName( const char* str, uint32_t a0 ) { } + ItemName( const char* str, int a0 ) { } + }; + + inline void tensor( const ItemName& name, const ggml_tensor* tensor ) { } + inline void delayTensor( const ItemName& name, const ggml_tensor* tensor ) { } + inline void vector( const ItemName& name, const std::vector<float>& vec ) { } + inline void writeDelayedTensors() { } +} +#endif
\ No newline at end of file |
