Merge branch 'dev' of github.com:Cyan4973/lz4 into dev

This commit is contained in:
Yann Collet 2016-11-16 11:37:05 -08:00
commit 7fde7438d3
9 changed files with 73 additions and 71 deletions

View File

@ -55,30 +55,27 @@ build_script:
) )
) )
- if [%COMPILER%]==[gcc] if not [%PLATFORM%]==[clang] ( - if [%COMPILER%]==[gcc] if not [%PLATFORM%]==[clang] (
MKDIR bin\dll bin\static bin\fullbench bin\include && MKDIR bin\dll bin\static bin\example bin\include &&
COPY tests\fullbench.c bin\fullbench\ && COPY tests\fullbench.c bin\example\ &&
COPY lib\xxhash.c bin\fullbench\ && COPY lib\xxhash.c bin\example\ &&
COPY lib\xxhash.h bin\fullbench\ && COPY lib\xxhash.h bin\example\ &&
COPY lib\lz4.h bin\include\ && COPY lib\lz4.h bin\include\ &&
COPY lib\lz4hc.h bin\include\ && COPY lib\lz4hc.h bin\include\ &&
COPY lib\lz4frame.h bin\include\ && COPY lib\lz4frame.h bin\include\ &&
COPY lib\liblz4.a bin\static\liblz4_static.lib &&
COPY lib\dll\liblz4.* bin\dll\ && COPY lib\dll\liblz4.* bin\dll\ &&
COPY lib\dll\fullbench-dll\Makefile bin\ && COPY lib\dll\example\Makefile bin\example\ &&
COPY lib\dll\fullbench-dll\fullbench-dll.* bin\fullbench\ && COPY lib\dll\example\fullbench-dll.* bin\example\ &&
COPY lib\dll\README.md bin\ && COPY lib\dll\example\README.md bin\ &&
COPY lib\liblz4.a bin\static\liblz4_static.lib COPY programs\lz4.exe bin\lz4.exe
) )
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] ( - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] (
7z.exe a bin\liblz4_x64.zip .\bin\fullbench .\bin\dll .\bin\static .\bin\include .\bin\Makefile .\bin\README.md && 7z.exe a bin\lz4_x64.zip NEWS .\bin\lz4.exe .\bin\README.md .\bin\example .\bin\dll .\bin\static .\bin\include &&
appveyor PushArtifact bin\liblz4_x64.zip && appveyor PushArtifact bin\lz4_x64.zip
COPY programs\lz4.exe bin\lz4.exe &&
appveyor PushArtifact bin\lz4.exe
) )
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] ( - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] (
7z.exe a bin\liblz4_x86.zip .\bin\fullbench .\bin\dll .\bin\static .\bin\include .\bin\Makefile .\bin\README.md && 7z.exe a bin\lz4_x86.zip NEWS .\bin\lz4.exe .\bin\README.md .\bin\example .\bin\dll .\bin\static .\bin\include &&
appveyor PushArtifact bin\liblz4_x86.zip && appveyor PushArtifact bin\lz4_x86.zip
COPY programs\lz4.exe bin\lz4_32.exe &&
appveyor PushArtifact bin\lz4_32.exe
) )
- if [%COMPILER%]==[gcc] (COPY tests\fullbench.exe programs\) - if [%COMPILER%]==[gcc] (COPY tests\fullbench.exe programs\)
- if [%COMPILER%]==[visual] ( - if [%COMPILER%]==[visual] (
@ -117,47 +114,27 @@ test_script:
) )
artifacts: artifacts:
- path: bin\lz4.exe - path: bin\lz4_x64.zip
- path: bin\lz4_32.exe - path: bin\lz4_x86.zip
- path: bin\liblz4_x64.zip
- path: bin\liblz4_x86.zip
deploy: deploy:
- provider: GitHub - provider: GitHub
artifact: bin\lz4_x64.zip
auth_token: auth_token:
secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId
artifact: bin\lz4.exe
force_update: true force_update: true
prerelease: true
on: on:
COMPILER: gcc COMPILER: gcc
PLATFORM: "mingw64" PLATFORM: "mingw64"
appveyor_repo_tag: true appveyor_repo_tag: true
- provider: GitHub - provider: GitHub
artifact: bin\lz4_x86.zip
auth_token: auth_token:
secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId
artifact: bin\lz4_32.exe
force_update: true
on:
COMPILER: gcc
PLATFORM: "mingw32"
appveyor_repo_tag: true
- provider: GitHub
auth_token:
secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId
artifact: bin\liblz4_x64.zip
force_update: true
on:
COMPILER: gcc
PLATFORM: "mingw64"
appveyor_repo_tag: true
- provider: GitHub
auth_token:
secure: w6UJaGie0qbZvffr/fqyhO/Vj8rMiQWnv9a8qm3gxfngdHDTMT42wYupqJpIExId
artifact: bin\liblz4_x86.zip
force_update: true force_update: true
prerelease: true
on: on:
COMPILER: gcc COMPILER: gcc
PLATFORM: "mingw32" PLATFORM: "mingw32"

