diff --git a/.gitignore b/.gitignore
index 940794e..0cae5dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -286,3 +286,9 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs
+
+CMakeCache.txt
+CMakeFiles/
+MSBuild_Logs/
+cmake_uninstall.cmake
+native_build/
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..5ebea35
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "zstd"]
+ path = zstd
+ url = https://github.com/facebook/zstd
diff --git a/Zstandard.Net.Benchmark/Zstandard.Net.Benchmark.csproj b/Zstandard.Net.Benchmark/Zstandard.Net.Benchmark.csproj
index 7c9cb2e..98a77fc 100644
--- a/Zstandard.Net.Benchmark/Zstandard.Net.Benchmark.csproj
+++ b/Zstandard.Net.Benchmark/Zstandard.Net.Benchmark.csproj
@@ -7,7 +7,7 @@
- ..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.1\build\netstandard2.0\ref\netstandard.dll
+ ..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.1\build\netstandard2.1\ref\netstandard.dll
diff --git a/Zstandard.Net.Tests/Zstandard.Net.Tests.csproj b/Zstandard.Net.Tests/Zstandard.Net.Tests.csproj
index ea5fa0e..cb8ab9f 100644
--- a/Zstandard.Net.Tests/Zstandard.Net.Tests.csproj
+++ b/Zstandard.Net.Tests/Zstandard.Net.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.0;net45
+ netstandard2.1
@@ -11,9 +11,9 @@
-
-
-
+
+
+
diff --git a/Zstandard.Net.sln b/Zstandard.Net.sln
index 25dd4aa..2e9a58b 100644
--- a/Zstandard.Net.sln
+++ b/Zstandard.Net.sln
@@ -1,16 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27130.2027
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31606.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zstandard.Net", "Zstandard.Net\Zstandard.Net.csproj", "{054BA829-FE7C-476C-A335-FB8CCB552F05}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zstandard.Net.Tests", "Zstandard.Net.Tests\Zstandard.Net.Tests.csproj", "{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zstandard.Net.Sandbox", "Zstandard.Net.Sandbox\Zstandard.Net.Sandbox.csproj", "{2F3734C8-67F5-42C4-BEE3-BCA10285E310}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zstandard.Net.Benchmark", "Zstandard.Net.Benchmark\Zstandard.Net.Benchmark.csproj", "{7273C9EE-8EBD-466B-8AC7-FFC830D15E19}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -25,14 +21,6 @@ Global
{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}.Release|Any CPU.Build.0 = Release|Any CPU
- {2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Release|Any CPU.Build.0 = Release|Any CPU
- {7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Zstandard.Net/Zstandard.Net.csproj b/Zstandard.Net/Zstandard.Net.csproj
index fe97d1f..fc0c00a 100644
--- a/Zstandard.Net/Zstandard.Net.csproj
+++ b/Zstandard.Net/Zstandard.Net.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net45
+ netstandard2.1
Zstandard.Net
true
bp74
@@ -11,28 +11,22 @@
https://github.com/bp74/Zstandard.Net/blob/master/LICENSE
https://github.com/bp74/Zstandard.Net
Compression Stream Zstandard Zstd
- fixed unmanaged resource leak
-
- 1.1.7
+ true
+ 1.1.8
-
+
x64\%(FileName)%(Extension)
PreserveNewest
-
- x86\%(FileName)%(Extension)
- PreserveNewest
-
-
+
-
+
-
diff --git a/Zstandard.Net/ZstandardInterop.cs b/Zstandard.Net/ZstandardInterop.cs
index 348e993..5f7bc17 100644
--- a/Zstandard.Net/ZstandardInterop.cs
+++ b/Zstandard.Net/ZstandardInterop.cs
@@ -12,7 +12,7 @@ static ZstandardInterop()
{
var root = Path.GetDirectoryName(typeof(ZstandardInterop).Assembly.Location);
var path = Environment.Is64BitProcess ? "x64" : "x86";
- var file = Path.Combine(root, path, "libzstd.dll");
+ var file = Path.Combine(root, path, "zstd.dll");
LoadLibraryEx(file, IntPtr.Zero, LoadLibraryFlags.LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
}
}
@@ -60,84 +60,84 @@ private enum LoadLibraryFlags : uint
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_versionNumber();
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern int ZSTD_maxCLevel();
//-----------------------------------------------------------------------------------------
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createCStream();
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initCStream(IntPtr zcs, int compressionLevel);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeCStream(IntPtr zcs);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CStreamInSize();
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CStreamOutSize();
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compressStream(IntPtr zcs, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer, [MarshalAs(UnmanagedType.LPStruct)] Buffer inputBuffer);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createCDict(IntPtr dictBuffer, UIntPtr dictSize, int compressionLevel);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeCDict(IntPtr cdict);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initCStream_usingCDict(IntPtr zcs, IntPtr cdict);
//-----------------------------------------------------------------------------------------
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createDStream();
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initDStream(IntPtr zds);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeDStream(IntPtr zds);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DStreamInSize();
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DStreamOutSize();
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_decompressStream(IntPtr zds, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer, [MarshalAs(UnmanagedType.LPStruct)] Buffer inputBuffer);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createDDict(IntPtr dictBuffer, UIntPtr dictSize);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeDDict(IntPtr ddict);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initDStream_usingDDict(IntPtr zds, IntPtr ddict);
//-----------------------------------------------------------------------------------------
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_flushStream(IntPtr zcs, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_endStream(IntPtr zcs, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer);
//-----------------------------------------------------------------------------------------
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
internal static extern bool ZSTD_isError(UIntPtr code);
- [DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr ZSTD_getErrorName(UIntPtr code);
}
}
diff --git a/Zstandard.Net/build/Zstandard.Net.targets b/Zstandard.Net/build/Zstandard.Net.targets
index 2b53408..0c0f42b 100644
--- a/Zstandard.Net/build/Zstandard.Net.targets
+++ b/Zstandard.Net/build/Zstandard.Net.targets
@@ -1,21 +1,7 @@
-
-
- x64\%(FileName)%(Extension)
- PreserveNewest
-
-
- x86\%(FileName)%(Extension)
- PreserveNewest
-
-
-
- %(FileName)%(Extension)
- PreserveNewest
-
-
+
%(FileName)%(Extension)
PreserveNewest
diff --git a/Zstandard.Net/build/x64/libzstd.dll b/Zstandard.Net/build/x64/libzstd.dll
deleted file mode 100644
index 29cd14d..0000000
Binary files a/Zstandard.Net/build/x64/libzstd.dll and /dev/null differ
diff --git a/Zstandard.Net/build/x86/libzstd.dll b/Zstandard.Net/build/x86/libzstd.dll
deleted file mode 100644
index 229bb2d..0000000
Binary files a/Zstandard.Net/build/x86/libzstd.dll and /dev/null differ
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..39a9fb5
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,17 @@
+#version: 1.0.{build}
+image: Visual Studio 2019
+
+branches:
+ only:
+ - feature/submodule
+
+build:
+ verbosity: minimal
+
+install:
+ - cd %APPVEYOR_BUILD_FOLDER%
+ - git submodule update --init --recursive
+
+build_script:
+ - cmake -G "Visual Studio 16 2019" -A x64 -B native_build -S zstd\build\cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_PROGRAMS=false -DZSTD_BUILD_CONTRIB=false -DZSTD_BUILD_SHARED=True -DCMAKE_INSTALL_PREFIX=.\Zstandard.Net\Zstandard.Net\build\x64 -DVcpkgEnabled=false
+ - msbuild native_build\zstd.sln /p:Configuration=Release /p:Platform="x64" /p:VcpkgEnabled=false /p:OutDir=.\Zstandard.Net\Zstandard.Net\build\x64
\ No newline at end of file
diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000..1d314c9
--- /dev/null
+++ b/build.bat
@@ -0,0 +1,3 @@
+REM cmake.exe -G "Visual Studio 16 2019" -A x64 -B native_build -S zstd\build\cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_PROGRAMS=false -DZSTD_BUILD_CONTRIB=false -DZSTD_BUILD_SHARED=True -DCMAKE_INSTALL_PREFIX=.\Zstandard.Net\Zstandard.Net\build\x64 -DVcpkgEnabled=false
+REM msbuild native_build\zstd.sln /p:Configuration=Release /p:Platform="x64" /p:VcpkgEnabled=false /p:OutDir=.\Zstandard.Net\Zstandard.Net\build\x64
+dotnet build -c Release
\ No newline at end of file
diff --git a/zstd b/zstd
new file mode 160000
index 0000000..a488ba1
--- /dev/null
+++ b/zstd
@@ -0,0 +1 @@
+Subproject commit a488ba114ec17ea1054b9057c26a046fc122b3b6