From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/zstd/build/.gitignore | 33 + src/zstd/build/LICENSE | 0 src/zstd/build/README.md | 56 ++ src/zstd/build/VS2008/fullbench/fullbench.vcproj | 549 +++++++++++++++++ src/zstd/build/VS2008/fuzzer/fuzzer.vcproj | 585 ++++++++++++++++++ src/zstd/build/VS2008/zstd.sln | 56 ++ src/zstd/build/VS2008/zstd/zstd.vcproj | 665 +++++++++++++++++++++ src/zstd/build/VS2008/zstdlib/zstdlib.vcproj | 635 ++++++++++++++++++++ src/zstd/build/VS2010/CompileAsCpp.props | 8 + src/zstd/build/VS2010/datagen/datagen.vcxproj | 168 ++++++ .../VS2010/fullbench-dll/fullbench-dll.vcxproj | 189 ++++++ src/zstd/build/VS2010/fullbench/fullbench.vcxproj | 218 +++++++ src/zstd/build/VS2010/fuzzer/fuzzer.vcxproj | 223 +++++++ src/zstd/build/VS2010/libzstd-dll/libzstd-dll.rc | 51 ++ .../build/VS2010/libzstd-dll/libzstd-dll.vcxproj | 254 ++++++++ src/zstd/build/VS2010/libzstd/libzstd.vcxproj | 247 ++++++++ src/zstd/build/VS2010/zstd.sln | 89 +++ src/zstd/build/VS2010/zstd/zstd.rc | 51 ++ src/zstd/build/VS2010/zstd/zstd.vcxproj | 257 ++++++++ src/zstd/build/VS_scripts/README.md | 64 ++ src/zstd/build/VS_scripts/build.VS2010.cmd | 7 + src/zstd/build/VS_scripts/build.VS2012.cmd | 6 + src/zstd/build/VS_scripts/build.VS2013.cmd | 7 + src/zstd/build/VS_scripts/build.VS2015.cmd | 7 + src/zstd/build/VS_scripts/build.VS2017.cmd | 7 + .../build/VS_scripts/build.VS2017Community.cmd | 7 + .../build/VS_scripts/build.VS2017Enterprise.cmd | 7 + .../build/VS_scripts/build.VS2017Professional.cmd | 7 + src/zstd/build/VS_scripts/build.generic.cmd | 62 ++ src/zstd/build/cmake/.gitignore | 10 + src/zstd/build/cmake/CMakeLists.txt | 203 +++++++ .../CMakeModules/AddZstdCompilationFlags.cmake | 79 +++ src/zstd/build/cmake/CMakeModules/FindLibLZ4.cmake | 49 ++ .../cmake/CMakeModules/GetZstdLibraryVersion.cmake | 10 + src/zstd/build/cmake/README.md | 104 ++++ src/zstd/build/cmake/contrib/CMakeLists.txt | 13 + .../build/cmake/contrib/gen_html/CMakeLists.txt | 30 + src/zstd/build/cmake/contrib/pzstd/CMakeLists.txt | 32 + src/zstd/build/cmake/lib/.gitignore | 2 + src/zstd/build/cmake/lib/CMakeLists.txt | 177 ++++++ src/zstd/build/cmake/lib/cmake_uninstall.cmake.in | 22 + src/zstd/build/cmake/lib/pkgconfig.cmake | 1 + src/zstd/build/cmake/programs/.gitignore | 5 + src/zstd/build/cmake/programs/CMakeLists.txt | 135 +++++ src/zstd/build/cmake/tests/.gitignore | 7 + src/zstd/build/cmake/tests/CMakeLists.txt | 106 ++++ src/zstd/build/cmake/zstdConfig.cmake | 1 + src/zstd/build/meson/GetZstdLibraryVersion.py | 39 ++ src/zstd/build/meson/InstallSymlink.py | 55 ++ src/zstd/build/meson/README.md | 38 ++ src/zstd/build/meson/contrib/gen_html/meson.build | 30 + src/zstd/build/meson/contrib/meson.build | 12 + src/zstd/build/meson/contrib/pzstd/meson.build | 24 + src/zstd/build/meson/lib/meson.build | 132 ++++ src/zstd/build/meson/meson.build | 147 +++++ src/zstd/build/meson/meson_options.txt | 36 ++ src/zstd/build/meson/programs/meson.build | 104 ++++ src/zstd/build/meson/tests/meson.build | 206 +++++++ src/zstd/build/meson/tests/valgrindTest.py | 90 +++ 59 files changed, 6414 insertions(+) create mode 100644 src/zstd/build/.gitignore create mode 100644 src/zstd/build/LICENSE create mode 100644 src/zstd/build/README.md create mode 100644 src/zstd/build/VS2008/fullbench/fullbench.vcproj create mode 100644 src/zstd/build/VS2008/fuzzer/fuzzer.vcproj create mode 100644 src/zstd/build/VS2008/zstd.sln create mode 100644 src/zstd/build/VS2008/zstd/zstd.vcproj create mode 100644 src/zstd/build/VS2008/zstdlib/zstdlib.vcproj create mode 100644 src/zstd/build/VS2010/CompileAsCpp.props create mode 100644 src/zstd/build/VS2010/datagen/datagen.vcxproj create mode 100644 src/zstd/build/VS2010/fullbench-dll/fullbench-dll.vcxproj create mode 100644 src/zstd/build/VS2010/fullbench/fullbench.vcxproj create mode 100644 src/zstd/build/VS2010/fuzzer/fuzzer.vcxproj create mode 100644 src/zstd/build/VS2010/libzstd-dll/libzstd-dll.rc create mode 100644 src/zstd/build/VS2010/libzstd-dll/libzstd-dll.vcxproj create mode 100644 src/zstd/build/VS2010/libzstd/libzstd.vcxproj create mode 100644 src/zstd/build/VS2010/zstd.sln create mode 100644 src/zstd/build/VS2010/zstd/zstd.rc create mode 100644 src/zstd/build/VS2010/zstd/zstd.vcxproj create mode 100644 src/zstd/build/VS_scripts/README.md create mode 100644 src/zstd/build/VS_scripts/build.VS2010.cmd create mode 100644 src/zstd/build/VS_scripts/build.VS2012.cmd create mode 100644 src/zstd/build/VS_scripts/build.VS2013.cmd create mode 100644 src/zstd/build/VS_scripts/build.VS2015.cmd create mode 100644 src/zstd/build/VS_scripts/build.VS2017.cmd create mode 100644 src/zstd/build/VS_scripts/build.VS2017Community.cmd create mode 100644 src/zstd/build/VS_scripts/build.VS2017Enterprise.cmd create mode 100644 src/zstd/build/VS_scripts/build.VS2017Professional.cmd create mode 100644 src/zstd/build/VS_scripts/build.generic.cmd create mode 100644 src/zstd/build/cmake/.gitignore create mode 100644 src/zstd/build/cmake/CMakeLists.txt create mode 100644 src/zstd/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake create mode 100644 src/zstd/build/cmake/CMakeModules/FindLibLZ4.cmake create mode 100644 src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake create mode 100644 src/zstd/build/cmake/README.md create mode 100644 src/zstd/build/cmake/contrib/CMakeLists.txt create mode 100644 src/zstd/build/cmake/contrib/gen_html/CMakeLists.txt create mode 100644 src/zstd/build/cmake/contrib/pzstd/CMakeLists.txt create mode 100644 src/zstd/build/cmake/lib/.gitignore create mode 100644 src/zstd/build/cmake/lib/CMakeLists.txt create mode 100644 src/zstd/build/cmake/lib/cmake_uninstall.cmake.in create mode 100644 src/zstd/build/cmake/lib/pkgconfig.cmake create mode 100644 src/zstd/build/cmake/programs/.gitignore create mode 100644 src/zstd/build/cmake/programs/CMakeLists.txt create mode 100644 src/zstd/build/cmake/tests/.gitignore create mode 100644 src/zstd/build/cmake/tests/CMakeLists.txt create mode 100644 src/zstd/build/cmake/zstdConfig.cmake create mode 100644 src/zstd/build/meson/GetZstdLibraryVersion.py create mode 100644 src/zstd/build/meson/InstallSymlink.py create mode 100644 src/zstd/build/meson/README.md create mode 100644 src/zstd/build/meson/contrib/gen_html/meson.build create mode 100644 src/zstd/build/meson/contrib/meson.build create mode 100644 src/zstd/build/meson/contrib/pzstd/meson.build create mode 100644 src/zstd/build/meson/lib/meson.build create mode 100644 src/zstd/build/meson/meson.build create mode 100644 src/zstd/build/meson/meson_options.txt create mode 100644 src/zstd/build/meson/programs/meson.build create mode 100644 src/zstd/build/meson/tests/meson.build create mode 100644 src/zstd/build/meson/tests/valgrindTest.py (limited to 'src/zstd/build') diff --git a/src/zstd/build/.gitignore b/src/zstd/build/.gitignore new file mode 100644 index 000000000..5a18b30a0 --- /dev/null +++ b/src/zstd/build/.gitignore @@ -0,0 +1,33 @@ +# Visual C++ +.vs/ +*Copy +*.db +*.opensdf +*.sdf +*.suo +*.user +*.opendb + +VS2008/bin/ +VS2010/bin/ +VS2010/zwrapbench/ +VS2012/ +VS2013/ +VS2015/ +Studio* + +# CMake +cmake/build/ +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +build +lib +!cmake/lib +!meson/lib diff --git a/src/zstd/build/LICENSE b/src/zstd/build/LICENSE new file mode 100644 index 000000000..e69de29bb diff --git a/src/zstd/build/README.md b/src/zstd/build/README.md new file mode 100644 index 000000000..23f92cef1 --- /dev/null +++ b/src/zstd/build/README.md @@ -0,0 +1,56 @@ +Projects for various integrated development environments (IDE) +============================================================== + +#### Included projects + +The following projects are included with the zstd distribution: +- `cmake` - CMake project contributed by Artyom Dymchenko +- `VS2005` - Visual Studio 2005 Project (this project has been moved to the contrib directory and will no longer be supported) +- `VS2008` - Visual Studio 2008 project +- `VS2010` - Visual Studio 2010 project (which also works well with Visual Studio 2012, 2013, 2015) +- `VS_scripts` - command line scripts prepared for Visual Studio compilation without IDE + + +#### How to compile zstd with Visual Studio + +1. Install Visual Studio e.g. VS 2015 Community Edition (it's free). +2. Download the latest version of zstd from https://github.com/facebook/zstd/releases +3. Decompress ZIP archive. +4. Go to decompressed directory then to `projects` then `VS2010` and open `zstd.sln` +5. Visual Studio will ask about converting VS2010 project to VS2015 and you should agree. +6. Change `Debug` to `Release` and if you have 64-bit Windows change also `Win32` to `x64`. +7. Press F7 on keyboard or select `BUILD` from the menu bar and choose `Build Solution`. +8. If compilation will be fine a compiled executable will be in `projects\VS2010\bin\x64\Release\zstd.exe` + + +#### Projects available within zstd.sln + +The Visual Studio solution file `visual\VS2010\zstd.sln` contains many projects that will be compiled to the +`visual\VS2010\bin\$(Platform)_$(Configuration)` directory. For example `zstd` set to `x64` and +`Release` will be compiled to `visual\VS2010\bin\x64_Release\zstd.exe`. The solution file contains the +following projects: + +- `zstd` : Command Line Utility, supporting gzip-like arguments +- `datagen` : Synthetic and parametrable data generator, for tests +- `fullbench` : Precisely measure speed for each zstd inner functions +- `fuzzer` : Test tool, to check zstd integrity on target platform +- `libzstd` : A static ZSTD library compiled to `libzstd_static.lib` +- `libzstd-dll` : A dynamic ZSTD library (DLL) compiled to `libzstd.dll` with the import library `libzstd.lib` +- `fullbench-dll` : The fullbench program compiled with the import library; the executable requires ZSTD DLL + + +#### Using ZSTD DLL with Microsoft Visual C++ project + +The header file `lib\zstd.h` and the import library +`visual\VS2010\bin\$(Platform)_$(Configuration)\libzstd.lib` are required to compile +a project using Visual C++. + +1. The path to header files should be added to `Additional Include Directories` that can + be found in Project Properties of Visual Studio IDE in the `C/C++` Property Pages on the `General` page. +2. The import library has to be added to `Additional Dependencies` that can + be found in Project Properties in the `Linker` Property Pages on the `Input` page. + If one will provide only the name `libzstd.lib` without a full path to the library + then the directory has to be added to `Linker\General\Additional Library Directories`. + +The compiled executable will require ZSTD DLL which is available at +`visual\VS2010\bin\$(Platform)_$(Configuration)\libzstd.dll`. diff --git a/src/zstd/build/VS2008/fullbench/fullbench.vcproj b/src/zstd/build/VS2008/fullbench/fullbench.vcproj new file mode 100644 index 000000000..5752643f9 --- /dev/null +++ b/src/zstd/build/VS2008/fullbench/fullbench.vcproj @@ -0,0 +1,549 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/zstd/build/VS2008/fuzzer/fuzzer.vcproj b/src/zstd/build/VS2008/fuzzer/fuzzer.vcproj new file mode 100644 index 000000000..d48bc0fab --- /dev/null +++ b/src/zstd/build/VS2008/fuzzer/fuzzer.vcproj @@ -0,0 +1,585 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/zstd/build/VS2008/zstd.sln b/src/zstd/build/VS2008/zstd.sln new file mode 100644 index 000000000..97b88c8d0 --- /dev/null +++ b/src/zstd/build/VS2008/zstd.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zstd", "zstd\zstd.vcproj", "{1A2AB08E-5CE7-4C5B-BE55-458157C14051}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fuzzer", "fuzzer\fuzzer.vcproj", "{A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench", "fullbench\fullbench.vcproj", "{CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zstdlib", "zstdlib\zstdlib.vcproj", "{99DE2A79-7298-4004-A0ED-030D7A3796CA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Debug|Win32.ActiveCfg = Debug|Win32 + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Debug|Win32.Build.0 = Debug|Win32 + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Debug|x64.ActiveCfg = Debug|x64 + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Debug|x64.Build.0 = Debug|x64 + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Release|Win32.ActiveCfg = Release|Win32 + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Release|Win32.Build.0 = Release|Win32 + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Release|x64.ActiveCfg = Release|x64 + {1A2AB08E-5CE7-4C5B-BE55-458157C14051}.Release|x64.Build.0 = Release|x64 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Debug|Win32.ActiveCfg = Debug|Win32 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Debug|Win32.Build.0 = Debug|Win32 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Debug|x64.ActiveCfg = Debug|x64 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Debug|x64.Build.0 = Debug|x64 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Release|Win32.ActiveCfg = Release|Win32 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Release|Win32.Build.0 = Release|Win32 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Release|x64.ActiveCfg = Release|x64 + {A62E89D2-9DDE-42BA-8F9B-9DA74889A6B0}.Release|x64.Build.0 = Release|x64 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Debug|Win32.ActiveCfg = Debug|Win32 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Debug|Win32.Build.0 = Debug|Win32 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Debug|x64.ActiveCfg = Debug|x64 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Debug|x64.Build.0 = Debug|x64 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Release|Win32.ActiveCfg = Release|Win32 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Release|Win32.Build.0 = Release|Win32 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Release|x64.ActiveCfg = Release|x64 + {CC8F1D1B-BA2F-43E3-A71F-FA415D81AAD3}.Release|x64.Build.0 = Release|x64 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Debug|Win32.ActiveCfg = Debug|Win32 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Debug|Win32.Build.0 = Debug|Win32 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Debug|x64.ActiveCfg = Debug|x64 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Debug|x64.Build.0 = Debug|x64 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Release|Win32.ActiveCfg = Release|Win32 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Release|Win32.Build.0 = Release|Win32 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Release|x64.ActiveCfg = Release|x64 + {99DE2A79-7298-4004-A0ED-030D7A3796CA}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/zstd/build/VS2008/zstd/zstd.vcproj b/src/zstd/build/VS2008/zstd/zstd.vcproj new file mode 100644 index 000000000..ab02e6155 --- /dev/null +++ b/src/zstd/build/VS2008/zstd/zstd.vcproj @@ -0,0 +1,665 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/zstd/build/VS2008/zstdlib/zstdlib.vcproj b/src/zstd/build/VS2008/zstdlib/zstdlib.vcproj new file mode 100644 index 000000000..5eb49f9b2 --- /dev/null +++ b/src/zstd/build/VS2008/zstdlib/zstdlib.vcproj @@ -0,0 +1,635 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/zstd/build/VS2010/CompileAsCpp.props b/src/zstd/build/VS2010/CompileAsCpp.props new file mode 100644 index 000000000..372a94b1f --- /dev/null +++ b/src/zstd/build/VS2010/CompileAsCpp.props @@ -0,0 +1,8 @@ + + + + + CompileAsCpp + + + diff --git a/src/zstd/build/VS2010/datagen/datagen.vcxproj b/src/zstd/build/VS2010/datagen/datagen.vcxproj new file mode 100644 index 000000000..a66358a0d --- /dev/null +++ b/src/zstd/build/VS2010/datagen/datagen.vcxproj @@ -0,0 +1,168 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {037E781E-81A6-494B-B1B3-438AB1200523} + Win32Proj + datagen + $(SolutionDir)bin\$(Platform)_$(Configuration)\ + $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ + + + + Application + true + MultiByte + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + + + + + true + false + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + + + true + false + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + + + false + false + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + + + false + false + $(IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + + + + + + Level4 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + + + Level4 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + Level4 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + + + + + Level4 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + + + + + + + + + + + + + + diff --git a/src/zstd/build/VS2010/fullbench-dll/fullbench-dll.vcxproj b/src/zstd/build/VS2010/fullbench-dll/fullbench-dll.vcxproj new file mode 100644 index 000000000..befdc0445 --- /dev/null +++ b/src/zstd/build/VS2010/fullbench-dll/fullbench-dll.vcxproj @@ -0,0 +1,189 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8} + Win32Proj + fullbench-dll + $(SolutionDir)bin\$(Platform)_$(Configuration)\ + $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ + + + + Application + true + MultiByte + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + + + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + + + + Level4 + Disabled + WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions) + true + false + + + Console + true + $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) + libzstd.lib;%(AdditionalDependencies) + false + + + + + + + Level4 + Disabled + WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions) + true + false + + + Console + true + $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) + libzstd.lib;%(AdditionalDependencies) + + + + + Level4 + + + MaxSpeed + true + true + WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) + libzstd.lib;%(AdditionalDependencies) + false + + + + + Level4 + + + MaxSpeed + true + true + WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) + libzstd.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + {00000000-94d5-4bf9-8a50-7bd9929a0850} + + + + + + diff --git a/src/zstd/build/VS2010/fullbench/fullbench.vcxproj b/src/zstd/build/VS2010/fullbench/fullbench.vcxproj new file mode 100644 index 000000000..20932fa37 --- /dev/null +++ b/src/zstd/build/VS2010/fullbench/fullbench.vcxproj @@ -0,0 +1,218 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8} + Win32Proj + fullbench + $(SolutionDir)bin\$(Platform)_$(Configuration)\ + $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ + + + + Application + true + MultiByte + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + + + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(UniversalCRT_IncludePath); + false + + + + + + Level4 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + + + Level4 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + Level4 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + + + + + Level4 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/zstd/build/VS2010/fuzzer/fuzzer.vcxproj b/src/zstd/build/VS2010/fuzzer/fuzzer.vcxproj new file mode 100644 index 000000000..842757281 --- /dev/null +++ b/src/zstd/build/VS2010/fuzzer/fuzzer.vcxproj @@ -0,0 +1,223 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {6FD4352B-346C-4703-96EA-D4A8B9A6976E} + Win32Proj + fuzzer + $(SolutionDir)bin\$(Platform)_$(Configuration)\ + $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ + + + + Application + true + MultiByte + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + + + + + true + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress;$(UniversalCRT_IncludePath); + + + true + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress;$(UniversalCRT_IncludePath); + + + false + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress;$(UniversalCRT_IncludePath); + + + false + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress;$(UniversalCRT_IncludePath); + + + + + + Level4 + Disabled + ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + + + Level4 + Disabled + ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/zstd/build/VS2010/libzstd-dll/libzstd-dll.rc b/src/zstd/build/VS2010/libzstd-dll/libzstd-dll.rc new file mode 100644 index 000000000..ee9f56280 --- /dev/null +++ b/src/zstd/build/VS2010/libzstd-dll/libzstd-dll.rc @@ -0,0 +1,51 @@ +// Microsoft Visual C++ generated resource script. +// + +#include "zstd.h" /* ZSTD_VERSION_STRING */ +#define APSTUDIO_READONLY_SYMBOLS +#include "verrsrc.h" +#undef APSTUDIO_READONLY_SYMBOLS + + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION ZSTD_VERSION_MAJOR,ZSTD_VERSION_MINOR,ZSTD_VERSION_RELEASE,0 + PRODUCTVERSION ZSTD_VERSION_MAJOR,ZSTD_VERSION_MINOR,ZSTD_VERSION_RELEASE,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Yann Collet, Facebook, Inc." + VALUE "FileDescription", "Zstandard - Fast and efficient compression algorithm" + VALUE "FileVersion", ZSTD_VERSION_STRING + VALUE "InternalName", "libzstd.dll" + VALUE "LegalCopyright", "Copyright (c) 2013-present, Yann Collet, Facebook, Inc." + VALUE "OriginalFilename", "libzstd.dll" + VALUE "ProductName", "Zstandard" + VALUE "ProductVersion", ZSTD_VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END + +#endif diff --git a/src/zstd/build/VS2010/libzstd-dll/libzstd-dll.vcxproj b/src/zstd/build/VS2010/libzstd-dll/libzstd-dll.vcxproj new file mode 100644 index 000000000..0957d413b --- /dev/null +++ b/src/zstd/build/VS2010/libzstd-dll/libzstd-dll.vcxproj @@ -0,0 +1,254 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {00000000-94D5-4BF9-8A50-7BD9929A0850} + Win32Proj + libzstd-dll + $(SolutionDir)bin\$(Platform)_$(Configuration)\ + $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ + + + + DynamicLibrary + true + MultiByte + + + DynamicLibrary + true + MultiByte + + + DynamicLibrary + false + true + MultiByte + + + DynamicLibrary + false + true + MultiByte + + + + + + + + + + + + + + + + + + + true + libzstd + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + true + libzstd + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + false + libzstd + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + false + libzstd + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + + + + Level4 + Disabled + ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + EditAndContinue + true + false + + + Console + true + MachineX86 + + + + + + + Level4 + Disabled + ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + ProgramDatabase + false + + + Console + true + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + MultiThreaded + ProgramDatabase + + + Console + true + true + true + MachineX86 + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + false + MultiThreaded + ProgramDatabase + true + true + + + Console + true + true + true + + + + + + diff --git a/src/zstd/build/VS2010/libzstd/libzstd.vcxproj b/src/zstd/build/VS2010/libzstd/libzstd.vcxproj new file mode 100644 index 000000000..203429355 --- /dev/null +++ b/src/zstd/build/VS2010/libzstd/libzstd.vcxproj @@ -0,0 +1,247 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850} + Win32Proj + libzstd + libzstd_static + MultiByte + StaticLibrary + $(SolutionDir)bin\$(Platform)_$(Configuration)\ + $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ + + + + true + + + true + + + false + true + + + false + true + + + + + + + + + + + + + + + + + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + + + + $(OutDir)$(TargetName).pdb + + + + + + + Level4 + Disabled + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + EditAndContinue + true + false + + + Console + true + MachineX86 + + + + + + + Level4 + Disabled + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + ProgramDatabase + false + + + Console + true + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + MultiThreaded + ProgramDatabase + + + Console + true + true + true + MachineX86 + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + false + MultiThreaded + ProgramDatabase + true + true + + + Console + true + true + true + + + + + + diff --git a/src/zstd/build/VS2010/zstd.sln b/src/zstd/build/VS2010/zstd.sln new file mode 100644 index 000000000..12032db44 --- /dev/null +++ b/src/zstd/build/VS2010/zstd.sln @@ -0,0 +1,89 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2012 for Windows Desktop +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zstd", "zstd\zstd.vcxproj", "{4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fuzzer", "fuzzer\fuzzer.vcxproj", "{6FD4352B-346C-4703-96EA-D4A8B9A6976E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench", "fullbench\fullbench.vcxproj", "{61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll\fullbench-dll.vcxproj", "{00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}" + ProjectSection(ProjectDependencies) = postProject + {00000000-94D5-4BF9-8A50-7BD9929A0850} = {00000000-94D5-4BF9-8A50-7BD9929A0850} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datagen", "datagen\datagen.vcxproj", "{037E781E-81A6-494B-B1B3-438AB1200523}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzstd", "libzstd\libzstd.vcxproj", "{8BFD8150-94D5-4BF9-8A50-7BD9929A0850}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzstd-dll", "libzstd-dll\libzstd-dll.vcxproj", "{00000000-94D5-4BF9-8A50-7BD9929A0850}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Debug|Win32.ActiveCfg = Debug|Win32 + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Debug|Win32.Build.0 = Debug|Win32 + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Debug|x64.ActiveCfg = Debug|x64 + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Debug|x64.Build.0 = Debug|x64 + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Release|Win32.ActiveCfg = Release|Win32 + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Release|Win32.Build.0 = Release|Win32 + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Release|x64.ActiveCfg = Release|x64 + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C}.Release|x64.Build.0 = Release|x64 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Debug|Win32.ActiveCfg = Debug|Win32 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Debug|Win32.Build.0 = Debug|Win32 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Debug|x64.ActiveCfg = Debug|x64 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Debug|x64.Build.0 = Debug|x64 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Release|Win32.ActiveCfg = Release|Win32 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Release|Win32.Build.0 = Release|Win32 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Release|x64.ActiveCfg = Release|x64 + {6FD4352B-346C-4703-96EA-D4A8B9A6976E}.Release|x64.Build.0 = Release|x64 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|Win32.Build.0 = Debug|Win32 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|x64.ActiveCfg = Debug|x64 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|x64.Build.0 = Debug|x64 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|Win32.ActiveCfg = Release|Win32 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|Win32.Build.0 = Release|Win32 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|x64.ActiveCfg = Release|x64 + {61ABD629-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|x64.Build.0 = Release|x64 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|Win32.Build.0 = Debug|Win32 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|x64.ActiveCfg = Debug|x64 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Debug|x64.Build.0 = Debug|x64 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|Win32.ActiveCfg = Release|Win32 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|Win32.Build.0 = Release|Win32 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|x64.ActiveCfg = Release|x64 + {00000000-1CC8-4FD7-9281-6B8DBB9D3DF8}.Release|x64.Build.0 = Release|x64 + {037E781E-81A6-494B-B1B3-438AB1200523}.Debug|Win32.ActiveCfg = Debug|Win32 + {037E781E-81A6-494B-B1B3-438AB1200523}.Debug|Win32.Build.0 = Debug|Win32 + {037E781E-81A6-494B-B1B3-438AB1200523}.Debug|x64.ActiveCfg = Debug|x64 + {037E781E-81A6-494B-B1B3-438AB1200523}.Debug|x64.Build.0 = Debug|x64 + {037E781E-81A6-494B-B1B3-438AB1200523}.Release|Win32.ActiveCfg = Release|Win32 + {037E781E-81A6-494B-B1B3-438AB1200523}.Release|Win32.Build.0 = Release|Win32 + {037E781E-81A6-494B-B1B3-438AB1200523}.Release|x64.ActiveCfg = Release|x64 + {037E781E-81A6-494B-B1B3-438AB1200523}.Release|x64.Build.0 = Release|x64 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Debug|Win32.ActiveCfg = Debug|Win32 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Debug|Win32.Build.0 = Debug|Win32 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Debug|x64.ActiveCfg = Debug|x64 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Debug|x64.Build.0 = Debug|x64 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Release|Win32.ActiveCfg = Release|Win32 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Release|Win32.Build.0 = Release|Win32 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Release|x64.ActiveCfg = Release|x64 + {8BFD8150-94D5-4BF9-8A50-7BD9929A0850}.Release|x64.Build.0 = Release|x64 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Debug|Win32.ActiveCfg = Debug|Win32 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Debug|Win32.Build.0 = Debug|Win32 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Debug|x64.ActiveCfg = Debug|x64 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Debug|x64.Build.0 = Debug|x64 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Release|Win32.ActiveCfg = Release|Win32 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Release|Win32.Build.0 = Release|Win32 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Release|x64.ActiveCfg = Release|x64 + {00000000-94D5-4BF9-8A50-7BD9929A0850}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/zstd/build/VS2010/zstd/zstd.rc b/src/zstd/build/VS2010/zstd/zstd.rc new file mode 100644 index 000000000..f5e404730 --- /dev/null +++ b/src/zstd/build/VS2010/zstd/zstd.rc @@ -0,0 +1,51 @@ +// Microsoft Visual C++ generated resource script. +// + +#include "zstd.h" /* ZSTD_VERSION_STRING */ +#define APSTUDIO_READONLY_SYMBOLS +#include "verrsrc.h" +#undef APSTUDIO_READONLY_SYMBOLS + + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION ZSTD_VERSION_MAJOR,ZSTD_VERSION_MINOR,ZSTD_VERSION_RELEASE,0 + PRODUCTVERSION ZSTD_VERSION_MAJOR,ZSTD_VERSION_MINOR,ZSTD_VERSION_RELEASE,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Yann Collet, Facebook, Inc." + VALUE "FileDescription", "Zstandard - Fast and efficient compression algorithm" + VALUE "FileVersion", ZSTD_VERSION_STRING + VALUE "InternalName", "zstd.exe" + VALUE "LegalCopyright", "Copyright (c) 2013-present, Yann Collet, Facebook, Inc." + VALUE "OriginalFilename", "zstd.exe" + VALUE "ProductName", "Zstandard" + VALUE "ProductVersion", ZSTD_VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END + +#endif diff --git a/src/zstd/build/VS2010/zstd/zstd.vcxproj b/src/zstd/build/VS2010/zstd/zstd.vcxproj new file mode 100644 index 000000000..e320d88a1 --- /dev/null +++ b/src/zstd/build/VS2010/zstd/zstd.vcxproj @@ -0,0 +1,257 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {4E52A41A-F33B-4C7A-8C36-A1A6B4F4277C} + Win32Proj + zstd + $(SolutionDir)bin\$(Platform)_$(Configuration)\ + $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ + + + + Application + true + MultiByte + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + + + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + $(LibraryPath) + + + true + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + $(LibraryPath); + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + $(LibraryPath) + + + false + $(IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(UniversalCRT_IncludePath); + false + $(LibraryPath); + + + + + + Level4 + Disabled + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + setargv.obj;%(AdditionalDependencies) + + + + + + + Level4 + Disabled + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + false + + + Console + true + setargv.obj;%(AdditionalDependencies) + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + + + Console + true + true + true + setargv.obj;%(AdditionalDependencies) + + + + + Level4 + + + MaxSpeed + true + true + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + MultiThreaded + /DZSTD_MULTITHREAD %(AdditionalOptions) + + + Console + true + true + true + setargv.obj;%(AdditionalDependencies) + + + + + + diff --git a/src/zstd/build/VS_scripts/README.md b/src/zstd/build/VS_scripts/README.md new file mode 100644 index 000000000..6ccaca788 --- /dev/null +++ b/src/zstd/build/VS_scripts/README.md @@ -0,0 +1,64 @@ +Command line scripts for Visual Studio compilation without IDE +============================================================== + +Here are a few command lines for reference : + +### Build with Visual Studio 2013 for msvcr120.dll + +Running the following command will build both the `Release Win32` and `Release x64` versions: +```batch +build.VS2013.cmd +``` +The result of each build will be in the corresponding `bin\Release\{ARCH}\` folder. + +If you want to only need one architecture: +- Win32: `build.generic.cmd VS2013 Win32 Release v120` +- x64: `build.generic.cmd VS2013 x64 Release v120` + +If you want a Debug build: +- Win32: `build.generic.cmd VS2013 Win32 Debug v120` +- x64: `build.generic.cmd VS2013 x64 Debug v120` + +### Build with Visual Studio 2015 for msvcr140.dll + +Running the following command will build both the `Release Win32` and `Release x64` versions: +```batch +build.VS2015.cmd +``` +The result of each build will be in the corresponding `bin\Release\{ARCH}\` folder. + +If you want to only need one architecture: +- Win32: `build.generic.cmd VS2015 Win32 Release v140` +- x64: `build.generic.cmd VS2015 x64 Release v140` + +If you want a Debug build: +- Win32: `build.generic.cmd VS2015 Win32 Debug v140` +- x64: `build.generic.cmd VS2015 x64 Debug v140` + +### Build with Visual Studio 2015 for msvcr120.dll + +This capability is offered through `build.generic.cmd` using proper arguments: + +**For Win32** +```batch +build.generic.cmd VS2015 Win32 Release v120 +``` +The result of the build will be in the `bin\Release\Win32\` folder. + +**For x64** +```batch +build.generic.cmd VS2015 x64 Release v120 +``` +The result of the build will be in the `bin\Release\x64\` folder. + +If you want Debug builds, replace `Release` with `Debug`. + +### Build with Visual Studio 2017 + +`build.VS2017.cmd`, contributed by [@HaydnTrigg](https://github.com/HaydnTrigg), +will build both the `Release Win32` and `Release x64` versions +of the first VS2017 variant it finds, in this priority order : +Enterprise > Professional > Community + +Alternatively, it's possible to target a specific version, +using appropriate script, such as `build.VS2017Enterprise.cmd` for example. diff --git a/src/zstd/build/VS_scripts/build.VS2010.cmd b/src/zstd/build/VS_scripts/build.VS2010.cmd new file mode 100644 index 000000000..c3bc1763e --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2010.cmd @@ -0,0 +1,7 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2010 Win32 Release v100 + +rem build 64-bit +call "%~p0%build.generic.cmd" VS2010 x64 Release v100 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.VS2012.cmd b/src/zstd/build/VS_scripts/build.VS2012.cmd new file mode 100644 index 000000000..d7399a9d6 --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2012.cmd @@ -0,0 +1,6 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2012 Win32 Release v110 +rem build 64-bit +call "%~p0%build.generic.cmd" VS2012 x64 Release v110 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.VS2013.cmd b/src/zstd/build/VS_scripts/build.VS2013.cmd new file mode 100644 index 000000000..486ba6cf0 --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2013.cmd @@ -0,0 +1,7 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2013 Win32 Release v120 + +rem build 64-bit +call "%~p0%build.generic.cmd" VS2013 x64 Release v120 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.VS2015.cmd b/src/zstd/build/VS_scripts/build.VS2015.cmd new file mode 100644 index 000000000..abc41c9a0 --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2015.cmd @@ -0,0 +1,7 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2015 Win32 Release v140 + +rem build 64-bit +call "%~p0%build.generic.cmd" VS2015 x64 Release v140 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.VS2017.cmd b/src/zstd/build/VS_scripts/build.VS2017.cmd new file mode 100644 index 000000000..a810faa53 --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2017.cmd @@ -0,0 +1,7 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2017 Win32 Release v141 + +rem build 64-bit +call "%~p0%build.generic.cmd" VS2017 x64 Release v141 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.VS2017Community.cmd b/src/zstd/build/VS_scripts/build.VS2017Community.cmd new file mode 100644 index 000000000..133e1b456 --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2017Community.cmd @@ -0,0 +1,7 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2017Community Win32 Release v141 + +rem build 64-bit +call "%~p0%build.generic.cmd" VS2017Community x64 Release v141 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.VS2017Enterprise.cmd b/src/zstd/build/VS_scripts/build.VS2017Enterprise.cmd new file mode 100644 index 000000000..6a7093205 --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2017Enterprise.cmd @@ -0,0 +1,7 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2017Enterprise Win32 Release v141 + +rem build 64-bit +call "%~p0%build.generic.cmd" VS2017Enterprise x64 Release v141 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.VS2017Professional.cmd b/src/zstd/build/VS_scripts/build.VS2017Professional.cmd new file mode 100644 index 000000000..d183519df --- /dev/null +++ b/src/zstd/build/VS_scripts/build.VS2017Professional.cmd @@ -0,0 +1,7 @@ +@echo off + +rem build 32-bit +call "%~p0%build.generic.cmd" VS2017Professional Win32 Release v141 + +rem build 64-bit +call "%~p0%build.generic.cmd" VS2017Professional x64 Release v141 \ No newline at end of file diff --git a/src/zstd/build/VS_scripts/build.generic.cmd b/src/zstd/build/VS_scripts/build.generic.cmd new file mode 100644 index 000000000..a7ca4d067 --- /dev/null +++ b/src/zstd/build/VS_scripts/build.generic.cmd @@ -0,0 +1,62 @@ +@echo off + +IF "%1%" == "" GOTO display_help + +SETLOCAL + +SET msbuild_version=%1 + +SET msbuild_platform=%2 +IF "%msbuild_platform%" == "" SET msbuild_platform=x64 + +SET msbuild_configuration=%3 +IF "%msbuild_configuration%" == "" SET msbuild_configuration=Release + +SET msbuild_toolset=%4 + +GOTO build + +:display_help + +echo Syntax: build.generic.cmd msbuild_version msbuild_platform msbuild_configuration msbuild_toolset +echo msbuild_version: VS installed version (VS2012, VS2013, VS2015, VS2017, ...) +echo msbuild_platform: Platform (x64 or Win32) +echo msbuild_configuration: VS configuration (Release or Debug) +echo msbuild_toolset: Platform Toolset (v100, v110, v120, v140, v141) + +EXIT /B 1 + +:build + +SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" +SET msbuild_vs2017community="%programfiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" +SET msbuild_vs2017professional="%programfiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" +SET msbuild_vs2017enterprise="%programfiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" +IF %msbuild_version% == VS2013 SET msbuild="%programfiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe" +IF %msbuild_version% == VS2015 SET msbuild="%programfiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" +IF %msbuild_version% == VS2017Community SET msbuild=%msbuild_vs2017community% +IF %msbuild_version% == VS2017Professional SET msbuild=%msbuild_vs2017professional% +IF %msbuild_version% == VS2017Enterprise SET msbuild=%msbuild_vs2017enterprise% +IF %msbuild_version% == VS2017 ( + IF EXIST %msbuild_vs2017community% SET msbuild=%msbuild_vs2017community% + IF EXIST %msbuild_vs2017professional% SET msbuild=%msbuild_vs2017professional% + IF EXIST %msbuild_vs2017enterprise% SET msbuild=%msbuild_vs2017enterprise% +) + +SET project="%~p0\..\VS2010\zstd.sln" + +SET msbuild_params=/verbosity:minimal /nologo /t:Clean,Build /p:Platform=%msbuild_platform% /p:Configuration=%msbuild_configuration% +IF NOT "%msbuild_toolset%" == "" SET msbuild_params=%msbuild_params% /p:PlatformToolset=%msbuild_toolset% + +SET output=%~p0%bin +SET output="%output%/%msbuild_configuration%/%msbuild_platform%/" +SET msbuild_params=%msbuild_params% /p:OutDir=%output% + +echo ### Building %msbuild_version% project for %msbuild_configuration% %msbuild_platform% (%msbuild_toolset%)... +echo ### Build Params: %msbuild_params% + +%msbuild% %project% %msbuild_params% +IF ERRORLEVEL 1 EXIT /B 1 +echo # Success +echo # OutDir: %output% +echo # diff --git a/src/zstd/build/cmake/.gitignore b/src/zstd/build/cmake/.gitignore new file mode 100644 index 000000000..2e51e8954 --- /dev/null +++ b/src/zstd/build/cmake/.gitignore @@ -0,0 +1,10 @@ +# cmake working directory +cmakeBuild + +# cmake artefacts +CMakeCache.txt +CMakeFiles +Makefile +cmake_install.cmake +cmake_uninstall.cmake +*.1 diff --git a/src/zstd/build/cmake/CMakeLists.txt b/src/zstd/build/cmake/CMakeLists.txt new file mode 100644 index 000000000..9b5d7efb8 --- /dev/null +++ b/src/zstd/build/cmake/CMakeLists.txt @@ -0,0 +1,203 @@ +# ################################################################ +# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) + +# As of 2018-12-26 ZSTD has been validated to build with cmake version 3.13.2 new policies. +# Set and use the newest cmake policies that are validated to work +set(ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION "3") +set(ZSTD_MAX_VALIDATED_CMAKE_MINOR_VERSION "13") #Policies never changed at PATCH level +if("${CMAKE_MAJOR_VERSION}" LESS 3) + set(ZSTD_CMAKE_POLICY_VERSION "${CMAKE_VERSION}") +elseif( "${ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION}" EQUAL "${CMAKE_MAJOR_VERSION}" AND + "${ZSTD_MAX_VALIDATED_CMAKE_MINOR_VERSION}" GREATER "${CMAKE_MINOR_VERSION}") + set(ZSTD_CMAKE_POLICY_VERSION "${CMAKE_VERSION}") +else() + set(ZSTD_CMAKE_POLICY_VERSION "${ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION}.${ZSTD_MAX_VALIDATED_CMAKE_MINOR_VERSION}.0") +endif() +cmake_policy(VERSION ${ZSTD_CMAKE_POLICY_VERSION}) + +set(CMAKE_BUILD_WITH_INSTALL_RPATH on) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") +set(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib) +# Parse version +include(GetZstdLibraryVersion) +GetZstdLibraryVersion(${LIBRARY_DIR}/zstd.h zstd_VERSION_MAJOR zstd_VERSION_MINOR zstd_VERSION_PATCH) + +if( CMAKE_MAJOR_VERSION LESS 3 ) + ## Provide cmake 3+ behavior for older versions of cmake + project(zstd) + set(PROJECT_VERSION_MAJOR ${zstd_VERSION_MAJOR}) + set(PROJECT_VERSION_MINOR ${zstd_VERSION_MINOR}) + set(PROJECT_VERSION_PATCH ${zstd_VERSION_PATCH}) + set(PROJECT_VERSION "${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}") + enable_language(C) # Main library is in C + enable_language(CXX) # Testing contributed code also utilizes CXX +else() + project(zstd + VERSION "${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}" + LANGUAGES C # Main library is in C + CXX # Testing contributed code also utilizes CXX + ) +endif() +message(STATUS "ZSTD VERSION: ${zstd_VERSION}") +set(zstd_HOMEPAGE_URL "http://www.zstd.net") +set(zstd_DESCRIPTION "Zstandard is a real-time compression algorithm, providing high compression ratios.") + +# Set a default build type if none was specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +include(GNUInstallDirs) + +#----------------------------------------------------------------------------- +# Add extra compilation flags +#----------------------------------------------------------------------------- +include(AddZstdCompilationFlags) +ADD_ZSTD_COMPILATION_FLAGS() + +# Always hide XXHash symbols +add_definitions(-DXXH_NAMESPACE=ZSTD_) + +#----------------------------------------------------------------------------- +# Installation variables +#----------------------------------------------------------------------------- +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}") + +#----------------------------------------------------------------------------- +# Options +#----------------------------------------------------------------------------- + +# Legacy support +option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF) + +if (ZSTD_LEGACY_SUPPORT) + message(STATUS "ZSTD_LEGACY_SUPPORT defined!") + add_definitions(-DZSTD_LEGACY_SUPPORT=5) +else () + message(STATUS "ZSTD_LEGACY_SUPPORT not defined!") + add_definitions(-DZSTD_LEGACY_SUPPORT=0) +endif () + +# Multi-threading support +option(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON) + +if (ZSTD_MULTITHREAD_SUPPORT) + message(STATUS "ZSTD_MULTITHREAD_SUPPORT is enabled") +else () + message(STATUS "ZSTD_MULTITHREAD_SUPPORT is disabled") +endif () + +option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON) +option(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF) + +# Respect the conventional CMake option for enabling tests if it was specified on the first configure +if (BUILD_TESTING) + set(ZSTD_BUILD_TESTS_default ON) +else() + set(ZSTD_BUILD_TESTS_default OFF) +endif() +option(ZSTD_BUILD_TESTS "BUILD TESTS" ${ZSTD_BUILD_TESTS_default}) +if (MSVC) + option(ZSTD_USE_STATIC_RUNTIME "LINK TO STATIC RUN-TIME LIBRARIES" OFF) +endif () + +#----------------------------------------------------------------------------- +# External dependencies +#----------------------------------------------------------------------------- +if (ZSTD_MULTITHREAD_SUPPORT AND UNIX) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + if(CMAKE_USE_PTHREADS_INIT) + set(THREADS_LIBS "${CMAKE_THREAD_LIBS_INIT}") + else() + message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads") + endif() +endif () + +#----------------------------------------------------------------------------- +# Add source directories +#----------------------------------------------------------------------------- +add_subdirectory(lib) + +option(ZSTD_PROGRAMS_LINK_SHARED "PROGRAMS LINK SHARED" OFF) + +if (ZSTD_BUILD_PROGRAMS) + if (NOT ZSTD_BUILD_STATIC AND NOT ZSTD_PROGRAMS_LINK_SHARED) + message(SEND_ERROR "You need to build static library to build zstd CLI") + elseif(NOT ZSTD_BUILD_SHARED AND ZSTD_PROGRAMS_LINK_SHARED) + message(SEND_ERROR "You need to build shared library to build zstd CLI") + endif () + + add_subdirectory(programs) +endif () + +if (ZSTD_BUILD_TESTS) + enable_testing() + if (NOT ZSTD_BUILD_STATIC) + message(SEND_ERROR "You need to build static library to build tests") + endif () + + add_subdirectory(tests) +endif () + +if (ZSTD_BUILD_CONTRIB) + add_subdirectory(contrib) +endif () + +#----------------------------------------------------------------------------- +# Add clean-all target +#----------------------------------------------------------------------------- +add_custom_target(clean-all + COMMAND ${CMAKE_BUILD_TOOL} clean + COMMAND rm -rf ${CMAKE_BINARY_DIR}/ +) + +#----------------------------------------------------------------------------- +# Generate Package Config files +# +# This section is based on the boiler plate code from: +# https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-packages +#----------------------------------------------------------------------------- +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake" + VERSION ${zstd_VERSION} + COMPATIBILITY SameMajorVersion + ) + +# A Package Config file that works from the build directory +export(EXPORT zstdExports + FILE "${CMAKE_CURRENT_BINARY_DIR}/zstdTargets.cmake" + NAMESPACE zstd:: + ) +configure_file(zstdConfig.cmake + "${CMAKE_CURRENT_BINARY_DIR}/zstdConfig.cmake" + COPYONLY + ) + +# A Package Config file that works from the installation directory +set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/zstd) +install(EXPORT zstdExports + FILE zstdTargets.cmake + NAMESPACE zstd:: + DESTINATION ${ConfigPackageLocation} + ) +install(FILES + zstdConfig.cmake + "${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake" + DESTINATION ${ConfigPackageLocation} + ) diff --git a/src/zstd/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake b/src/zstd/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake new file mode 100644 index 000000000..186819885 --- /dev/null +++ b/src/zstd/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake @@ -0,0 +1,79 @@ +include(CheckCXXCompilerFlag) +include(CheckCCompilerFlag) + +function(EnableCompilerFlag _flag _C _CXX) + string(REGEX REPLACE "\\+" "PLUS" varname "${_flag}") + string(REGEX REPLACE "[^A-Za-z0-9]+" "_" varname "${varname}") + string(REGEX REPLACE "^_+" "" varname "${varname}") + string(TOUPPER "${varname}" varname) + if (_C) + CHECK_C_COMPILER_FLAG(${_flag} C_FLAG_${varname}) + if (C_FLAG_${varname}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}" PARENT_SCOPE) + endif () + endif () + if (_CXX) + CHECK_CXX_COMPILER_FLAG(${_flag} CXX_FLAG_${varname}) + if (CXX_FLAG_${varname}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}" PARENT_SCOPE) + endif () + endif () +endfunction() + +macro(ADD_ZSTD_COMPILATION_FLAGS) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" OR MINGW) #Not only UNIX but also WIN32 for MinGW + #Set c++11 by default + EnableCompilerFlag("-std=c++11" false true) + #Set c99 by default + EnableCompilerFlag("-std=c99" true false) + EnableCompilerFlag("-Wall" true true) + EnableCompilerFlag("-Wextra" true true) + EnableCompilerFlag("-Wundef" true true) + EnableCompilerFlag("-Wshadow" true true) + EnableCompilerFlag("-Wcast-align" true true) + EnableCompilerFlag("-Wcast-qual" true true) + EnableCompilerFlag("-Wstrict-prototypes" true false) + # Enable asserts in Debug mode + if (CMAKE_BUILD_TYPE MATCHES "Debug") + EnableCompilerFlag("-DDEBUGLEVEL=1" true true) + endif () + elseif (MSVC) # Add specific compilation flags for Windows Visual + + set(ACTIVATE_MULTITHREADED_COMPILATION "ON" CACHE BOOL "activate multi-threaded compilation (/MP flag)") + if (CMAKE_GENERATOR MATCHES "Visual Studio" AND ACTIVATE_MULTITHREADED_COMPILATION) + EnableCompilerFlag("/MP" true true) + endif () + + # UNICODE SUPPORT + EnableCompilerFlag("/D_UNICODE" true true) + EnableCompilerFlag("/DUNICODE" true true) + # Enable asserts in Debug mode + if (CMAKE_BUILD_TYPE MATCHES "Debug") + EnableCompilerFlag("/DDEBUGLEVEL=1" true true) + endif () + endif () + + # Remove duplicates compilation flags + foreach (flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if( ${flag_var} ) + separate_arguments(${flag_var}) + list(REMOVE_DUPLICATES ${flag_var}) + string(REPLACE ";" " " ${flag_var} "${${flag_var}}") + endif() + endforeach () + + if (MSVC AND ZSTD_USE_STATIC_RUNTIME) + foreach (flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if ( ${flag_var} ) + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif() + endforeach () + endif () + +endmacro() diff --git a/src/zstd/build/cmake/CMakeModules/FindLibLZ4.cmake b/src/zstd/build/cmake/CMakeModules/FindLibLZ4.cmake new file mode 100644 index 000000000..d0fac06da --- /dev/null +++ b/src/zstd/build/cmake/CMakeModules/FindLibLZ4.cmake @@ -0,0 +1,49 @@ +# Find LibLZ4 +# +# Find LibLZ4 headers and library +# +# Result Variables +# +# LIBLZ4_FOUND - True if lz4 is found +# LIBLZ4_INCLUDE_DIRS - lz4 headers directories +# LIBLZ4_LIBRARIES - lz4 libraries +# LIBLZ4_VERSION_MAJOR - The major version of lz4 +# LIBLZ4_VERSION_MINOR - The minor version of lz4 +# LIBLZ4_VERSION_RELEASE - The release version of lz4 +# LIBLZ4_VERSION_STRING - version number string (e.g. 1.8.3) +# +# Hints +# +# Set ``LZ4_ROOT_DIR`` to the directory of lz4.h and lz4 library + +set(_LIBLZ4_ROOT_HINTS + ENV LZ4_ROOT_DIR) + +find_path( LIBLZ4_INCLUDE_DIR lz4.h + HINTS ${_LIBLZ4_ROOT_HINTS}) +find_library( LIBLZ4_LIBRARY NAMES lz4 liblz4 liblz4_static + HINTS ${_LIBLZ4_ROOT_HINTS}) + +if(LIBLZ4_INCLUDE_DIR) + file(STRINGS "${LIBLZ4_INCLUDE_DIR}/lz4.h" LIBLZ4_HEADER_CONTENT REGEX "#define LZ4_VERSION_[A-Z]+ +[0-9]+") + + string(REGEX REPLACE ".*#define LZ4_VERSION_MAJOR +([0-9]+).*" "\\1" LIBLZ4_VERSION_MAJOR "${LIBLZ4_HEADER_CONTENT}") + string(REGEX REPLACE ".*#define LZ4_VERSION_MINOR +([0-9]+).*" "\\1" LIBLZ4_VERSION_MINOR "${LIBLZ4_HEADER_CONTENT}") + string(REGEX REPLACE ".*#define LZ4_VERSION_RELEASE +([0-9]+).*" "\\1" LIBLZ4_VERSION_RELEASE "${LIBLZ4_HEADER_CONTENT}") + + set(LIBLZ4_VERSION_STRING "${LIBLZ4_VERSION_MAJOR}.${LIBLZ4_VERSION_MINOR}.${LIBLZ4_VERSION_RELEASE}") + unset(LIBLZ4_HEADER_CONTENT) +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZ4 REQUIRED_VARS LIBLZ4_INCLUDE_DIR + LIBLZ4_LIBRARY + VERSION_VAR LIBLZ4_VERSION_STRING + FAIL_MESSAGE "Could NOT find LZ4, try to set the paths to lz4.h and lz4 library in environment variable LZ4_ROOT_DIR") + +if (LIBLZ4_FOUND) + set(LIBLZ4_LIBRARIES ${LIBLZ4_LIBRARY}) + set(LIBLZ4_INCLUDE_DIRS ${LIBLZ4_INCLUDE_DIR}) +endif () + +mark_as_advanced( LIBLZ4_INCLUDE_DIR LIBLZ4_LIBRARY ) diff --git a/src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake b/src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake new file mode 100644 index 000000000..e8ed6064c --- /dev/null +++ b/src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake @@ -0,0 +1,10 @@ +function(GetZstdLibraryVersion _header _major _minor _patch) + # Read file content + file(READ ${_header} CONTENT) + + string(REGEX MATCH ".*define ZSTD_VERSION_MAJOR *([0-9]+).*define ZSTD_VERSION_MINOR *([0-9]+).*define ZSTD_VERSION_RELEASE *([0-9]+)" VERSION_REGEX "${CONTENT}") + set(${_major} ${CMAKE_MATCH_1} PARENT_SCOPE) + set(${_minor} ${CMAKE_MATCH_2} PARENT_SCOPE) + set(${_patch} ${CMAKE_MATCH_3} PARENT_SCOPE) +endfunction() + diff --git a/src/zstd/build/cmake/README.md b/src/zstd/build/cmake/README.md new file mode 100644 index 000000000..73b30dc77 --- /dev/null +++ b/src/zstd/build/cmake/README.md @@ -0,0 +1,104 @@ +# Cmake contributions + +Contributions to the cmake build configurations are welcome. Please +use case sensitivity that matches modern (ie. cmake version 2.6 and above) +conventions of using lower-case for commands, and upper-case for +variables. + +## How to build + +As cmake doesn't support command like `cmake clean`, it's recommended to perform a "out of source build". +To do this, you can create a new directory and build in it: +```sh +cd build/cmake +mkdir builddir +cd builddir +cmake .. +make +``` +Then you can clean all cmake caches by simply delete the new directory: +```sh +rm -rf build/cmake/builddir +``` + +And of course, you can directly build in build/cmake: +```sh +cd build/cmake +cmake +make +``` + +To show cmake build options, you can: +```sh +cd build/cmake/builddir +cmake -LH .. +``` + +Bool options can be set to `ON/OFF` with `-D[option]=[ON/OFF]`. You can configure cmake options like this: +```sh +cd build/cmake/builddir +cmake -DZSTD_BUILD_TESTS=ON -DZSTD_LEGACY_SUPPORT=ON .. +make +``` + +### referring +[Looking for a 'cmake clean' command to clear up CMake output](https://stackoverflow.com/questions/9680420/looking-for-a-cmake-clean-command-to-clear-up-cmake-output) + +## CMake Style Recommendations + +### Indent all code correctly, i.e. the body of + + * if/else/endif + * foreach/endforeach + * while/endwhile + * macro/endmacro + * function/endfunction + +Use spaces for indenting, 2, 3 or 4 spaces preferably. Use the same amount of +spaces for indenting as is used in the rest of the file. Do not use tabs. + +### Upper/lower casing + +Most important: use consistent upper- or lowercasing within one file ! + +In general, the all-lowercase style is preferred. + +So, this is recommended: + +``` +add_executable(foo foo.c) +``` + +These forms are discouraged + +``` +ADD_EXECUTABLE(bar bar.c) +Add_Executable(hello hello.c) +aDd_ExEcUtAbLe(blub blub.c) +``` + +### End commands +To make the code easier to read, use empty commands for endforeach(), endif(), +endfunction(), endmacro() and endwhile(). Also, use empty else() commands. + +For example, do this: + +``` +if(FOOVAR) + some_command(...) +else() + another_command(...) +endif() +``` + +and not this: + +``` +if(BARVAR) + some_other_command(...) +endif(BARVAR) +``` + +### Other resources for best practices + +https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#modules diff --git a/src/zstd/build/cmake/contrib/CMakeLists.txt b/src/zstd/build/cmake/contrib/CMakeLists.txt new file mode 100644 index 000000000..f7631d08c --- /dev/null +++ b/src/zstd/build/cmake/contrib/CMakeLists.txt @@ -0,0 +1,13 @@ +# ################################################################ +# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +project(contrib) + +add_subdirectory(pzstd) +add_subdirectory(gen_html) diff --git a/src/zstd/build/cmake/contrib/gen_html/CMakeLists.txt b/src/zstd/build/cmake/contrib/gen_html/CMakeLists.txt new file mode 100644 index 000000000..8fdd61131 --- /dev/null +++ b/src/zstd/build/cmake/contrib/gen_html/CMakeLists.txt @@ -0,0 +1,30 @@ +# ################################################################ +# Copyright (c) 2015-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +project(gen_html) +include(GetZstdLibraryVersion) + +set(CMAKE_INCLUDE_CURRENT_DIR TRUE) + +# Define programs directory, where sources and header files are located +set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib) +set(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs) +set(GENHTML_DIR ${ZSTD_SOURCE_DIR}/contrib/gen_html) +set(GENHTML_BINARY ${PROJECT_BINARY_DIR}/gen_html${CMAKE_EXECUTABLE_SUFFIX}) +include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${GENHTML_DIR}) + +add_executable(gen_html ${GENHTML_DIR}/gen_html.cpp) + +GetZstdLibraryVersion(${LIBRARY_DIR}/zstd.h VMAJOR VMINOR VRELEASE) +set(LIBVERSION "${VMAJOR}.${VMINOR}.${VRELEASE}") +add_custom_target(zstd_manual.html ALL + ${GENHTML_BINARY} "${LIBVERSION}" "${LIBRARY_DIR}/zstd.h" "${PROJECT_BINARY_DIR}/zstd_manual.html" + DEPENDS gen_html COMMENT "Update zstd manual") + +install(FILES "${PROJECT_BINARY_DIR}/zstd_manual.html" DESTINATION "${CMAKE_INSTALL_DOCDIR}") diff --git a/src/zstd/build/cmake/contrib/pzstd/CMakeLists.txt b/src/zstd/build/cmake/contrib/pzstd/CMakeLists.txt new file mode 100644 index 000000000..5c30a91b1 --- /dev/null +++ b/src/zstd/build/cmake/contrib/pzstd/CMakeLists.txt @@ -0,0 +1,32 @@ +# ################################################################ +# Copyright (c) 2016-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +project(pzstd) + +set(CMAKE_INCLUDE_CURRENT_DIR TRUE) + +# Define programs directory, where sources and header files are located +set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib) +set(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs) +set(PZSTD_DIR ${ZSTD_SOURCE_DIR}/contrib/pzstd) +include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${PZSTD_DIR}) + +add_executable(pzstd ${PROGRAMS_DIR}/util.c ${PZSTD_DIR}/main.cpp ${PZSTD_DIR}/Options.cpp ${PZSTD_DIR}/Pzstd.cpp ${PZSTD_DIR}/SkippableFrame.cpp) +set_property(TARGET pzstd APPEND PROPERTY COMPILE_DEFINITIONS "NDEBUG") +set_property(TARGET pzstd APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow") + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) +if (CMAKE_USE_PTHREADS_INIT) + target_link_libraries(pzstd libzstd_shared ${CMAKE_THREAD_LIBS_INIT}) +else() + message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads") +endif() + +install(TARGETS pzstd RUNTIME DESTINATION "bin") diff --git a/src/zstd/build/cmake/lib/.gitignore b/src/zstd/build/cmake/lib/.gitignore new file mode 100644 index 000000000..a4444c8d3 --- /dev/null +++ b/src/zstd/build/cmake/lib/.gitignore @@ -0,0 +1,2 @@ +# cmake build artefact +libzstd.pc diff --git a/src/zstd/build/cmake/lib/CMakeLists.txt b/src/zstd/build/cmake/lib/CMakeLists.txt new file mode 100644 index 000000000..666da60c1 --- /dev/null +++ b/src/zstd/build/cmake/lib/CMakeLists.txt @@ -0,0 +1,177 @@ +# ################################################################ +# Copyright (c) 2015-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +project(libzstd) + +set(CMAKE_INCLUDE_CURRENT_DIR TRUE) +option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON) +option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" ON) + +if(NOT ZSTD_BUILD_SHARED AND NOT ZSTD_BUILD_STATIC) + message(SEND_ERROR "You need to build at least one flavor of libzstd") +endif() + +# Define library directory, where sources and header files are located +include_directories(${LIBRARY_DIR} ${LIBRARY_DIR}/common) + +file(GLOB CommonSources ${LIBRARY_DIR}/common/*.c) +file(GLOB CompressSources ${LIBRARY_DIR}/compress/*.c) +file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c) +file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c) +file(GLOB DeprecatedSources ${LIBRARY_DIR}/deprecated/*.c) + +set(Sources + ${CommonSources} + ${CompressSources} + ${DecompressSources} + ${DictBuilderSources} + ${DeprecatedSources}) + +file(GLOB CommonHeaders ${LIBRARY_DIR}/common/*.h) +file(GLOB CompressHeaders ${LIBRARY_DIR}/compress/*.h) +file(GLOB DecompressHeaders ${LIBRARY_DIR}/decompress/*.h) +file(GLOB DictBuilderHeaders ${LIBRARY_DIR}/dictBuilder/*.h) +file(GLOB DeprecatedHeaders ${LIBRARY_DIR}/deprecated/*.h) + +set(Headers + ${LIBRARY_DIR}/zstd.h + ${CommonHeaders} + ${CompressHeaders} + ${DecompressHeaders} + ${DictBuilderHeaders} + ${DeprecatedHeaders}) + +if (ZSTD_LEGACY_SUPPORT) + set(LIBRARY_LEGACY_DIR ${LIBRARY_DIR}/legacy) + include_directories(${LIBRARY_LEGACY_DIR}) + + set(Sources ${Sources} + ${LIBRARY_LEGACY_DIR}/zstd_v01.c + ${LIBRARY_LEGACY_DIR}/zstd_v02.c + ${LIBRARY_LEGACY_DIR}/zstd_v03.c + ${LIBRARY_LEGACY_DIR}/zstd_v04.c + ${LIBRARY_LEGACY_DIR}/zstd_v05.c + ${LIBRARY_LEGACY_DIR}/zstd_v06.c + ${LIBRARY_LEGACY_DIR}/zstd_v07.c) + + set(Headers ${Headers} + ${LIBRARY_LEGACY_DIR}/zstd_legacy.h + ${LIBRARY_LEGACY_DIR}/zstd_v01.h + ${LIBRARY_LEGACY_DIR}/zstd_v02.h + ${LIBRARY_LEGACY_DIR}/zstd_v03.h + ${LIBRARY_LEGACY_DIR}/zstd_v04.h + ${LIBRARY_LEGACY_DIR}/zstd_v05.h + ${LIBRARY_LEGACY_DIR}/zstd_v06.h + ${LIBRARY_LEGACY_DIR}/zstd_v07.h) +endif () + +if (MSVC) + set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/libzstd-dll) + set(PlatformDependResources ${MSVC_RESOURCE_DIR}/libzstd-dll.rc) +endif () + +# Split project to static and shared libraries build +set(library_targets) +if (ZSTD_BUILD_SHARED) + add_library(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources}) + list(APPEND library_targets libzstd_shared) + if (ZSTD_MULTITHREAD_SUPPORT) + set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") + if (UNIX) + target_link_libraries(libzstd_shared ${THREADS_LIBS}) + endif () + endif() +endif () +if (ZSTD_BUILD_STATIC) + add_library(libzstd_static STATIC ${Sources} ${Headers}) + list(APPEND library_targets libzstd_static) + if (ZSTD_MULTITHREAD_SUPPORT) + set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") + if (UNIX) + target_link_libraries(libzstd_static ${THREADS_LIBS}) + endif () + endif () +endif () + +# Add specific compile definitions for MSVC project +if (MSVC) + if (ZSTD_BUILD_SHARED) + set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS") + endif () + if (ZSTD_BUILD_STATIC) + set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS") + endif () +endif () + +# With MSVC static library needs to be renamed to avoid conflict with import library +if (MSVC) + set(STATIC_LIBRARY_BASE_NAME zstd_static) +else () + set(STATIC_LIBRARY_BASE_NAME zstd) +endif () + +# Define static and shared library names +if (ZSTD_BUILD_SHARED) + set_target_properties( + libzstd_shared + PROPERTIES + OUTPUT_NAME zstd + VERSION ${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH} + SOVERSION ${zstd_VERSION_MAJOR}) +endif () + +if (ZSTD_BUILD_STATIC) + set_target_properties( + libzstd_static + PROPERTIES + POSITION_INDEPENDENT_CODE On + OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME}) +endif () + +if (UNIX) + # pkg-config + set(PREFIX "${CMAKE_INSTALL_PREFIX}") + set(LIBDIR "${CMAKE_INSTALL_LIBDIR}") + set(INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") + set(VERSION "${zstd_VERSION}") + add_custom_target(libzstd.pc ALL + ${CMAKE_COMMAND} -DIN="${LIBRARY_DIR}/libzstd.pc.in" -DOUT="libzstd.pc" + -DPREFIX="${PREFIX}" -DLIBDIR="${LIBDIR}" -DINCLUDEDIR="${INCLUDEDIR}" -DVERSION="${VERSION}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig.cmake" + COMMENT "Creating pkg-config file") + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +endif () + +# install target +install(FILES + "${LIBRARY_DIR}/zstd.h" + "${LIBRARY_DIR}/deprecated/zbuff.h" + "${LIBRARY_DIR}/dictBuilder/zdict.h" + "${LIBRARY_DIR}/dictBuilder/cover.h" + "${LIBRARY_DIR}/common/zstd_errors.h" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + +install(TARGETS ${library_targets} + EXPORT zstdExports + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) + +# uninstall target +if (NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif () diff --git a/src/zstd/build/cmake/lib/cmake_uninstall.cmake.in b/src/zstd/build/cmake/lib/cmake_uninstall.cmake.in new file mode 100644 index 000000000..9f1d045dd --- /dev/null +++ b/src/zstd/build/cmake/lib/cmake_uninstall.cmake.in @@ -0,0 +1,22 @@ + +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif() + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif() + else() + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach() diff --git a/src/zstd/build/cmake/lib/pkgconfig.cmake b/src/zstd/build/cmake/lib/pkgconfig.cmake new file mode 100644 index 000000000..8f805a197 --- /dev/null +++ b/src/zstd/build/cmake/lib/pkgconfig.cmake @@ -0,0 +1 @@ +configure_file("${IN}" "${OUT}" @ONLY) diff --git a/src/zstd/build/cmake/programs/.gitignore b/src/zstd/build/cmake/programs/.gitignore new file mode 100644 index 000000000..ae3a8a356 --- /dev/null +++ b/src/zstd/build/cmake/programs/.gitignore @@ -0,0 +1,5 @@ +# produced by make +zstd +zstd-frugal +unzstd +zstdcat diff --git a/src/zstd/build/cmake/programs/CMakeLists.txt b/src/zstd/build/cmake/programs/CMakeLists.txt new file mode 100644 index 000000000..b26e97d0d --- /dev/null +++ b/src/zstd/build/cmake/programs/CMakeLists.txt @@ -0,0 +1,135 @@ +# ################################################################ +# Copyright (c) 2015-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +project(programs) + +set(CMAKE_INCLUDE_CURRENT_DIR TRUE) + +# Define programs directory, where sources and header files are located +set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib) +set(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs) +include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${LIBRARY_DIR}/compress ${LIBRARY_DIR}/dictBuilder) + +if (ZSTD_LEGACY_SUPPORT) + set(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy) + include_directories(${PROGRAMS_LEGACY_DIR} ${LIBRARY_DIR}/legacy) +endif () + +if (ZSTD_PROGRAMS_LINK_SHARED) + set(PROGRAMS_ZSTD_LINK_TARGET libzstd_shared) +else () + set(PROGRAMS_ZSTD_LINK_TARGET libzstd_static) +endif () + +if (MSVC) + set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/zstd) + set(PlatformDependResources ${MSVC_RESOURCE_DIR}/zstd.rc) +endif () + +add_executable(zstd ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/dibio.c ${PlatformDependResources}) +target_link_libraries(zstd ${PROGRAMS_ZSTD_LINK_TARGET}) +if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") + target_link_libraries(zstd rt) +endif () +install(TARGETS zstd RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + +if (UNIX) + add_custom_target(zstdcat ALL ${CMAKE_COMMAND} -E create_symlink zstd zstdcat DEPENDS zstd COMMENT "Creating zstdcat symlink") + add_custom_target(unzstd ALL ${CMAKE_COMMAND} -E create_symlink zstd unzstd DEPENDS zstd COMMENT "Creating unzstd symlink") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdcat DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unzstd DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(PROGRAMS ${PROGRAMS_DIR}/zstdgrep DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(PROGRAMS ${PROGRAMS_DIR}/zstdless DESTINATION "${CMAKE_INSTALL_BINDIR}") + + add_custom_target(zstd.1 ALL + ${CMAKE_COMMAND} -E copy ${PROGRAMS_DIR}/zstd.1 . + COMMENT "Copying manpage zstd.1") + add_custom_target(zstdgrep.1 ALL + ${CMAKE_COMMAND} -E copy ${PROGRAMS_DIR}/zstdgrep.1 . + COMMENT "Copying manpage zstdgrep.1") + add_custom_target(zstdless.1 ALL + ${CMAKE_COMMAND} -E copy ${PROGRAMS_DIR}/zstdless.1 . + COMMENT "Copying manpage zstdless.1") + add_custom_target(zstdcat.1 ALL ${CMAKE_COMMAND} -E create_symlink zstd.1 zstdcat.1 DEPENDS zstd.1 COMMENT "Creating zstdcat.1 symlink") + add_custom_target(unzstd.1 ALL ${CMAKE_COMMAND} -E create_symlink zstd.1 unzstd.1 DEPENDS zstd.1 COMMENT "Creating unzstd.1 symlink") + + # Define MAN_INSTALL_DIR if necessary + if (MAN_INSTALL_DIR) + else () + set(MAN_INSTALL_DIR ${CMAKE_INSTALL_MANDIR}/man1) + endif () + + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/zstd.1 + ${CMAKE_CURRENT_BINARY_DIR}/zstdcat.1 + ${CMAKE_CURRENT_BINARY_DIR}/unzstd.1 + ${CMAKE_CURRENT_BINARY_DIR}/zstdgrep.1 + ${CMAKE_CURRENT_BINARY_DIR}/zstdless.1 + DESTINATION "${MAN_INSTALL_DIR}") + + add_executable(zstd-frugal ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/fileio.c) + target_link_libraries(zstd-frugal ${PROGRAMS_ZSTD_LINK_TARGET}) + set_property(TARGET zstd-frugal APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_NOBENCH;ZSTD_NODICT") +endif () + +# Add multi-threading support definitions + +if (ZSTD_MULTITHREAD_SUPPORT) + set_property(TARGET zstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") + + if (UNIX) + target_link_libraries(zstd ${THREADS_LIBS}) + + add_custom_target(zstdmt ALL ${CMAKE_COMMAND} -E create_symlink zstd zstdmt DEPENDS zstd COMMENT "Creating zstdmt symlink") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdmt DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif () +endif () + +option(ZSTD_ZLIB_SUPPORT "ZLIB SUPPORT" OFF) +option(ZSTD_LZMA_SUPPORT "LZMA SUPPORT" OFF) +option(ZSTD_LZ4_SUPPORT "LZ4 SUPPORT" OFF) + +# Add gzip support +if (ZSTD_ZLIB_SUPPORT) + find_package(ZLIB REQUIRED) + + if (ZLIB_FOUND) + include_directories(${ZLIB_INCLUDE_DIRS}) + target_link_libraries(zstd ${ZLIB_LIBRARIES}) + set_property(TARGET zstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_GZCOMPRESS;ZSTD_GZDECOMPRESS") + else () + message(SEND_ERROR "zlib library is missing") + endif () +endif () + +# Add lzma support +if (ZSTD_LZMA_SUPPORT) + find_package(LibLZMA REQUIRED) + + if (LIBLZMA_FOUND) + include_directories(${LIBLZMA_INCLUDE_DIRS}) + target_link_libraries(zstd ${LIBLZMA_LIBRARIES}) + set_property(TARGET zstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_LZMACOMPRESS;ZSTD_LZMADECOMPRESS") + else () + message(SEND_ERROR "lzma library is missing") + endif () +endif () + +# Add lz4 support +if (ZSTD_LZ4_SUPPORT) + find_package(LibLZ4 REQUIRED) + + if (LIBLZ4_FOUND) + include_directories(${LIBLZ4_INCLUDE_DIRS}) + target_link_libraries(zstd ${LIBLZ4_LIBRARIES}) + set_property(TARGET zstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_LZ4COMPRESS;ZSTD_LZ4DECOMPRESS") + else () + message(SEND_ERROR "lz4 library is missing") + endif () +endif () diff --git a/src/zstd/build/cmake/tests/.gitignore b/src/zstd/build/cmake/tests/.gitignore new file mode 100644 index 000000000..2ab62a3e1 --- /dev/null +++ b/src/zstd/build/cmake/tests/.gitignore @@ -0,0 +1,7 @@ +# produced by make +datagen +fullbench +fuzzer +paramgrill +zbufftest + diff --git a/src/zstd/build/cmake/tests/CMakeLists.txt b/src/zstd/build/cmake/tests/CMakeLists.txt new file mode 100644 index 000000000..95d60f5f3 --- /dev/null +++ b/src/zstd/build/cmake/tests/CMakeLists.txt @@ -0,0 +1,106 @@ +# ################################################################ +# zstd - Makefile +# Copyright (C) Yann Collet 2014-present +# All rights reserved. +# +# BSD license +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# You can contact the author at : +# - zstd homepage : http://www.zstd.net/ +# ################################################################ + +project(tests) + +# name: Cache variable name. The value is expected to be a semicolon-separated +# list of command line flags +# default_value: Value to initialize the option with. Can be space separated. +function(AddTestFlagsOption name default_value doc) + string(STRIP "${default_value}" default_value) + string(REGEX REPLACE " +" ";" default_value "${default_value}") + set(${name} ${default_value} CACHE STRING "${doc}") + mark_as_advanced(${name}) +endfunction() + +set(CMAKE_INCLUDE_CURRENT_DIR TRUE) + +# Define programs directory, where sources and header files are located +set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib) +set(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs) +set(TESTS_DIR ${ZSTD_SOURCE_DIR}/tests) +include_directories(${TESTS_DIR} ${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${LIBRARY_DIR}/compress ${LIBRARY_DIR}/dictBuilder) + +add_executable(datagen ${PROGRAMS_DIR}/datagen.c ${TESTS_DIR}/datagencli.c) +target_link_libraries(datagen libzstd_static) + +# +# fullbench +# +add_executable(fullbench ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${TESTS_DIR}/fullbench.c) +target_link_libraries(fullbench libzstd_static) +add_test(NAME fullbench COMMAND fullbench) + +# +# fuzzer +# +add_executable(fuzzer ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/fuzzer.c) +target_link_libraries(fuzzer libzstd_static) +AddTestFlagsOption(ZSTD_FUZZER_FLAGS "$ENV{FUZZERTEST} $ENV{FUZZER_FLAGS}" + "Semicolon-separated list of flags to pass to the fuzzer test (see `fuzzer -h` for usage)") +add_test(NAME fuzzer COMMAND fuzzer ${ZSTD_FUZZER_FLAGS}) +# Disable the timeout since the run time is too long for the default timeout of +# 1500 seconds and varies considerably between low-end and high-end CPUs. +# set_tests_properties(fuzzer PROPERTIES TIMEOUT 0) + +# +# zstreamtest +# +add_executable(zstreamtest ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/seqgen.c ${TESTS_DIR}/zstreamtest.c) +target_link_libraries(zstreamtest libzstd_static) +AddTestFlagsOption(ZSTD_ZSTREAM_FLAGS "$ENV{ZSTREAM_TESTTIME} $ENV{FUZZER_FLAGS}" + "Semicolon-separated list of flags to pass to the zstreamtest test (see `zstreamtest -h` for usage)") +add_test(NAME zstreamtest COMMAND zstreamtest ${ZSTD_ZSTREAM_FLAGS}) + +# +# playTests.sh +# +AddTestFlagsOption(ZSTD_PLAYTESTS_FLAGS "--test-large-data" + "Semicolon-separated list of flags to pass to the playTests.sh test") +add_test(NAME playTests COMMAND sh -c "${TESTS_DIR}/playTests.sh" ${ZSTD_PLAYTESTS_FLAGS}) +if (ZSTD_BUILD_PROGRAMS) + set_property(TEST playTests APPEND PROPERTY ENVIRONMENT + "ZSTD_BIN=$" + "DATAGEN_BIN=$" + ) +else() + message(STATUS "Disabling playTests.sh test because ZSTD_BUILD_PROGRAMS is not enabled") + set_tests_properties(playTests PROPERTIES DISABLED YES) +endif() + +# Label the "Medium" set of tests (see TESTING.md) +set_property(TEST fuzzer zstreamtest playTests APPEND PROPERTY LABELS Medium) + +if (UNIX) + add_executable(paramgrill ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/paramgrill.c) + target_link_libraries(paramgrill libzstd_static m) #m is math library +endif () diff --git a/src/zstd/build/cmake/zstdConfig.cmake b/src/zstd/build/cmake/zstdConfig.cmake new file mode 100644 index 000000000..ebbfcc38f --- /dev/null +++ b/src/zstd/build/cmake/zstdConfig.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/zstdTargets.cmake") diff --git a/src/zstd/build/meson/GetZstdLibraryVersion.py b/src/zstd/build/meson/GetZstdLibraryVersion.py new file mode 100644 index 000000000..461af5f9c --- /dev/null +++ b/src/zstd/build/meson/GetZstdLibraryVersion.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# ############################################################################# +# Copyright (c) 2018-present lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# +import re + + +def find_version_tuple(filepath): + version_file_data = None + with open(filepath) as fd: + version_file_data = fd.read() + + patterns = r"""#\s*define\s+ZSTD_VERSION_MAJOR\s+([0-9]+) +#\s*define\s+ZSTD_VERSION_MINOR\s+([0-9]+) +#\s*define\s+ZSTD_VERSION_RELEASE\s+([0-9]+) +""" + regex = re.compile(patterns, re.MULTILINE) + version_match = regex.search(version_file_data) + if version_match: + return version_match.groups() + raise Exception("Unable to find version string") + + +def main(): + import argparse + parser = argparse.ArgumentParser(description='Print zstd version from lib/zstd.h') + parser.add_argument('file', help='path to lib/zstd.h') + args = parser.parse_args() + version_tuple = find_version_tuple(args.file) + print('.'.join(version_tuple)) + + +if __name__ == '__main__': + main() diff --git a/src/zstd/build/meson/InstallSymlink.py b/src/zstd/build/meson/InstallSymlink.py new file mode 100644 index 000000000..3f2998c64 --- /dev/null +++ b/src/zstd/build/meson/InstallSymlink.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +# ############################################################################# +# Copyright (c) 2018-present lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# +# This file should be synced with https://github.com/lzutao/meson-symlink + +import os +import pathlib # since Python 3.4 + + +def install_symlink(src, dst, install_dir, dst_is_dir=False, dir_mode=0o777): + if not install_dir.exists(): + install_dir.mkdir(mode=dir_mode, parents=True, exist_ok=True) + if not install_dir.is_dir(): + raise NotADirectoryError(install_dir) + + new_dst = install_dir.joinpath(dst) + if new_dst.is_symlink() and os.readlink(new_dst) == src: + print('File exists: {!r} -> {!r}'.format(new_dst, src)) + return + print('Installing symlink {!r} -> {!r}'.format(new_dst, src)) + new_dst.symlink_to(src, target_is_directory=dst_is_dir) + + +def main(): + import argparse + parser = argparse.ArgumentParser(description='Install a symlink', + usage='{0} [-h] [-d] [-m MODE] source dest install_dir\n\n' + 'example:\n' + ' {0} dash sh /bin'.format(pathlib.Path(__file__).name)) + parser.add_argument('source', help='target to link') + parser.add_argument('dest', help='link name') + parser.add_argument('install_dir', help='installation directory') + parser.add_argument('-d', '--isdir', + action='store_true', + help='dest is a directory') + parser.add_argument('-m', '--mode', + help='directory mode on creating if not exist', + default='0o755') + args = parser.parse_args() + + dir_mode = int(args.mode, 8) + + meson_destdir = os.environ.get('MESON_INSTALL_DESTDIR_PREFIX', default='') + install_dir = pathlib.Path(meson_destdir, args.install_dir) + install_symlink(args.source, args.dest, install_dir, args.isdir, dir_mode) + + +if __name__ == '__main__': + main() diff --git a/src/zstd/build/meson/README.md b/src/zstd/build/meson/README.md new file mode 100644 index 000000000..d393a063f --- /dev/null +++ b/src/zstd/build/meson/README.md @@ -0,0 +1,38 @@ +Meson build system for zstandard +================================ + +Meson is a build system designed to optimize programmer productivity. +It aims to do this by providing simple, out-of-the-box support for +modern software development tools and practices, such as unit tests, +coverage reports, Valgrind, CCache and the like. + +This Meson build system is provided with no guarantee and maintained +by Dima Krasner \. + +It outputs one `libzstd`, either shared or static, depending on +`default_library` option. + +## How to build + +`cd` to this meson directory (`build/meson`) + +```sh +meson setup -Dbin_programs=true -Dbin_contrib=true builddir +cd builddir +ninja # to build +ninja install # to install +``` + +You might want to install it in staging directory: + +```sh +DESTDIR=./staging ninja install +``` + +To configure build options, use: + +```sh +meson configure +``` + +See [man meson(1)](https://manpages.debian.org/testing/meson/meson.1.en.html). diff --git a/src/zstd/build/meson/contrib/gen_html/meson.build b/src/zstd/build/meson/contrib/gen_html/meson.build new file mode 100644 index 000000000..3f302538d --- /dev/null +++ b/src/zstd/build/meson/contrib/gen_html/meson.build @@ -0,0 +1,30 @@ +# ############################################################################# +# Copyright (c) 2018-present lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +zstd_rootdir = '../../../..' + +gen_html_includes = include_directories(join_paths(zstd_rootdir, 'programs'), + join_paths(zstd_rootdir, 'lib'), + join_paths(zstd_rootdir, 'lib/common'), + join_paths(zstd_rootdir, 'contrib/gen_html')) + +gen_html = executable('gen_html', + join_paths(zstd_rootdir, 'contrib/gen_html/gen_html.cpp'), + include_directories: gen_html_includes, + native: true, + install: false) + +# Update zstd manual +zstd_manual_html = custom_target('zstd_manual.html', + output : 'zstd_manual.html', + command : [gen_html, + zstd_version, + join_paths(meson.current_source_dir(), zstd_rootdir, 'lib/zstd.h'), + '@OUTPUT@'], + install : false) diff --git a/src/zstd/build/meson/contrib/meson.build b/src/zstd/build/meson/contrib/meson.build new file mode 100644 index 000000000..7f6d03a4c --- /dev/null +++ b/src/zstd/build/meson/contrib/meson.build @@ -0,0 +1,12 @@ +# ############################################################################# +# Copyright (c) 2018-present Dima Krasner +# lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +subdir('pzstd') +subdir('gen_html') diff --git a/src/zstd/build/meson/contrib/pzstd/meson.build b/src/zstd/build/meson/contrib/pzstd/meson.build new file mode 100644 index 000000000..8f3822fd7 --- /dev/null +++ b/src/zstd/build/meson/contrib/pzstd/meson.build @@ -0,0 +1,24 @@ +# ############################################################################# +# Copyright (c) 2018-present lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +zstd_rootdir = '../../../..' + +pzstd_includes = include_directories(join_paths(zstd_rootdir, 'programs'), + join_paths(zstd_rootdir, 'contrib/pzstd')) +pzstd_sources = [join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'contrib/pzstd/main.cpp'), + join_paths(zstd_rootdir, 'contrib/pzstd/Options.cpp'), + join_paths(zstd_rootdir, 'contrib/pzstd/Pzstd.cpp'), + join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')] +pzstd = executable('pzstd', + pzstd_sources, + cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-pedantic' ], + include_directories: pzstd_includes, + dependencies: [ libzstd_dep, thread_dep ], + install: true) diff --git a/src/zstd/build/meson/lib/meson.build b/src/zstd/build/meson/lib/meson.build new file mode 100644 index 000000000..6fb3df8e9 --- /dev/null +++ b/src/zstd/build/meson/lib/meson.build @@ -0,0 +1,132 @@ +# ############################################################################# +# Copyright (c) 2018-present Dima Krasner +# lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +zstd_rootdir = '../../..' + +libzstd_includes = [include_directories(join_paths(zstd_rootdir,'lib'), + join_paths(zstd_rootdir, 'lib/common'), + join_paths(zstd_rootdir, 'lib/compress'), + join_paths(zstd_rootdir, 'lib/decompress'), + join_paths(zstd_rootdir, 'lib/dictBuilder'), + join_paths(zstd_rootdir, 'lib/deprecated'))] + +libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'), + join_paths(zstd_rootdir, 'lib/common/fse_decompress.c'), + join_paths(zstd_rootdir, 'lib/common/threading.c'), + join_paths(zstd_rootdir, 'lib/common/pool.c'), + join_paths(zstd_rootdir, 'lib/common/zstd_common.c'), + join_paths(zstd_rootdir, 'lib/common/error_private.c'), + join_paths(zstd_rootdir, 'lib/common/xxhash.c'), + join_paths(zstd_rootdir, 'lib/compress/hist.c'), + join_paths(zstd_rootdir, 'lib/compress/fse_compress.c'), + join_paths(zstd_rootdir, 'lib/compress/huf_compress.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_compress.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_compress_literals.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_compress_sequences.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_compress_superblock.c'), + join_paths(zstd_rootdir, 'lib/compress/zstdmt_compress.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_fast.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_double_fast.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_lazy.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_opt.c'), + join_paths(zstd_rootdir, 'lib/compress/zstd_ldm.c'), + join_paths(zstd_rootdir, 'lib/decompress/huf_decompress.c'), + join_paths(zstd_rootdir, 'lib/decompress/zstd_decompress.c'), + join_paths(zstd_rootdir, 'lib/decompress/zstd_decompress_block.c'), + join_paths(zstd_rootdir, 'lib/decompress/zstd_ddict.c'), + join_paths(zstd_rootdir, 'lib/dictBuilder/cover.c'), + join_paths(zstd_rootdir, 'lib/dictBuilder/fastcover.c'), + join_paths(zstd_rootdir, 'lib/dictBuilder/divsufsort.c'), + join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.c'), + join_paths(zstd_rootdir, 'lib/deprecated/zbuff_common.c'), + join_paths(zstd_rootdir, 'lib/deprecated/zbuff_compress.c'), + join_paths(zstd_rootdir, 'lib/deprecated/zbuff_decompress.c')] + +# Explicit define legacy support +add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_level), + language: 'c') + +if legacy_level == 0 + message('Legacy support: DISABLED') +else + # See ZSTD_LEGACY_SUPPORT of lib/README.md + message('Enable legacy support back to version 0.@0@'.format(legacy_level)) + + libzstd_includes += [ include_directories(join_paths(zstd_rootdir, 'lib/legacy')) ] + foreach i : [1, 2, 3, 4, 5, 6, 7] + if legacy_level <= i + libzstd_sources += join_paths(zstd_rootdir, 'lib/legacy/zstd_v0@0@.c'.format(i)) + endif + endforeach +endif + +libzstd_deps = [] +if use_multi_thread + message('Enable multi-threading support') + add_project_arguments('-DZSTD_MULTITHREAD', language: 'c') + libzstd_deps = [ thread_dep ] +endif + +libzstd_c_args = [] +if cc_id == compiler_msvc + if default_library_type != 'static' + libzstd_sources += [windows_mod.compile_resources( + join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'))] + libzstd_c_args += ['-DZSTD_DLL_EXPORT=1', + '-DZSTD_HEAPMODE=0', + '-D_CONSOLE', + '-D_CRT_SECURE_NO_WARNINGS'] + else + libzstd_c_args += ['-DZSTD_HEAPMODE=0', + '-D_CRT_SECURE_NO_WARNINGS'] + endif +endif + +mingw_ansi_stdio_flags = [] +if host_machine_os == os_windows and cc_id == compiler_gcc + mingw_ansi_stdio_flags = [ '-D__USE_MINGW_ANSI_STDIO' ] +endif +libzstd_c_args += mingw_ansi_stdio_flags + +libzstd_debug_cflags = [] +if use_debug + libzstd_c_args += '-DDEBUGLEVEL=@0@'.format(debug_level) + if cc_id == compiler_gcc or cc_id == compiler_clang + libzstd_debug_cflags = ['-Wstrict-aliasing=1', '-Wswitch-enum', + '-Wdeclaration-after-statement', '-Wstrict-prototypes', + '-Wundef', '-Wpointer-arith', '-Wvla', + '-Wformat=2', '-Winit-self', '-Wfloat-equal', '-Wwrite-strings', + '-Wredundant-decls', '-Wmissing-prototypes', '-Wc++-compat'] + endif +endif +libzstd_c_args += cc.get_supported_arguments(libzstd_debug_cflags) + +libzstd = library('zstd', + libzstd_sources, + include_directories: libzstd_includes, + c_args: libzstd_c_args, + dependencies: libzstd_deps, + install: true, + version: zstd_libversion) + +libzstd_dep = declare_dependency(link_with: libzstd, + include_directories: libzstd_includes) + +pkgconfig.generate(libzstd, + name: 'libzstd', + filebase: 'libzstd', + description: 'fast lossless compression algorithm library', + version: zstd_libversion, + url: 'http://www.zstd.net/') + +install_headers(join_paths(zstd_rootdir, 'lib/zstd.h'), + join_paths(zstd_rootdir, 'lib/deprecated/zbuff.h'), + join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.h'), + join_paths(zstd_rootdir, 'lib/common/zstd_errors.h')) diff --git a/src/zstd/build/meson/meson.build b/src/zstd/build/meson/meson.build new file mode 100644 index 000000000..970cf3c92 --- /dev/null +++ b/src/zstd/build/meson/meson.build @@ -0,0 +1,147 @@ +# ############################################################################# +# Copyright (c) 2018-present Dima Krasner +# lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +project('zstd', + ['c', 'cpp'], + license: ['BSD', 'GPLv2'], + default_options : [ + 'c_std=gnu99', + 'cpp_std=c++11', + 'buildtype=release' + ], + version: 'DUMMY', + meson_version: '>=0.47.0') + +cc = meson.get_compiler('c') +cxx = meson.get_compiler('cpp') +pkgconfig = import('pkgconfig') +python3 = import('python').find_installation() +windows_mod = import('windows') + +host_machine_os = host_machine.system() +os_windows = 'windows' +os_linux = 'linux' +os_darwin = 'darwin' +os_freebsd = 'freebsd' +os_sun = 'sunos' + +cc_id = cc.get_id() +compiler_gcc = 'gcc' +compiler_clang = 'clang' +compiler_msvc = 'msvc' + +zstd_version = meson.project_version() + +zstd_h_file = join_paths(meson.current_source_dir(), '../../lib/zstd.h') +GetZstdLibraryVersion_py = files('GetZstdLibraryVersion.py') +r = run_command(python3, GetZstdLibraryVersion_py, zstd_h_file) +if r.returncode() == 0 + zstd_version = r.stdout().strip() + message('Project version is now: @0@'.format(zstd_version)) +else + error('Cannot find project version in @0@'.format(zstd_h_file)) +endif + +zstd_libversion = zstd_version + +# ============================================================================= +# Installation directories +# ============================================================================= + +zstd_prefix = get_option('prefix') +zstd_bindir = get_option('bindir') +zstd_datadir = get_option('datadir') +zstd_mandir = get_option('mandir') +zstd_docdir = join_paths(zstd_datadir, 'doc', meson.project_name()) + +# ============================================================================= +# Project options +# ============================================================================= + +# Built-in options +use_debug = get_option('debug') +buildtype = get_option('buildtype') +default_library_type = get_option('default_library') + +# Custom options +debug_level = get_option('debug_level') +legacy_level = get_option('legacy_level') +use_backtrace = get_option('backtrace') +use_static_runtime = get_option('static_runtime') + +bin_programs = get_option('bin_programs') +bin_contrib = get_option('bin_contrib') +bin_tests = get_option('bin_tests') + +feature_multi_thread = get_option('multi_thread') +feature_zlib = get_option('zlib') +feature_lzma = get_option('lzma') +feature_lz4 = get_option('lz4') + +# ============================================================================= +# Dependencies +# ============================================================================= + +libm_dep = cc.find_library('m', required: bin_tests) +thread_dep = dependency('threads', required: feature_multi_thread) +use_multi_thread = thread_dep.found() +# Arguments in dependency should be equivalent to those passed to pkg-config +zlib_dep = dependency('zlib', required: feature_zlib) +use_zlib = zlib_dep.found() +lzma_dep = dependency('liblzma', required: feature_lzma) +use_lzma = lzma_dep.found() +lz4_dep = dependency('liblz4', required: feature_lz4) +use_lz4 = lz4_dep.found() + +# ============================================================================= +# Compiler flags +# ============================================================================= + +add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c']) + +if [compiler_gcc, compiler_clang].contains(cc_id) + common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] + if cc_id == compiler_clang + # Should use Meson's own --werror build option + #common_warning_flags += '-Werror' + common_warning_flags += ['-Wconversion', '-Wno-sign-conversion', '-Wdocumentation'] + endif + cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes']) + cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags) + add_project_arguments(cc_compile_flags, language : 'c') + add_project_arguments(cxx_compile_flags, language : 'cpp') +elif cc_id == compiler_msvc + msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ] + if use_multi_thread + msvc_compile_flags += '/MP' + endif + if use_static_runtime + msvc_compile_flags += '/MT' + endif + add_project_arguments(msvc_compile_flags, language: ['c', 'cpp']) +endif + +# ============================================================================= +# Subdirs +# ============================================================================= + +subdir('lib') + +if bin_programs + subdir('programs') +endif + +if bin_tests + subdir('tests') +endif + +if bin_contrib + subdir('contrib') +endif diff --git a/src/zstd/build/meson/meson_options.txt b/src/zstd/build/meson/meson_options.txt new file mode 100644 index 000000000..90a81c539 --- /dev/null +++ b/src/zstd/build/meson/meson_options.txt @@ -0,0 +1,36 @@ +# ############################################################################# +# Copyright (c) 2018-present Dima Krasner +# lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +# Read guidelines from https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting + +option('legacy_level', type: 'integer', min: 0, max: 7, value: '5', + description: 'Support any legacy format: 7 to 1 for v0.7+ to v0.1+') +option('debug_level', type: 'integer', min: 0, max: 9, value: 1, + description: 'Enable run-time debug. See lib/common/debug.h') +option('backtrace', type: 'boolean', value: false, + description: 'Display a stack backtrace when execution generates a runtime exception') +option('static_runtime', type: 'boolean', value: false, + description: 'Link to static run-time libraries on MSVC') + +option('bin_programs', type: 'boolean', value: true, + description: 'Enable programs build') +option('bin_tests', type: 'boolean', value: false, + description: 'Enable tests build') +option('bin_contrib', type: 'boolean', value: false, + description: 'Enable contrib build') + +option('multi_thread', type: 'feature', value: 'enabled', + description: 'Enable multi-threading when pthread is detected') +option('zlib', type: 'feature', value: 'auto', + description: 'Enable zlib support') +option('lzma', type: 'feature', value: 'auto', + description: 'Enable lzma support') +option('lz4', type: 'feature', value: 'auto', + description: 'Enable lz4 support') diff --git a/src/zstd/build/meson/programs/meson.build b/src/zstd/build/meson/programs/meson.build new file mode 100644 index 000000000..363818f9d --- /dev/null +++ b/src/zstd/build/meson/programs/meson.build @@ -0,0 +1,104 @@ +# ############################################################################# +# Copyright (c) 2018-present Dima Krasner +# lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +zstd_rootdir = '../../..' + +zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), + join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'programs/fileio.c'), + join_paths(zstd_rootdir, 'programs/benchfn.c'), + join_paths(zstd_rootdir, 'programs/benchzstd.c'), + join_paths(zstd_rootdir, 'programs/datagen.c'), + join_paths(zstd_rootdir, 'programs/dibio.c')] + +zstd_c_args = libzstd_debug_cflags +if use_multi_thread + zstd_c_args += [ '-DZSTD_MULTITHREAD' ] +endif + +zstd_deps = [ libzstd_dep ] +if use_zlib + zstd_deps += [ zlib_dep ] + zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ] +endif + +if use_lzma + zstd_deps += [ lzma_dep ] + zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ] +endif + +if use_lz4 + zstd_deps += [ lz4_dep ] + zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ] +endif + +export_dynamic_on_windows = false +# explicit backtrace enable/disable for Linux & Darwin +if not use_backtrace + zstd_c_args += '-DBACKTRACE_ENABLE=0' +elif use_debug and host_machine_os == os_windows # MinGW target + zstd_c_args += '-DBACKTRACE_ENABLE=1' + export_dynamic_on_windows = true +endif + +if cc_id == compiler_msvc + if default_library_type != 'static' + zstd_programs_sources += [windows_mod.compile_resources( + join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'))] + endif +endif + +zstd = executable('zstd', + zstd_programs_sources, + c_args: zstd_c_args, + dependencies: zstd_deps, + export_dynamic: export_dynamic_on_windows, # Since Meson 0.45.0 + install: true) + +zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/fileio.c')] + +# Minimal target, with only zstd compression and decompression. +# No bench. No legacy. +executable('zstd-frugal', + zstd_frugal_sources, + dependencies: libzstd_dep, + c_args: [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ], + install: true) + +install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'), + join_paths(zstd_rootdir, 'programs/zstdless'), + install_dir: zstd_bindir) + +# ============================================================================= +# Programs and manpages installing +# ============================================================================= + +install_man(join_paths(zstd_rootdir, 'programs/zstd.1'), + join_paths(zstd_rootdir, 'programs/zstdgrep.1'), + join_paths(zstd_rootdir, 'programs/zstdless.1')) + +InstallSymlink_py = '../InstallSymlink.py' +zstd_man1_dir = join_paths(zstd_mandir, 'man1') +bin_EXT = host_machine_os == os_windows ? '.exe' : '' +man1_EXT = meson.version().version_compare('>=0.49.0') ? '.1' : '.1.gz' + +foreach f : ['zstdcat', 'unzstd'] + meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, f + bin_EXT, zstd_bindir) + meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, f + man1_EXT, zstd_man1_dir) +endforeach + +if use_multi_thread + meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, 'zstdmt' + bin_EXT, zstd_bindir) + meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, 'zstdmt' + man1_EXT, zstd_man1_dir) +endif diff --git a/src/zstd/build/meson/tests/meson.build b/src/zstd/build/meson/tests/meson.build new file mode 100644 index 000000000..0587f9a70 --- /dev/null +++ b/src/zstd/build/meson/tests/meson.build @@ -0,0 +1,206 @@ +# ############################################################################# +# Copyright (c) 2018-present Dima Krasner +# lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# + +zstd_rootdir = '../../..' + +tests_supported_oses = [os_linux, 'gnu/kfreebsd', os_darwin, 'gnu', 'openbsd', + os_freebsd, 'netbsd', 'dragonfly', os_sun] + +# ============================================================================= +# Test flags +# ============================================================================= + +FUZZER_FLAGS = ['--no-big-tests'] +FUZZERTEST = '-T200s' +ZSTREAM_TESTTIME = '-T90s' +DECODECORPUS_TESTTIME = '-T30' +ZSTDRTTEST = ['--test-large-data'] + +# ============================================================================= +# Executables +# ============================================================================= + +test_includes = [ include_directories(join_paths(zstd_rootdir, 'programs')) ] + +datagen_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), + join_paths(zstd_rootdir, 'tests/datagencli.c')] +datagen = executable('datagen', + datagen_sources, + c_args: [ '-DNDEBUG' ], + include_directories: test_includes, + dependencies: libzstd_dep, + install: false) + +fullbench_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), + join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'programs/benchfn.c'), + join_paths(zstd_rootdir, 'programs/benchzstd.c'), + join_paths(zstd_rootdir, 'tests/fullbench.c')] +fullbench = executable('fullbench', + fullbench_sources, + include_directories: test_includes, + dependencies: libzstd_dep, + install: false) + +fuzzer_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), + join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'tests/fuzzer.c')] +fuzzer = executable('fuzzer', + fuzzer_sources, + include_directories: test_includes, + dependencies: libzstd_dep, + install: false) + +zstreamtest_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), + join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'tests/seqgen.c'), + join_paths(zstd_rootdir, 'tests/zstreamtest.c')] +zstreamtest = executable('zstreamtest', + zstreamtest_sources, + include_directories: test_includes, + dependencies: libzstd_dep, + install: false) + +paramgrill_sources = [join_paths(zstd_rootdir, 'programs/benchfn.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'programs/benchzstd.c'), + join_paths(zstd_rootdir, 'programs/datagen.c'), + join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'tests/paramgrill.c')] +paramgrill = executable('paramgrill', + paramgrill_sources, + include_directories: test_includes, + dependencies: [ libzstd_dep, libm_dep ], + install: false) + +roundTripCrash_sources = [join_paths(zstd_rootdir, 'tests/roundTripCrash.c')] +roundTripCrash = executable('roundTripCrash', + roundTripCrash_sources, + dependencies: [ libzstd_dep ], + install: false) + +longmatch_sources = [join_paths(zstd_rootdir, 'tests/longmatch.c')] +longmatch = executable('longmatch', + longmatch_sources, + dependencies: [ libzstd_dep ], + install: false) + +invalidDictionaries_sources = [join_paths(zstd_rootdir, 'tests/invalidDictionaries.c')] +invalidDictionaries = executable('invalidDictionaries', + invalidDictionaries_sources, + dependencies: [ libzstd_dep ], + install: false) + +if 0 < legacy_level and legacy_level <= 4 + legacy_sources = [join_paths(zstd_rootdir, 'tests/legacy.c')] + legacy = executable('legacy', + legacy_sources, + # Use -Dlegacy_level build option to control it + #c_args: '-DZSTD_LEGACY_SUPPORT=4', + dependencies: [ libzstd_dep ], + install: false) +endif + +decodecorpus_sources = [join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'tests/decodecorpus.c')] +decodecorpus = executable('decodecorpus', + decodecorpus_sources, + include_directories: test_includes, + dependencies: [ libzstd_dep, libm_dep ], + install: false) + +poolTests_sources = [join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'tests/poolTests.c'), + join_paths(zstd_rootdir, 'lib/common/pool.c'), + join_paths(zstd_rootdir, 'lib/common/threading.c'), + join_paths(zstd_rootdir, 'lib/common/zstd_common.c'), + join_paths(zstd_rootdir, 'lib/common/error_private.c')] +poolTests = executable('poolTests', + poolTests_sources, + include_directories: test_includes, + dependencies: [ libzstd_dep, thread_dep ], + install: false) + +checkTag_sources = [join_paths(zstd_rootdir, 'tests/checkTag.c')] +checkTag = executable('checkTag', + checkTag_sources, + dependencies: [ libzstd_dep ], + install: false) + +# ============================================================================= +# Tests (Use "meson test --list" to list all tests) +# ============================================================================= + +if tests_supported_oses.contains(host_machine_os) + valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: true) + valgrindTest_py = files('valgrindTest.py') + test('valgrindTest', + valgrindTest_py, + args: [valgrind_prog.path(), zstd, datagen, fuzzer, fullbench], + depends: [zstd, datagen, fuzzer, fullbench], + timeout: 600) # Timeout should work on HDD drive +endif + +if host_machine_os != os_windows + playTests_sh = find_program(join_paths(zstd_rootdir, 'tests/playTests.sh'), required: true) + test('test-zstd', + playTests_sh, + args: ZSTDRTTEST, + env: ['ZSTD_BIN=' + zstd.full_path(), 'DATAGEN_BIN=./datagen'], + depends: [datagen], + workdir: meson.current_build_dir(), + timeout: 2800) # Timeout should work on HDD drive +endif + +test('test-fullbench-1', + fullbench, + args: ['-i1'], + depends: [datagen], + timeout: 60) +test('test-fullbench-2', + fullbench, + args: ['-i1', '-P0'], + depends: [datagen], + timeout: 60) + +if use_zlib + test('test-fuzzer', + fuzzer, + args: ['-v', FUZZERTEST] + FUZZER_FLAGS, + timeout: 480) +endif + +test('test-zstream-1', + zstreamtest, + args: ['-v', ZSTREAM_TESTTIME] + FUZZER_FLAGS, + timeout: 240) +test('test-zstream-2', + zstreamtest, + args: ['-mt', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS, + timeout: 120) +test('test-zstream-3', + zstreamtest, + args: ['--newapi', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS, + timeout: 120) +test('test-longmatch', longmatch, timeout: 36) +test('test-invalidDictionaries', invalidDictionaries) # should be fast +if 0 < legacy_level and legacy_level <= 4 + test('test-legacy', legacy) # should be fast +endif +test('test-decodecorpus', + decodecorpus, + args: ['-t', DECODECORPUS_TESTTIME], + timeout: 60) +test('test-poolTests', poolTests) # should be fast diff --git a/src/zstd/build/meson/tests/valgrindTest.py b/src/zstd/build/meson/tests/valgrindTest.py new file mode 100644 index 000000000..218f7458b --- /dev/null +++ b/src/zstd/build/meson/tests/valgrindTest.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +# ############################################################################# +# Copyright (c) 2018-present lzutao +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ############################################################################# +import os +import subprocess +import tempfile + + +def valgrindTest(valgrind, datagen, fuzzer, zstd, fullbench): + VALGRIND_ARGS = [valgrind, '--leak-check=full', '--show-leak-kinds=all', '--error-exitcode=1'] + + print('\n ---- valgrind tests : memory analyzer ----') + + subprocess.check_call([*VALGRIND_ARGS, datagen, '-g50M'], stdout=subprocess.DEVNULL) + + if subprocess.call([*VALGRIND_ARGS, zstd], + stdout=subprocess.DEVNULL) == 0: + raise subprocess.CalledProcessError('zstd without argument should have failed') + + with subprocess.Popen([datagen, '-g80'], stdout=subprocess.PIPE) as p1, \ + subprocess.Popen([*VALGRIND_ARGS, zstd, '-', '-c'], + stdin=p1.stdout, + stdout=subprocess.DEVNULL) as p2: + p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. + p2.communicate() + if p2.returncode != 0: + raise subprocess.CalledProcessError() + + with subprocess.Popen([datagen, '-g16KB'], stdout=subprocess.PIPE) as p1, \ + subprocess.Popen([*VALGRIND_ARGS, zstd, '-vf', '-', '-c'], + stdin=p1.stdout, + stdout=subprocess.DEVNULL) as p2: + p1.stdout.close() + p2.communicate() + if p2.returncode != 0: + raise subprocess.CalledProcessError() + + with tempfile.NamedTemporaryFile() as tmp_fd: + with subprocess.Popen([datagen, '-g2930KB'], stdout=subprocess.PIPE) as p1, \ + subprocess.Popen([*VALGRIND_ARGS, zstd, '-5', '-vf', '-', '-o', tmp_fd.name], + stdin=p1.stdout) as p2: + p1.stdout.close() + p2.communicate() + if p2.returncode != 0: + raise subprocess.CalledProcessError() + + subprocess.check_call([*VALGRIND_ARGS, zstd, '-vdf', tmp_fd.name, '-c'], + stdout=subprocess.DEVNULL) + + with subprocess.Popen([datagen, '-g64MB'], stdout=subprocess.PIPE) as p1, \ + subprocess.Popen([*VALGRIND_ARGS, zstd, '-vf', '-', '-c'], + stdin=p1.stdout, + stdout=subprocess.DEVNULL) as p2: + p1.stdout.close() + p2.communicate() + if p2.returncode != 0: + raise subprocess.CalledProcessError() + + subprocess.check_call([*VALGRIND_ARGS, fuzzer, '-T1mn', '-t1']) + subprocess.check_call([*VALGRIND_ARGS, fullbench, '-i1']) + + +def main(): + import argparse + parser = argparse.ArgumentParser(description='Valgrind tests : memory analyzer') + parser.add_argument('valgrind', help='valgrind path') + parser.add_argument('zstd', help='zstd path') + parser.add_argument('datagen', help='datagen path') + parser.add_argument('fuzzer', help='fuzzer path') + parser.add_argument('fullbench', help='fullbench path') + + args = parser.parse_args() + + valgrind = args.valgrind + zstd = args.zstd + datagen = args.datagen + fuzzer = args.fuzzer + fullbench = args.fullbench + + valgrindTest(valgrind, datagen, fuzzer, zstd, fullbench) + + +if __name__ == '__main__': + main() -- cgit v1.2.3