extlz4 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -4
- data/bin/extlz4 +1 -1
- data/contrib/lz4/NEWS +36 -0
- data/contrib/lz4/README.md +11 -12
- data/contrib/lz4/build/README.md +55 -0
- data/contrib/lz4/build/VS2010/datagen/datagen.vcxproj +169 -0
- data/contrib/lz4/build/VS2010/frametest/frametest.vcxproj +176 -0
- data/contrib/lz4/build/VS2010/fullbench-dll/fullbench-dll.vcxproj +180 -0
- data/contrib/lz4/build/VS2010/fullbench/fullbench.vcxproj +176 -0
- data/contrib/lz4/build/VS2010/fuzzer/fuzzer.vcxproj +173 -0
- data/contrib/lz4/build/VS2010/liblz4-dll/liblz4-dll.rc +51 -0
- data/contrib/lz4/build/VS2010/liblz4-dll/liblz4-dll.vcxproj +179 -0
- data/contrib/lz4/build/VS2010/liblz4/liblz4.vcxproj +175 -0
- data/contrib/lz4/build/VS2010/lz4.sln +98 -0
- data/contrib/lz4/build/VS2010/lz4/lz4.rc +51 -0
- data/contrib/lz4/build/VS2010/lz4/lz4.vcxproj +189 -0
- data/contrib/lz4/build/VS2017/datagen/datagen.vcxproj +173 -0
- data/contrib/lz4/build/VS2017/frametest/frametest.vcxproj +180 -0
- data/contrib/lz4/build/VS2017/fullbench-dll/fullbench-dll.vcxproj +184 -0
- data/contrib/lz4/build/VS2017/fullbench/fullbench.vcxproj +180 -0
- data/contrib/lz4/build/VS2017/fuzzer/fuzzer.vcxproj +177 -0
- data/contrib/lz4/build/VS2017/liblz4-dll/liblz4-dll.rc +51 -0
- data/contrib/lz4/build/VS2017/liblz4-dll/liblz4-dll.vcxproj +183 -0
- data/contrib/lz4/build/VS2017/liblz4/liblz4.vcxproj +179 -0
- data/contrib/lz4/build/VS2017/lz4.sln +103 -0
- data/contrib/lz4/build/VS2017/lz4/lz4.rc +51 -0
- data/contrib/lz4/build/VS2017/lz4/lz4.vcxproj +164 -0
- data/contrib/lz4/build/cmake/CMakeLists.txt +235 -0
- data/contrib/lz4/lib/README.md +27 -10
- data/contrib/lz4/lib/lz4.c +327 -230
- data/contrib/lz4/lib/lz4.h +80 -70
- data/contrib/lz4/lib/lz4frame.c +93 -54
- data/contrib/lz4/lib/lz4frame.h +22 -14
- data/contrib/lz4/lib/lz4hc.c +192 -115
- data/contrib/lz4/lib/lz4hc.h +15 -40
- data/contrib/lz4/ossfuzz/Makefile +12 -8
- data/contrib/lz4/ossfuzz/compress_frame_fuzzer.c +11 -5
- data/contrib/lz4/ossfuzz/compress_fuzzer.c +9 -2
- data/contrib/lz4/ossfuzz/compress_hc_fuzzer.c +10 -3
- data/contrib/lz4/ossfuzz/decompress_frame_fuzzer.c +11 -3
- data/contrib/lz4/ossfuzz/decompress_fuzzer.c +6 -2
- data/contrib/lz4/ossfuzz/fuzz_data_producer.c +77 -0
- data/contrib/lz4/ossfuzz/fuzz_data_producer.h +36 -0
- data/contrib/lz4/ossfuzz/round_trip_frame_fuzzer.c +8 -4
- data/contrib/lz4/ossfuzz/round_trip_fuzzer.c +9 -2
- data/contrib/lz4/ossfuzz/round_trip_hc_fuzzer.c +7 -2
- data/contrib/lz4/ossfuzz/travisoss.sh +6 -1
- data/contrib/lz4/tmp +0 -0
- data/contrib/lz4/tmpsparse +0 -0
- data/ext/extlz4.c +2 -0
- data/ext/extlz4.h +5 -0
- data/ext/hashargs.c +1 -1
- data/ext/hashargs.h +1 -1
- data/gemstub.rb +3 -14
- data/lib/extlz4.rb +0 -2
- data/lib/extlz4/oldstream.rb +1 -1
- metadata +40 -25
- data/lib/extlz4/version.rb +0 -3
@@ -0,0 +1,51 @@
|
|
1
|
+
// Microsoft Visual C++ generated resource script.
|
2
|
+
//
|
3
|
+
|
4
|
+
#include "lz4.h" /* LZ4_VERSION_STRING */
|
5
|
+
#define APSTUDIO_READONLY_SYMBOLS
|
6
|
+
#include "verrsrc.h"
|
7
|
+
#undef APSTUDIO_READONLY_SYMBOLS
|
8
|
+
|
9
|
+
|
10
|
+
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
11
|
+
LANGUAGE 9, 1
|
12
|
+
|
13
|
+
/////////////////////////////////////////////////////////////////////////////
|
14
|
+
//
|
15
|
+
// Version
|
16
|
+
//
|
17
|
+
|
18
|
+
VS_VERSION_INFO VERSIONINFO
|
19
|
+
FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0
|
20
|
+
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0
|
21
|
+
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
22
|
+
#ifdef _DEBUG
|
23
|
+
FILEFLAGS VS_FF_DEBUG
|
24
|
+
#else
|
25
|
+
FILEFLAGS 0x0L
|
26
|
+
#endif
|
27
|
+
FILEOS VOS_NT_WINDOWS32
|
28
|
+
FILETYPE VFT_DLL
|
29
|
+
FILESUBTYPE VFT2_UNKNOWN
|
30
|
+
BEGIN
|
31
|
+
BLOCK "StringFileInfo"
|
32
|
+
BEGIN
|
33
|
+
BLOCK "040904B0"
|
34
|
+
BEGIN
|
35
|
+
VALUE "CompanyName", "Yann Collet"
|
36
|
+
VALUE "FileDescription", "Extremely fast compression"
|
37
|
+
VALUE "FileVersion", LZ4_VERSION_STRING
|
38
|
+
VALUE "InternalName", "lz4.exe"
|
39
|
+
VALUE "LegalCopyright", "Copyright (C) 2013-2016, Yann Collet"
|
40
|
+
VALUE "OriginalFilename", "lz4.exe"
|
41
|
+
VALUE "ProductName", "LZ4"
|
42
|
+
VALUE "ProductVersion", LZ4_VERSION_STRING
|
43
|
+
END
|
44
|
+
END
|
45
|
+
BLOCK "VarFileInfo"
|
46
|
+
BEGIN
|
47
|
+
VALUE "Translation", 0x0409, 1200
|
48
|
+
END
|
49
|
+
END
|
50
|
+
|
51
|
+
#endif
|
@@ -0,0 +1,164 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
+
<ItemGroup Label="ProjectConfigurations">
|
4
|
+
<ProjectConfiguration Include="Debug|Win32">
|
5
|
+
<Configuration>Debug</Configuration>
|
6
|
+
<Platform>Win32</Platform>
|
7
|
+
</ProjectConfiguration>
|
8
|
+
<ProjectConfiguration Include="Release|Win32">
|
9
|
+
<Configuration>Release</Configuration>
|
10
|
+
<Platform>Win32</Platform>
|
11
|
+
</ProjectConfiguration>
|
12
|
+
<ProjectConfiguration Include="Debug|x64">
|
13
|
+
<Configuration>Debug</Configuration>
|
14
|
+
<Platform>x64</Platform>
|
15
|
+
</ProjectConfiguration>
|
16
|
+
<ProjectConfiguration Include="Release|x64">
|
17
|
+
<Configuration>Release</Configuration>
|
18
|
+
<Platform>x64</Platform>
|
19
|
+
</ProjectConfiguration>
|
20
|
+
</ItemGroup>
|
21
|
+
<PropertyGroup Label="Globals">
|
22
|
+
<VCProjectVersion>15.0</VCProjectVersion>
|
23
|
+
<ProjectGuid>{60A3115E-B988-41EE-8815-F4D4F253D866}</ProjectGuid>
|
24
|
+
<RootNamespace>lz4</RootNamespace>
|
25
|
+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
26
|
+
</PropertyGroup>
|
27
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
28
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
29
|
+
<ConfigurationType>Application</ConfigurationType>
|
30
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
31
|
+
<PlatformToolset>v141</PlatformToolset>
|
32
|
+
<CharacterSet>Unicode</CharacterSet>
|
33
|
+
</PropertyGroup>
|
34
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
35
|
+
<ConfigurationType>Application</ConfigurationType>
|
36
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
37
|
+
<PlatformToolset>v141</PlatformToolset>
|
38
|
+
<WholeProgramOptimization>false</WholeProgramOptimization>
|
39
|
+
<CharacterSet>Unicode</CharacterSet>
|
40
|
+
</PropertyGroup>
|
41
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
42
|
+
<ConfigurationType>Application</ConfigurationType>
|
43
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
44
|
+
<PlatformToolset>v141</PlatformToolset>
|
45
|
+
<CharacterSet>MultiByte</CharacterSet>
|
46
|
+
</PropertyGroup>
|
47
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
48
|
+
<ConfigurationType>Application</ConfigurationType>
|
49
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
50
|
+
<PlatformToolset>v141</PlatformToolset>
|
51
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
52
|
+
<CharacterSet>MultiByte</CharacterSet>
|
53
|
+
</PropertyGroup>
|
54
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
55
|
+
<ImportGroup Label="ExtensionSettings">
|
56
|
+
</ImportGroup>
|
57
|
+
<ImportGroup Label="Shared">
|
58
|
+
</ImportGroup>
|
59
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
60
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
61
|
+
</ImportGroup>
|
62
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
63
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
64
|
+
</ImportGroup>
|
65
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
66
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
67
|
+
</ImportGroup>
|
68
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
69
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
70
|
+
</ImportGroup>
|
71
|
+
<PropertyGroup Label="UserMacros" />
|
72
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
73
|
+
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
74
|
+
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
75
|
+
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
76
|
+
</PropertyGroup>
|
77
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
78
|
+
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
79
|
+
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
80
|
+
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
81
|
+
<LinkIncremental>false</LinkIncremental>
|
82
|
+
</PropertyGroup>
|
83
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
84
|
+
<ClCompile>
|
85
|
+
<WarningLevel>Level4</WarningLevel>
|
86
|
+
<Optimization>Disabled</Optimization>
|
87
|
+
<SDLCheck>true</SDLCheck>
|
88
|
+
<ConformanceMode>true</ConformanceMode>
|
89
|
+
<TreatWarningAsError>true</TreatWarningAsError>
|
90
|
+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
91
|
+
</ClCompile>
|
92
|
+
<Link>
|
93
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
94
|
+
<SubSystem>Console</SubSystem>
|
95
|
+
<OptimizeReferences>false</OptimizeReferences>
|
96
|
+
<EnableCOMDATFolding>false</EnableCOMDATFolding>
|
97
|
+
</Link>
|
98
|
+
</ItemDefinitionGroup>
|
99
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
100
|
+
<ClCompile>
|
101
|
+
<WarningLevel>Level3</WarningLevel>
|
102
|
+
<Optimization>Disabled</Optimization>
|
103
|
+
<SDLCheck>true</SDLCheck>
|
104
|
+
<ConformanceMode>true</ConformanceMode>
|
105
|
+
</ClCompile>
|
106
|
+
</ItemDefinitionGroup>
|
107
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
108
|
+
<ClCompile>
|
109
|
+
<WarningLevel>Level3</WarningLevel>
|
110
|
+
<Optimization>MaxSpeed</Optimization>
|
111
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
112
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
113
|
+
<SDLCheck>true</SDLCheck>
|
114
|
+
<ConformanceMode>true</ConformanceMode>
|
115
|
+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
116
|
+
</ClCompile>
|
117
|
+
<Link>
|
118
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
119
|
+
<OptimizeReferences>true</OptimizeReferences>
|
120
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
121
|
+
<SubSystem>Console</SubSystem>
|
122
|
+
</Link>
|
123
|
+
</ItemDefinitionGroup>
|
124
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
125
|
+
<ClCompile>
|
126
|
+
<WarningLevel>Level3</WarningLevel>
|
127
|
+
<Optimization>MaxSpeed</Optimization>
|
128
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
129
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
130
|
+
<SDLCheck>true</SDLCheck>
|
131
|
+
<ConformanceMode>true</ConformanceMode>
|
132
|
+
</ClCompile>
|
133
|
+
<Link>
|
134
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
135
|
+
<OptimizeReferences>true</OptimizeReferences>
|
136
|
+
</Link>
|
137
|
+
</ItemDefinitionGroup>
|
138
|
+
<ItemGroup>
|
139
|
+
<ClCompile Include="..\..\..\lib\lz4.c" />
|
140
|
+
<ClCompile Include="..\..\..\lib\lz4frame.c" />
|
141
|
+
<ClCompile Include="..\..\..\lib\lz4hc.c" />
|
142
|
+
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
143
|
+
<ClCompile Include="..\..\..\programs\bench.c" />
|
144
|
+
<ClCompile Include="..\..\..\programs\datagen.c" />
|
145
|
+
<ClCompile Include="..\..\..\programs\lz4cli.c" />
|
146
|
+
<ClCompile Include="..\..\..\programs\lz4io.c" />
|
147
|
+
</ItemGroup>
|
148
|
+
<ItemGroup>
|
149
|
+
<ClInclude Include="..\..\..\lib\lz4.h" />
|
150
|
+
<ClInclude Include="..\..\..\lib\lz4frame.h" />
|
151
|
+
<ClInclude Include="..\..\..\lib\lz4frame_static.h" />
|
152
|
+
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
153
|
+
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
154
|
+
<ClInclude Include="..\..\..\programs\bench.h" />
|
155
|
+
<ClInclude Include="..\..\..\programs\datagen.h" />
|
156
|
+
<ClInclude Include="..\..\..\programs\lz4io.h" />
|
157
|
+
</ItemGroup>
|
158
|
+
<ItemGroup>
|
159
|
+
<ResourceCompile Include="lz4.rc" />
|
160
|
+
</ItemGroup>
|
161
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
162
|
+
<ImportGroup Label="ExtensionTargets">
|
163
|
+
</ImportGroup>
|
164
|
+
</Project>
|
@@ -0,0 +1,235 @@
|
|
1
|
+
# CMake support for LZ4
|
2
|
+
#
|
3
|
+
# To the extent possible under law, the author(s) have dedicated all
|
4
|
+
# copyright and related and neighboring rights to this software to
|
5
|
+
# the public domain worldwide. This software is distributed without
|
6
|
+
# any warranty.
|
7
|
+
#
|
8
|
+
# For details, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
9
|
+
#
|
10
|
+
# LZ4's CMake support is maintained by Evan Nemerson; when filing
|
11
|
+
# bugs please mention @nemequ to make sure I see it.
|
12
|
+
|
13
|
+
set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
|
14
|
+
|
15
|
+
option(LZ4_BUILD_CLI "Build lz4 program" ON)
|
16
|
+
option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c progam with legacy argument support" ON)
|
17
|
+
|
18
|
+
# Parse version information
|
19
|
+
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_MAJOR REGEX "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$")
|
20
|
+
string(REGEX REPLACE "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$" "\\1" LZ4_VERSION_MAJOR "${LZ4_VERSION_MAJOR}")
|
21
|
+
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_MINOR REGEX "^#define LZ4_VERSION_MINOR +([0-9]+) +.*$")
|
22
|
+
string(REGEX REPLACE "^#define LZ4_VERSION_MINOR +([0-9]+) +.*$" "\\1" LZ4_VERSION_MINOR "${LZ4_VERSION_MINOR}")
|
23
|
+
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_RELEASE REGEX "^#define LZ4_VERSION_RELEASE +([0-9]+) +.*$")
|
24
|
+
string(REGEX REPLACE "^#define LZ4_VERSION_RELEASE +([0-9]+) +.*$" "\\1" LZ4_VERSION_RELEASE "${LZ4_VERSION_RELEASE}")
|
25
|
+
set(LZ4_VERSION_STRING "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}")
|
26
|
+
mark_as_advanced(LZ4_VERSION_STRING LZ4_VERSION_MAJOR LZ4_VERSION_MINOR LZ4_VERSION_RELEASE)
|
27
|
+
|
28
|
+
if("${CMAKE_VERSION}" VERSION_LESS "3.0")
|
29
|
+
project(LZ4 C)
|
30
|
+
else()
|
31
|
+
cmake_policy (SET CMP0048 NEW)
|
32
|
+
project(LZ4
|
33
|
+
VERSION ${LZ4_VERSION_STRING}
|
34
|
+
LANGUAGES C)
|
35
|
+
endif()
|
36
|
+
|
37
|
+
cmake_minimum_required (VERSION 2.8.6)
|
38
|
+
|
39
|
+
# If LZ4 is being bundled in another project, we don't want to
|
40
|
+
# install anything. However, we want to let people override this, so
|
41
|
+
# we'll use the LZ4_BUNDLED_MODE variable to let them do that; just
|
42
|
+
# set it to OFF in your project before you add_subdirectory(lz4/contrib/cmake_unofficial).
|
43
|
+
get_directory_property(LZ4_PARENT_DIRECTORY PARENT_DIRECTORY)
|
44
|
+
if("${LZ4_BUNDLED_MODE}" STREQUAL "")
|
45
|
+
# Bundled mode hasn't been set one way or the other, set the default
|
46
|
+
# depending on whether or not we are the top-level project.
|
47
|
+
if("${LZ4_PARENT_DIRECTORY}" STREQUAL "")
|
48
|
+
set(LZ4_BUNDLED_MODE OFF)
|
49
|
+
else()
|
50
|
+
set(LZ4_BUNDLED_MODE ON)
|
51
|
+
endif()
|
52
|
+
endif()
|
53
|
+
mark_as_advanced(LZ4_BUNDLED_MODE)
|
54
|
+
|
55
|
+
# CPack
|
56
|
+
if(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED)
|
57
|
+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library")
|
58
|
+
set(CPACK_PACKAGE_DESCRIPTION_FILE "${LZ4_TOP_SOURCE_DIR}/README.md")
|
59
|
+
set(CPACK_RESOURCE_FILE_LICENSE "${LZ4_TOP_SOURCE_DIR}/LICENSE")
|
60
|
+
set(CPACK_PACKAGE_VERSION_MAJOR ${LZ4_VERSION_MAJOR})
|
61
|
+
set(CPACK_PACKAGE_VERSION_MINOR ${LZ4_VERSION_MINOR})
|
62
|
+
set(CPACK_PACKAGE_VERSION_PATCH ${LZ4_VERSION_RELEASE})
|
63
|
+
include(CPack)
|
64
|
+
endif(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED)
|
65
|
+
|
66
|
+
# Allow people to choose whether to build shared or static libraries
|
67
|
+
# via the BUILD_SHARED_LIBS option unless we are in bundled mode, in
|
68
|
+
# which case we always use static libraries.
|
69
|
+
include(CMakeDependentOption)
|
70
|
+
CMAKE_DEPENDENT_OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON "NOT LZ4_BUNDLED_MODE" OFF)
|
71
|
+
CMAKE_DEPENDENT_OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF "BUILD_SHARED_LIBS" ON)
|
72
|
+
|
73
|
+
if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
|
74
|
+
message(FATAL_ERROR "Both BUILD_SHARED_LIBS and BUILD_STATIC_LIBS have been disabled")
|
75
|
+
endif()
|
76
|
+
|
77
|
+
set(LZ4_LIB_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/lib")
|
78
|
+
set(LZ4_PROG_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/programs")
|
79
|
+
|
80
|
+
include_directories("${LZ4_LIB_SOURCE_DIR}")
|
81
|
+
|
82
|
+
# CLI sources
|
83
|
+
set(LZ4_SOURCES
|
84
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4.c"
|
85
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4hc.c"
|
86
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4.h"
|
87
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4hc.h"
|
88
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4frame.c"
|
89
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4frame.h"
|
90
|
+
"${LZ4_LIB_SOURCE_DIR}/xxhash.c")
|
91
|
+
set(LZ4_CLI_SOURCES
|
92
|
+
"${LZ4_PROG_SOURCE_DIR}/bench.c"
|
93
|
+
"${LZ4_PROG_SOURCE_DIR}/lz4cli.c"
|
94
|
+
"${LZ4_PROG_SOURCE_DIR}/lz4io.c"
|
95
|
+
"${LZ4_PROG_SOURCE_DIR}/datagen.c")
|
96
|
+
|
97
|
+
# Whether to use position independent code for the static library. If
|
98
|
+
# we're building a shared library this is ignored and PIC is always
|
99
|
+
# used.
|
100
|
+
option(LZ4_POSITION_INDEPENDENT_LIB "Use position independent code for static library (if applicable)" ON)
|
101
|
+
|
102
|
+
# liblz4
|
103
|
+
set(LZ4_LIBRARIES_BUILT)
|
104
|
+
if(BUILD_SHARED_LIBS)
|
105
|
+
add_library(lz4_shared SHARED ${LZ4_SOURCES})
|
106
|
+
set_target_properties(lz4_shared PROPERTIES
|
107
|
+
OUTPUT_NAME lz4
|
108
|
+
SOVERSION "${LZ4_VERSION_MAJOR}"
|
109
|
+
VERSION "${LZ4_VERSION_STRING}")
|
110
|
+
if(MSVC)
|
111
|
+
target_compile_definitions(lz4_shared PRIVATE
|
112
|
+
LZ4_DLL_EXPORT=1)
|
113
|
+
endif()
|
114
|
+
list(APPEND LZ4_LIBRARIES_BUILT lz4_shared)
|
115
|
+
endif()
|
116
|
+
if(BUILD_STATIC_LIBS)
|
117
|
+
add_library(lz4_static STATIC ${LZ4_SOURCES})
|
118
|
+
set_target_properties(lz4_static PROPERTIES
|
119
|
+
OUTPUT_NAME lz4
|
120
|
+
POSITION_INDEPENDENT_CODE ${LZ4_POSITION_INDEPENDENT_LIB})
|
121
|
+
list(APPEND LZ4_LIBRARIES_BUILT lz4_static)
|
122
|
+
endif()
|
123
|
+
|
124
|
+
# link to shared whenever possible, to static otherwise
|
125
|
+
if(BUILD_SHARED_LIBS)
|
126
|
+
set(LZ4_LINK_LIBRARY lz4_shared)
|
127
|
+
else()
|
128
|
+
set(LZ4_LINK_LIBRARY lz4_static)
|
129
|
+
endif()
|
130
|
+
|
131
|
+
# lz4
|
132
|
+
if (LZ4_BUILD_CLI)
|
133
|
+
set(LZ4_PROGRAMS_BUILT lz4cli)
|
134
|
+
add_executable(lz4cli ${LZ4_CLI_SOURCES})
|
135
|
+
set_target_properties(lz4cli PROPERTIES OUTPUT_NAME lz4)
|
136
|
+
target_link_libraries(lz4cli ${LZ4_LINK_LIBRARY})
|
137
|
+
endif()
|
138
|
+
|
139
|
+
# lz4c
|
140
|
+
if (LZ4_BUILD_LEGACY_LZ4C)
|
141
|
+
list(APPEND LZ4_PROGRAMS_BUILT lz4c)
|
142
|
+
add_executable(lz4c ${LZ4_CLI_SOURCES})
|
143
|
+
set_target_properties(lz4c PROPERTIES COMPILE_DEFINITIONS "ENABLE_LZ4C_LEGACY_OPTIONS")
|
144
|
+
target_link_libraries(lz4c ${LZ4_LINK_LIBRARY})
|
145
|
+
endif()
|
146
|
+
|
147
|
+
# Extra warning flags
|
148
|
+
include (CheckCCompilerFlag)
|
149
|
+
foreach (flag
|
150
|
+
# GCC-style
|
151
|
+
-Wall
|
152
|
+
-Wextra
|
153
|
+
-Wundef
|
154
|
+
-Wcast-qual
|
155
|
+
-Wcast-align
|
156
|
+
-Wshadow
|
157
|
+
-Wswitch-enum
|
158
|
+
-Wdeclaration-after-statement
|
159
|
+
-Wstrict-prototypes
|
160
|
+
-Wpointer-arith
|
161
|
+
|
162
|
+
# MSVC-style
|
163
|
+
/W4)
|
164
|
+
# Because https://gcc.gnu.org/wiki/FAQ#wnowarning
|
165
|
+
string(REGEX REPLACE "\\-Wno\\-(.+)" "-W\\1" flag_to_test "${flag}")
|
166
|
+
string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" test_name "CFLAG_${flag_to_test}")
|
167
|
+
|
168
|
+
check_c_compiler_flag("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${test_name})
|
169
|
+
|
170
|
+
if(${test_name})
|
171
|
+
set(CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}")
|
172
|
+
endif()
|
173
|
+
|
174
|
+
unset(test_name)
|
175
|
+
unset(flag_to_test)
|
176
|
+
endforeach (flag)
|
177
|
+
|
178
|
+
if(NOT LZ4_BUNDLED_MODE)
|
179
|
+
include(GNUInstallDirs)
|
180
|
+
|
181
|
+
install(TARGETS ${LZ4_PROGRAMS_BUILT}
|
182
|
+
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
183
|
+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
184
|
+
install(TARGETS ${LZ4_LIBRARIES_BUILT}
|
185
|
+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
186
|
+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
187
|
+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
188
|
+
install(FILES
|
189
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4.h"
|
190
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4frame.h"
|
191
|
+
"${LZ4_LIB_SOURCE_DIR}/lz4hc.h"
|
192
|
+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
193
|
+
install(FILES "${LZ4_PROG_SOURCE_DIR}/lz4.1"
|
194
|
+
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
|
195
|
+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblz4.pc"
|
196
|
+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
197
|
+
|
198
|
+
# install lz4cat and unlz4 symlinks on *nix
|
199
|
+
if(UNIX AND LZ4_BUILD_CLI)
|
200
|
+
install(CODE "
|
201
|
+
foreach(f lz4cat unlz4)
|
202
|
+
set(dest \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/\${f}\")
|
203
|
+
message(STATUS \"Symlinking: \${dest} -> lz4\")
|
204
|
+
execute_process(
|
205
|
+
COMMAND \"${CMAKE_COMMAND}\" -E create_symlink lz4 \"\${dest}\")
|
206
|
+
endforeach()
|
207
|
+
")
|
208
|
+
|
209
|
+
# create manpage aliases
|
210
|
+
foreach(f lz4cat unlz4)
|
211
|
+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" ".so man1/lz4.1\n")
|
212
|
+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${f}.1"
|
213
|
+
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
|
214
|
+
endforeach()
|
215
|
+
endif(UNIX AND LZ4_BUILD_CLI)
|
216
|
+
endif(NOT LZ4_BUNDLED_MODE)
|
217
|
+
|
218
|
+
# pkg-config
|
219
|
+
set(PREFIX "${CMAKE_INSTALL_PREFIX}")
|
220
|
+
|
221
|
+
if("${CMAKE_INSTALL_FULL_LIBDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
222
|
+
set(LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
223
|
+
else()
|
224
|
+
set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
225
|
+
endif()
|
226
|
+
|
227
|
+
if("${CMAKE_INSTALL_FULL_INCLUDEDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
|
228
|
+
set(INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
229
|
+
else()
|
230
|
+
set(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
|
231
|
+
endif()
|
232
|
+
|
233
|
+
# for liblz4.pc substitution
|
234
|
+
set(VERSION ${LZ4_VERSION_STRING})
|
235
|
+
configure_file(${LZ4_LIB_SOURCE_DIR}/liblz4.pc.in liblz4.pc @ONLY)
|