View File

@ -42,12 +42,16 @@ It must be used with static linking ***only***.
DLL can be created using MinGW+MSYS with the `make liblz4` command. DLL can be created using MinGW+MSYS with the `make liblz4` command.
This command creates `dll\liblz4.dll` and the import library `dll\liblz4.lib`. This command creates `dll\liblz4.dll` and the import library `dll\liblz4.lib`.
To compile a project the import library has to be added to linking options. The import library is only required with Visual C++.
The header files `lz4.h`, `lz4hc.h`, `lz4frame.h` and the dynamic library
`dll\liblz4.dll` are required to compile a project using gcc/MinGW.
The dynamic library has to be added to linking options.
It means that if a project that uses LZ4 consists of a single `test-dll.c` It means that if a project that uses LZ4 consists of a single `test-dll.c`
file it should be compiled with "liblz4.lib". For example: file it should be compiled with "liblz4.lib". For example:
``` ```
gcc $(CFLAGS) test-dll.c -o test-dll liblz4.lib gcc $(CFLAGS) -Iinclude/ test-dll.c -o test-dll dll\liblz4.dll
``` ```
The compiled executable will require LZ4 DLL which is available at `dll\liblz4.dll`.
#### Miscellaneous #### Miscellaneous

View File

@ -24,7 +24,9 @@
# ########################################################################## # ##########################################################################
VOID := /dev/null VOID := /dev/null
LZ4DIR := ./include LZ4DIR := ../include
LIBDIR := ../static
DLLDIR := ../dll
CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make
CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \ CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \
@ -50,11 +52,11 @@ default: all
all: fullbench-dll fullbench-lib all: fullbench-dll fullbench-lib
fullbench-lib: fullbench/fullbench.c fullbench/xxhash.c fullbench-lib: fullbench.c xxhash.c
$(CC) $(FLAGS) $^ -o $@$(EXT) static/liblz4_static.lib $(CC) $(FLAGS) $^ -o $@$(EXT) $(LIBDIR)/liblz4_static.lib
fullbench-dll: fullbench/fullbench.c fullbench/xxhash.c fullbench-dll: fullbench.c xxhash.c
$(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 dll/liblz4.lib $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(DLLDIR)/liblz4.dll
clean: clean:
@$(RM) fullbench-dll$(EXT) fullbench-lib$(EXT) \ @$(RM) fullbench-dll$(EXT) fullbench-lib$(EXT) \

View File

@ -1,38 +1,54 @@
The static and dynamic LZ4 libraries LZ4 Windows binary package
==================================== ====================================
#### The package contents #### The package contents
- `dll\liblz4.dll` : The DLL of LZ4 library - `lz4.exe` : Command Line Utility, supporting gzip-like arguments
- `dll\liblz4.lib` : The import library of LZ4 library - `dll\liblz4.dll` : The DLL of LZ4 library
- `include\` : Header files required with LZ4 library - `dll\liblz4.lib` : The import library of LZ4 library for Visual C++
- `fullbench\` : The example of usage of LZ4 library - `example\` : The example of usage of LZ4 library
- `include\` : Header files required with LZ4 library
- `static\liblz4_static.lib` : The static LZ4 library - `static\liblz4_static.lib` : The static LZ4 library
#### Usage of Command Line Interface
Command Line Interface (CLI) supports gzip-like arguments.
By default CLI takes an input file and compresses it to an output file:
```
Usage: lz4 [arg] [input] [output]
```
The full list of commands for CLI can be obtained with `-h` or `-H`. The ratio can
be improved with commands from `-3` to `-16` but higher levels also have slower
compression. CLI includes in-memory compression benchmark module with compression
levels starting from `-b` and ending with `-e` with iteration time of `-i` seconds.
CLI supports aggregation of parameters i.e. `-b1`, `-e18`, and `-i1` can be joined
into `-b1e18i1`.
#### The example of usage of static and dynamic LZ4 libraries with gcc/MinGW #### The example of usage of static and dynamic LZ4 libraries with gcc/MinGW
Use `make` to build `fullbench-dll` and `fullbench-lib`. Use `cd example` and `make` to build `fullbench-dll` and `fullbench-lib`.
`fullbench-dll` uses a dynamic LZ4 library from the `dll` directory. `fullbench-dll` uses a dynamic LZ4 library from the `dll` directory.
`fullbench-lib` uses a static LZ4 library from the `lib` directory. `fullbench-lib` uses a static LZ4 library from the `lib` directory.
#### Using LZ4 DLL with gcc/MinGW #### Using LZ4 DLL with gcc/MinGW
The header files from `include\` and the import library `dll\liblz4.lib` The header files from `include\` and the dynamic library `dll\liblz4.dll`
are required to compile a project using gcc/MinGW. are required to compile a project using gcc/MinGW.
The import library has to be added to linking options. The dynamic library has to be added to linking options.
It means that if a project that uses LZ4 consists of a single `test-dll.c` It means that if a project that uses LZ4 consists of a single `test-dll.c`
file it should be compiled with "liblz4.lib". For example: file it should be compiled with "liblz4.dll". For example:
``` ```
gcc $(CFLAGS) -Iinclude/ test-dll.c -o test-dll dll\liblz4.lib gcc $(CFLAGS) -Iinclude\ test-dll.c -o test-dll dll\liblz4.dll
``` ```
The compiled executable will require LZ4 DLL which is available at `dll\liblz4.dll`. The compiled executable will require LZ4 DLL which is available at `dll\liblz4.dll`.
#### The example of usage of static and dynamic LZ4 libraries with Visual C++ #### The example of usage of static and dynamic LZ4 libraries with Visual C++
Open `fullbench\fullbench-dll.sln` to compile `fullbench-dll` that uses a Open `example\fullbench-dll.sln` to compile `fullbench-dll` that uses a
dynamic LZ4 library from the `dll` directory. The solution works with Visual C++ dynamic LZ4 library from the `dll` directory. The solution works with Visual C++
2010 or newer. When one will open the solution with Visual C++ newer than 2010 2010 or newer. When one will open the solution with Visual C++ newer than 2010
then the solution will upgraded to the current version. then the solution will upgraded to the current version.

View File

@ -21,7 +21,7 @@ It makes benchmark more precise as it eliminates I/O overhead.
The benchmark measures ratio, compressed size, compression and decompression speed. The benchmark measures ratio, compressed size, compression and decompression speed.
One can select compression levels starting from `-b` and ending with `-e`. One can select compression levels starting from `-b` and ending with `-e`.
The `-i` parameter selects a number of iterations used for each of tested levels. The `-i` parameter selects a number of seconds used for each of tested levels.
@ -39,6 +39,7 @@ Arguments :
-d : decompression (default for .lz4 extension) -d : decompression (default for .lz4 extension)
-z : force compression -z : force compression
-f : overwrite output without prompting -f : overwrite output without prompting
--rm : remove source file(s) after successful de/compression
-h/-H : display help/long help and exit -h/-H : display help/long help and exit
Advanced arguments : Advanced arguments :
@ -48,18 +49,20 @@ Advanced arguments :
-c : force write to standard output, even if it is the console -c : force write to standard output, even if it is the console
-t : test compressed file integrity -t : test compressed file integrity
-m : multiple input files (implies automatic output filenames) -m : multiple input files (implies automatic output filenames)
-r : operate recursively on directories (sets also -m)
-l : compress using Legacy format (Linux kernel compression) -l : compress using Legacy format (Linux kernel compression)
-B# : Block size [4-7](default : 7) -B# : Block size [4-7] (default : 7)
-BD : Block dependency (improve compression ratio) -BD : Block dependency (improve compression ratio)
--no-frame-crc : disable stream checksum (default:enabled) --no-frame-crc : disable stream checksum (default:enabled)
--content-size : compressed frame includes original size (default:not present) --content-size : compressed frame includes original size (default:not present)
--[no-]sparse : sparse mode (default:enabled on file, disabled on stdout) --[no-]sparse : sparse mode (default:enabled on file, disabled on stdout)
Benchmark arguments :
Benchmark arguments : Benchmark arguments :
-b# : benchmark file(s), using # compression level (default : 1) -b# : benchmark file(s), using # compression level (default : 1)
-e# : test all compression levels from -bX to # (default: 1) -e# : test all compression levels from -bX to # (default : 1)
-i# : iteration loops [1-9](default : 3), benchmark mode only -i# : minimum evaluation time in seconds (default : 3s)
``` -B# : cut file into independent blocks of size # bytes [32+]
or predefined block size [4-7] (default: 7)
```
#### License #### License

View File

@ -94,7 +94,7 @@ fullbench-lib: fullbench.c $(LZ4DIR)/xxhash.c
fullbench-dll: fullbench.c $(LZ4DIR)/xxhash.c fullbench-dll: fullbench.c $(LZ4DIR)/xxhash.c
$(MAKE) -C $(LZ4DIR) liblz4 $(MAKE) -C $(LZ4DIR) liblz4
$(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/dll/liblz4.lib $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/dll/liblz4.dll
fuzzer : $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/xxhash.o fuzzer.c fuzzer : $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/xxhash.o fuzzer.c
$(CC) $(FLAGS) $^ -o $@$(EXT) $(CC) $(FLAGS) $^ -o $@$(EXT)

View File

@ -22,7 +22,7 @@ The following projects are included with the lz4 distribution:
#### Projects available within lz4.sln #### Projects available within lz4.sln
The Visual Studio solution file `lz4.sln` contains many projects that will be compiled to the The Visual Studio solution file `lz4.sln` contains many projects that will be compiled to the
`visual\VS2010\bin\$(Platform)_$(Configuration)\lz4.exe` directory. For example `lz4` set to `x64` and `visual\VS2010\bin\$(Platform)_$(Configuration)` directory. For example `lz4` set to `x64` and
`Release` will be compiled to `visual\VS2010\bin\x64_Release\lz4.exe`. The solution file contains the `Release` will be compiled to `visual\VS2010\bin\x64_Release\lz4.exe`. The solution file contains the
following projects: following projects:
@ -43,11 +43,11 @@ The header files `lib\lz4.h`, `lib\lz4hc.h`, `lib\lz4frame.h` and the import lib
project using Visual C++. project using Visual C++.
1. The path to header files should be added to `Additional Include Directories` that can 1. The path to header files should be added to `Additional Include Directories` that can
be found in project properties `C/C++` then `General`. 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 2. The import library has to be added to `Additional Dependencies` that can
be found in project properties `Linker` then `Input`. be found in Project Properties in the `Linker` Property Pages on the `Input` page.
If one will provide only the name `liblz4.lib` without a full path to the library If one will provide only the name `liblz4.lib` without a full path to the library
the directory has to be added to `Linker\General\Additional Library Directories`. then the directory has to be added to `Linker\General\Additional Library Directories`.
The compiled executable will require LZ4 DLL which is available at The compiled executable will require LZ4 DLL which is available at
`visual\VS2010\bin\$(Platform)_$(Configuration)\liblz4.dll`. `visual\VS2010\bin\$(Platform)_$(Configuration)\liblz4.dll`.