Integrate LZ4 library, compress the ramdisk
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m53s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m53s
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,4 +3,5 @@ mop3.iso
|
|||||||
bochs-log.txt
|
bochs-log.txt
|
||||||
bochs-com1.txt
|
bochs-com1.txt
|
||||||
mop3dist.tar
|
mop3dist.tar
|
||||||
|
mop3dist.tar.lz4
|
||||||
site/
|
site/
|
||||||
|
|||||||
1
Makefile
1
Makefile
@@ -1,5 +1,6 @@
|
|||||||
platform ?= amd64
|
platform ?= amd64
|
||||||
|
|
||||||
|
include make/lz4.mk
|
||||||
include make/apps.mk
|
include make/apps.mk
|
||||||
include make/kernel.mk
|
include make/kernel.mk
|
||||||
include make/dist.mk
|
include make/dist.mk
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ if [ "$1" = "debug" ]; then
|
|||||||
debugopt="buildtype=debug"
|
debugopt="buildtype=debug"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
make -B all_lz4
|
||||||
make -B all_kernel "$debugopt"
|
make -B all_kernel "$debugopt"
|
||||||
make -B all_libsystem "$debugopt"
|
make -B all_libsystem "$debugopt"
|
||||||
make -B all_liballoc "$debugopt"
|
make -B all_liballoc "$debugopt"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ cp -v boot/limine/limine-bios.sys boot/limine/limine-bios-cd.bin \
|
|||||||
|
|
||||||
cp -v boot/limine/BOOTX64.EFI boot/limine/BOOTIA32.EFI iso_root/EFI/BOOT
|
cp -v boot/limine/BOOTX64.EFI boot/limine/BOOTIA32.EFI iso_root/EFI/BOOT
|
||||||
|
|
||||||
cp -v mop3dist.tar iso_root/boot
|
cp -v mop3dist.tar.lz4 iso_root/boot
|
||||||
|
|
||||||
xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \
|
xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
|
-no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ timeout: 10
|
|||||||
/mop3
|
/mop3
|
||||||
protocol: limine
|
protocol: limine
|
||||||
path: boot():/boot/kernel.elf
|
path: boot():/boot/kernel.elf
|
||||||
module_path: boot():/boot/mop3dist.tar
|
module_path: boot():/boot/mop3dist.tar.lz4
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ format:
|
|||||||
':!uACPI/source/**' \
|
':!uACPI/source/**' \
|
||||||
':!uACPI/include/**' \
|
':!uACPI/include/**' \
|
||||||
':!uACPI/tests/**' \
|
':!uACPI/tests/**' \
|
||||||
':!libk/printf*')
|
':!libk/printf*' \
|
||||||
|
':!lz4/lz4*')
|
||||||
|
|
||||||
.PHONY: all clean format
|
.PHONY: all clean format
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
#include <libk/std.h>
|
#include <libk/std.h>
|
||||||
#include <libk/string.h>
|
#include <libk/string.h>
|
||||||
#include <limine/requests.h>
|
#include <limine/requests.h>
|
||||||
|
#include <lz4/lz4.h>
|
||||||
|
#include <lz4/lz4frame.h>
|
||||||
#include <mm/liballoc.h>
|
#include <mm/liballoc.h>
|
||||||
#include <status.h>
|
#include <status.h>
|
||||||
#include <sync/spin_lock.h>
|
#include <sync/spin_lock.h>
|
||||||
@@ -102,7 +104,7 @@ void ramdisk_device_init (void) {
|
|||||||
|
|
||||||
struct limine_module_response* module = limine_module_request.response;
|
struct limine_module_response* module = limine_module_request.response;
|
||||||
|
|
||||||
const char* ramdisk_path = "/boot/mop3dist.tar";
|
const char* ramdisk_path = "/boot/mop3dist.tar.lz4";
|
||||||
struct limine_file* file = NULL;
|
struct limine_file* file = NULL;
|
||||||
|
|
||||||
for (size_t i = 0; i < module->module_count; i++) {
|
for (size_t i = 0; i < module->module_count; i++) {
|
||||||
@@ -112,12 +114,26 @@ void ramdisk_device_init (void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t unpack_buffer_size = 1024 * 1024 * 20;
|
||||||
|
uint8_t* unpack_buffer = malloc (unpack_buffer_size);
|
||||||
|
|
||||||
|
LZ4F_decompressionContext_t dctx;
|
||||||
|
|
||||||
|
LZ4F_createDecompressionContext (&dctx, LZ4F_VERSION);
|
||||||
|
|
||||||
|
size_t consumed = file->size;
|
||||||
|
size_t produced = unpack_buffer_size;
|
||||||
|
|
||||||
|
LZ4F_decompress (dctx, unpack_buffer, &produced, file->address, &consumed, NULL);
|
||||||
|
|
||||||
struct ramdrv_init init = {
|
struct ramdrv_init init = {
|
||||||
.total_size = file->size,
|
.total_size = produced,
|
||||||
.sector_size = 512,
|
.sector_size = 512,
|
||||||
.buffer = file->address,
|
.buffer = unpack_buffer,
|
||||||
};
|
};
|
||||||
device_create ("RD", ops, lengthof (ops), &ramdrv_init, &ramdrv_fini, &init);
|
device_create ("RD", ops, lengthof (ops), &ramdrv_init, &ramdrv_fini, &init);
|
||||||
|
|
||||||
|
LZ4F_freeDecompressionContext (dctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void temp_device_init (void) {
|
void temp_device_init (void) {
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ cflags += -isystem . -isystem ../include
|
|||||||
|
|
||||||
cflags += -DPRINTF_INCLUDE_CONFIG_H=1 \
|
cflags += -DPRINTF_INCLUDE_CONFIG_H=1 \
|
||||||
-D_ALLOC_SKIP_DEFINE \
|
-D_ALLOC_SKIP_DEFINE \
|
||||||
-D"FAT_PRINTF(a)"
|
-D"FAT_PRINTF(a)" \
|
||||||
|
-DXXH_NAMESPACE=LZ4_
|
||||||
|
|
||||||
ifeq ($(buildtype),debug)
|
ifeq ($(buildtype),debug)
|
||||||
cflags += -O0 -g
|
cflags += -O0 -g
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef _KERNEL_LIBK_ASSERT_H
|
#ifndef _KERNEL_LIBK_ASSERT_H
|
||||||
#define _KERNEL_LIBK_ASSERT_H
|
#define _KERNEL_LIBK_ASSERT_H
|
||||||
|
|
||||||
|
#include <sys/debug.h>
|
||||||
#include <sys/spin.h>
|
#include <sys/spin.h>
|
||||||
|
|
||||||
#define assert(x) \
|
#define assert(x) \
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ size_t memset (void* dst, uint8_t b, size_t n) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t memcpy (void* dst, const void* src, size_t n) {
|
void* memcpy (void* dst, const void* src, size_t n) {
|
||||||
uint8_t* dst1 = dst;
|
uint8_t* dst1 = dst;
|
||||||
const uint8_t* src1 = src;
|
const uint8_t* src1 = src;
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
dst1[i] = src1[i];
|
dst1[i] = src1[i];
|
||||||
return i;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SOURCE: https://stackoverflow.com/a/48967408
|
// SOURCE: https://stackoverflow.com/a/48967408
|
||||||
@@ -92,3 +92,24 @@ char* strncat (char* dest, const char* src, size_t n) {
|
|||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* memmove (void* dest, const void* src, unsigned int n) {
|
||||||
|
unsigned char isCopyRequire = 0; // flag bit
|
||||||
|
char* pcSource = (char*)src;
|
||||||
|
char* pcDstn = (char*)dest;
|
||||||
|
// return if pcDstn and pcSource is NULL
|
||||||
|
if ((pcSource == NULL) || (pcDstn == NULL)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
// overlap buffer
|
||||||
|
if ((pcSource < pcDstn) && (pcDstn < pcSource + n)) {
|
||||||
|
for (pcDstn += n, pcSource += n; n--;) {
|
||||||
|
*--pcDstn = *--pcSource;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (n--) {
|
||||||
|
*pcDstn++ = *pcSource++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,14 +4,23 @@
|
|||||||
#include <libk/std.h>
|
#include <libk/std.h>
|
||||||
|
|
||||||
size_t memset (void* dst, uint8_t b, size_t n);
|
size_t memset (void* dst, uint8_t b, size_t n);
|
||||||
size_t memcpy (void* dst, const void* src, size_t n);
|
|
||||||
|
void* memcpy (void* dst, const void* src, size_t n);
|
||||||
|
|
||||||
void strncpy (char* dst, const char* src, size_t n);
|
void strncpy (char* dst, const char* src, size_t n);
|
||||||
|
|
||||||
size_t strlen (const char* str);
|
size_t strlen (const char* str);
|
||||||
|
|
||||||
int memcmp (const void* s1, const void* s2, size_t n);
|
int memcmp (const void* s1, const void* s2, size_t n);
|
||||||
|
|
||||||
int strncmp (const char* s1, const char* s2, size_t n);
|
int strncmp (const char* s1, const char* s2, size_t n);
|
||||||
|
|
||||||
int strcmp (const char* s1, const char* s2);
|
int strcmp (const char* s1, const char* s2);
|
||||||
|
|
||||||
char* strncat (char* dest, const char* src, size_t n);
|
char* strncat (char* dest, const char* src, size_t n);
|
||||||
|
|
||||||
|
void* memmove (void* dest, const void* src, unsigned int n);
|
||||||
|
|
||||||
#define strlen_null(x) (strlen ((x)) + 1)
|
#define strlen_null(x) (strlen ((x)) + 1)
|
||||||
|
|
||||||
#endif // _KERNEL_LIBK_STRING_H
|
#endif // _KERNEL_LIBK_STRING_H
|
||||||
|
|||||||
1
kernel/lz4/.gitignore
vendored
Normal file
1
kernel/lz4/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.o
|
||||||
2827
kernel/lz4/lz4.c
Normal file
2827
kernel/lz4/lz4.c
Normal file
File diff suppressed because it is too large
Load Diff
886
kernel/lz4/lz4.h
Normal file
886
kernel/lz4/lz4.h
Normal file
@@ -0,0 +1,886 @@
|
|||||||
|
/*
|
||||||
|
* LZ4 - Fast LZ compression algorithm
|
||||||
|
* Header File
|
||||||
|
* Copyright (c) Yann Collet. All rights reserved.
|
||||||
|
|
||||||
|
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||||
|
|
||||||
|
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
|
||||||
|
OWNER 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 :
|
||||||
|
- LZ4 homepage : http://www.lz4.org
|
||||||
|
- LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
*/
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LZ4_H_2983827168210
|
||||||
|
#define LZ4_H_2983827168210
|
||||||
|
|
||||||
|
/* --- Dependency --- */
|
||||||
|
#include <stddef.h> /* size_t */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Introduction
|
||||||
|
|
||||||
|
LZ4 is lossless compression algorithm, providing compression speed >500 MB/s per core,
|
||||||
|
scalable with multi-cores CPU. It features an extremely fast decoder, with speed in
|
||||||
|
multiple GB/s per core, typically reaching RAM speed limits on multi-core systems.
|
||||||
|
|
||||||
|
The LZ4 compression library provides in-memory compression and decompression functions.
|
||||||
|
It gives full buffer control to user.
|
||||||
|
Compression can be done in:
|
||||||
|
- a single step (described as Simple Functions)
|
||||||
|
- a single step, reusing a context (described in Advanced Functions)
|
||||||
|
- unbounded multiple steps (described as Streaming compression)
|
||||||
|
|
||||||
|
lz4.h generates and decodes LZ4-compressed blocks (doc/lz4_Block_format.md).
|
||||||
|
Decompressing such a compressed block requires additional metadata.
|
||||||
|
Exact metadata depends on exact decompression function.
|
||||||
|
For the typical case of LZ4_decompress_safe(),
|
||||||
|
metadata includes block's compressed size, and maximum bound of decompressed size.
|
||||||
|
Each application is free to encode and pass such metadata in whichever way it wants.
|
||||||
|
|
||||||
|
lz4.h only handle blocks, it can not generate Frames.
|
||||||
|
|
||||||
|
Blocks are different from Frames (doc/lz4_Frame_format.md).
|
||||||
|
Frames bundle both blocks and metadata in a specified manner.
|
||||||
|
Embedding metadata is required for compressed data to be self-contained and portable.
|
||||||
|
Frame format is delivered through a companion API, declared in lz4frame.h.
|
||||||
|
The `lz4` CLI can only manage frames.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*^***************************************************************
|
||||||
|
* Export parameters
|
||||||
|
*****************************************************************/
|
||||||
|
/*
|
||||||
|
* LZ4_DLL_EXPORT :
|
||||||
|
* Enable exporting of functions when building a Windows DLL
|
||||||
|
* LZ4LIB_VISIBILITY :
|
||||||
|
* Control library symbols visibility.
|
||||||
|
*/
|
||||||
|
#ifndef LZ4LIB_VISIBILITY
|
||||||
|
# if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||||
|
# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default")))
|
||||||
|
# else
|
||||||
|
# define LZ4LIB_VISIBILITY
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
|
||||||
|
# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
|
||||||
|
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
|
||||||
|
# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
|
||||||
|
#else
|
||||||
|
# define LZ4LIB_API LZ4LIB_VISIBILITY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! LZ4_FREESTANDING :
|
||||||
|
* When this macro is set to 1, it enables "freestanding mode" that is
|
||||||
|
* suitable for typical freestanding environment which doesn't support
|
||||||
|
* standard C library.
|
||||||
|
*
|
||||||
|
* - LZ4_FREESTANDING is a compile-time switch.
|
||||||
|
* - It requires the following macros to be defined:
|
||||||
|
* LZ4_memcpy, LZ4_memmove, LZ4_memset.
|
||||||
|
* - It only enables LZ4/HC functions which don't use heap.
|
||||||
|
* All LZ4F_* functions are not supported.
|
||||||
|
* - See tests/freestanding.c to check its basic setup.
|
||||||
|
*/
|
||||||
|
#if defined(LZ4_FREESTANDING) && (LZ4_FREESTANDING == 1)
|
||||||
|
# define LZ4_HEAPMODE 0
|
||||||
|
# define LZ4HC_HEAPMODE 0
|
||||||
|
# define LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 1
|
||||||
|
# if !defined(LZ4_memcpy)
|
||||||
|
# error "LZ4_FREESTANDING requires macro 'LZ4_memcpy'."
|
||||||
|
# endif
|
||||||
|
# if !defined(LZ4_memset)
|
||||||
|
# error "LZ4_FREESTANDING requires macro 'LZ4_memset'."
|
||||||
|
# endif
|
||||||
|
# if !defined(LZ4_memmove)
|
||||||
|
# error "LZ4_FREESTANDING requires macro 'LZ4_memmove'."
|
||||||
|
# endif
|
||||||
|
#elif ! defined(LZ4_FREESTANDING)
|
||||||
|
# define LZ4_FREESTANDING 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*------ Version ------*/
|
||||||
|
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
||||||
|
#define LZ4_VERSION_MINOR 10 /* for new (non-breaking) interface capabilities */
|
||||||
|
#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */
|
||||||
|
|
||||||
|
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
|
||||||
|
|
||||||
|
#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
|
||||||
|
#define LZ4_QUOTE(str) #str
|
||||||
|
#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
|
||||||
|
#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION) /* requires v1.7.3+ */
|
||||||
|
|
||||||
|
LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version; requires v1.3.0+ */
|
||||||
|
LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; useful to check dll version; requires v1.7.5+ */
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Tuning memory usage
|
||||||
|
**************************************/
|
||||||
|
/*!
|
||||||
|
* LZ4_MEMORY_USAGE :
|
||||||
|
* Can be selected at compile time, by setting LZ4_MEMORY_USAGE.
|
||||||
|
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB)
|
||||||
|
* Increasing memory usage improves compression ratio, generally at the cost of speed.
|
||||||
|
* Reduced memory usage may improve speed at the cost of ratio, thanks to better cache locality.
|
||||||
|
* Default value is 14, for 16KB, which nicely fits into most L1 caches.
|
||||||
|
*/
|
||||||
|
#ifndef LZ4_MEMORY_USAGE
|
||||||
|
# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These are absolute limits, they should not be changed by users */
|
||||||
|
#define LZ4_MEMORY_USAGE_MIN 10
|
||||||
|
#define LZ4_MEMORY_USAGE_DEFAULT 14
|
||||||
|
#define LZ4_MEMORY_USAGE_MAX 20
|
||||||
|
|
||||||
|
#if (LZ4_MEMORY_USAGE < LZ4_MEMORY_USAGE_MIN)
|
||||||
|
# error "LZ4_MEMORY_USAGE is too small !"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (LZ4_MEMORY_USAGE > LZ4_MEMORY_USAGE_MAX)
|
||||||
|
# error "LZ4_MEMORY_USAGE is too large !"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Simple Functions
|
||||||
|
**************************************/
|
||||||
|
/*! LZ4_compress_default() :
|
||||||
|
* Compresses 'srcSize' bytes from buffer 'src'
|
||||||
|
* into already allocated 'dst' buffer of size 'dstCapacity'.
|
||||||
|
* Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize).
|
||||||
|
* It also runs faster, so it's a recommended setting.
|
||||||
|
* If the function cannot compress 'src' into a more limited 'dst' budget,
|
||||||
|
* compression stops *immediately*, and the function result is zero.
|
||||||
|
* In which case, 'dst' content is undefined (invalid).
|
||||||
|
* srcSize : max supported value is LZ4_MAX_INPUT_SIZE.
|
||||||
|
* dstCapacity : size of buffer 'dst' (which must be already allocated)
|
||||||
|
* @return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity)
|
||||||
|
* or 0 if compression fails
|
||||||
|
* Note : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer).
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity);
|
||||||
|
|
||||||
|
/*! LZ4_decompress_safe() :
|
||||||
|
* @compressedSize : is the exact complete size of the compressed block.
|
||||||
|
* @dstCapacity : is the size of destination buffer (which must be already allocated),
|
||||||
|
* presumed an upper bound of decompressed size.
|
||||||
|
* @return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity)
|
||||||
|
* If destination buffer is not large enough, decoding will stop and output an error code (negative value).
|
||||||
|
* If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||||
|
* Note 1 : This function is protected against malicious data packets :
|
||||||
|
* it will never writes outside 'dst' buffer, nor read outside 'source' buffer,
|
||||||
|
* even if the compressed block is maliciously modified to order the decoder to do these actions.
|
||||||
|
* In such case, the decoder stops immediately, and considers the compressed block malformed.
|
||||||
|
* Note 2 : compressedSize and dstCapacity must be provided to the function, the compressed block does not contain them.
|
||||||
|
* The implementation is free to send / store / derive this information in whichever way is most beneficial.
|
||||||
|
* If there is a need for a different format which bundles together both compressed data and its metadata, consider looking at lz4frame.h instead.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity);
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Advanced Functions
|
||||||
|
**************************************/
|
||||||
|
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
|
||||||
|
#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
|
||||||
|
|
||||||
|
/*! LZ4_compressBound() :
|
||||||
|
Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)
|
||||||
|
This function is primarily useful for memory allocation purposes (destination buffer size).
|
||||||
|
Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).
|
||||||
|
Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize)
|
||||||
|
inputSize : max supported value is LZ4_MAX_INPUT_SIZE
|
||||||
|
return : maximum output size in a "worst case" scenario
|
||||||
|
or 0, if input size is incorrect (too large or negative)
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compressBound(int inputSize);
|
||||||
|
|
||||||
|
/*! LZ4_compress_fast() :
|
||||||
|
Same as LZ4_compress_default(), but allows selection of "acceleration" factor.
|
||||||
|
The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
|
||||||
|
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
|
||||||
|
An acceleration value of "1" is the same as regular LZ4_compress_default()
|
||||||
|
Values <= 0 will be replaced by LZ4_ACCELERATION_DEFAULT (currently == 1, see lz4.c).
|
||||||
|
Values > LZ4_ACCELERATION_MAX will be replaced by LZ4_ACCELERATION_MAX (currently == 65537, see lz4.c).
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_compress_fast_extState() :
|
||||||
|
* Same as LZ4_compress_fast(), using an externally allocated memory space for its state.
|
||||||
|
* Use LZ4_sizeofState() to know how much memory must be allocated,
|
||||||
|
* and allocate it on 8-bytes boundaries (using `malloc()` typically).
|
||||||
|
* Then, provide this buffer as `void* state` to compression function.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_sizeofState(void);
|
||||||
|
LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
|
||||||
|
|
||||||
|
/*! LZ4_compress_destSize() :
|
||||||
|
* Reverse the logic : compresses as much data as possible from 'src' buffer
|
||||||
|
* into already allocated buffer 'dst', of size >= 'dstCapacity'.
|
||||||
|
* This function either compresses the entire 'src' content into 'dst' if it's large enough,
|
||||||
|
* or fill 'dst' buffer completely with as much data as possible from 'src'.
|
||||||
|
* note: acceleration parameter is fixed to "default".
|
||||||
|
*
|
||||||
|
* *srcSizePtr : in+out parameter. Initially contains size of input.
|
||||||
|
* Will be modified to indicate how many bytes where read from 'src' to fill 'dst'.
|
||||||
|
* New value is necessarily <= input value.
|
||||||
|
* @return : Nb bytes written into 'dst' (necessarily <= dstCapacity)
|
||||||
|
* or 0 if compression fails.
|
||||||
|
*
|
||||||
|
* Note : 'targetDstSize' must be >= 1, because it's the smallest valid lz4 payload.
|
||||||
|
*
|
||||||
|
* Note 2:from v1.8.2 to v1.9.1, this function had a bug (fixed in v1.9.2+):
|
||||||
|
* the produced compressed content could, in rare circumstances,
|
||||||
|
* require to be decompressed into a destination buffer
|
||||||
|
* larger by at least 1 byte than decompressesSize.
|
||||||
|
* If an application uses `LZ4_compress_destSize()`,
|
||||||
|
* it's highly recommended to update liblz4 to v1.9.2 or better.
|
||||||
|
* If this can't be done or ensured,
|
||||||
|
* the receiving decompression function should provide
|
||||||
|
* a dstCapacity which is > decompressedSize, by at least 1 byte.
|
||||||
|
* See https://github.com/lz4/lz4/issues/859 for details
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targetDstSize);
|
||||||
|
|
||||||
|
/*! LZ4_decompress_safe_partial() :
|
||||||
|
* Decompress an LZ4 compressed block, of size 'srcSize' at position 'src',
|
||||||
|
* into destination buffer 'dst' of size 'dstCapacity'.
|
||||||
|
* Up to 'targetOutputSize' bytes will be decoded.
|
||||||
|
* The function stops decoding on reaching this objective.
|
||||||
|
* This can be useful to boost performance
|
||||||
|
* whenever only the beginning of a block is required.
|
||||||
|
*
|
||||||
|
* @return : the number of bytes decoded in `dst` (necessarily <= targetOutputSize)
|
||||||
|
* If source stream is detected malformed, function returns a negative result.
|
||||||
|
*
|
||||||
|
* Note 1 : @return can be < targetOutputSize, if compressed block contains less data.
|
||||||
|
*
|
||||||
|
* Note 2 : targetOutputSize must be <= dstCapacity
|
||||||
|
*
|
||||||
|
* Note 3 : this function effectively stops decoding on reaching targetOutputSize,
|
||||||
|
* so dstCapacity is kind of redundant.
|
||||||
|
* This is because in older versions of this function,
|
||||||
|
* decoding operation would still write complete sequences.
|
||||||
|
* Therefore, there was no guarantee that it would stop writing at exactly targetOutputSize,
|
||||||
|
* it could write more bytes, though only up to dstCapacity.
|
||||||
|
* Some "margin" used to be required for this operation to work properly.
|
||||||
|
* Thankfully, this is no longer necessary.
|
||||||
|
* The function nonetheless keeps the same signature, in an effort to preserve API compatibility.
|
||||||
|
*
|
||||||
|
* Note 4 : If srcSize is the exact size of the block,
|
||||||
|
* then targetOutputSize can be any value,
|
||||||
|
* including larger than the block's decompressed size.
|
||||||
|
* The function will, at most, generate block's decompressed size.
|
||||||
|
*
|
||||||
|
* Note 5 : If srcSize is _larger_ than block's compressed size,
|
||||||
|
* then targetOutputSize **MUST** be <= block's decompressed size.
|
||||||
|
* Otherwise, *silent corruption will occur*.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity);
|
||||||
|
|
||||||
|
|
||||||
|
/*-*********************************************
|
||||||
|
* Streaming Compression Functions
|
||||||
|
***********************************************/
|
||||||
|
typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Note about RC_INVOKED
|
||||||
|
|
||||||
|
- RC_INVOKED is predefined symbol of rc.exe (the resource compiler which is part of MSVC/Visual Studio).
|
||||||
|
https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros
|
||||||
|
|
||||||
|
- Since rc.exe is a legacy compiler, it truncates long symbol (> 30 chars)
|
||||||
|
and reports warning "RC4011: identifier truncated".
|
||||||
|
|
||||||
|
- To eliminate the warning, we surround long preprocessor symbol with
|
||||||
|
"#if !defined(RC_INVOKED) ... #endif" block that means
|
||||||
|
"skip this block when rc.exe is trying to read it".
|
||||||
|
*/
|
||||||
|
#if !defined(RC_INVOKED) /* https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros */
|
||||||
|
#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
|
||||||
|
LZ4LIB_API LZ4_stream_t* LZ4_createStream(void);
|
||||||
|
LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);
|
||||||
|
#endif /* !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! LZ4_resetStream_fast() : v1.9.0+
|
||||||
|
* Use this to prepare an LZ4_stream_t for a new chain of dependent blocks
|
||||||
|
* (e.g., LZ4_compress_fast_continue()).
|
||||||
|
*
|
||||||
|
* An LZ4_stream_t must be initialized once before usage.
|
||||||
|
* This is automatically done when created by LZ4_createStream().
|
||||||
|
* However, should the LZ4_stream_t be simply declared on stack (for example),
|
||||||
|
* it's necessary to initialize it first, using LZ4_initStream().
|
||||||
|
*
|
||||||
|
* After init, start any new stream with LZ4_resetStream_fast().
|
||||||
|
* A same LZ4_stream_t can be re-used multiple times consecutively
|
||||||
|
* and compress multiple streams,
|
||||||
|
* provided that it starts each new stream with LZ4_resetStream_fast().
|
||||||
|
*
|
||||||
|
* LZ4_resetStream_fast() is much faster than LZ4_initStream(),
|
||||||
|
* but is not compatible with memory regions containing garbage data.
|
||||||
|
*
|
||||||
|
* Note: it's only useful to call LZ4_resetStream_fast()
|
||||||
|
* in the context of streaming compression.
|
||||||
|
* The *extState* functions perform their own resets.
|
||||||
|
* Invoking LZ4_resetStream_fast() before is redundant, and even counterproductive.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
|
||||||
|
|
||||||
|
/*! LZ4_loadDict() :
|
||||||
|
* Use this function to reference a static dictionary into LZ4_stream_t.
|
||||||
|
* The dictionary must remain available during compression.
|
||||||
|
* LZ4_loadDict() triggers a reset, so any previous data will be forgotten.
|
||||||
|
* The same dictionary will have to be loaded on decompression side for successful decoding.
|
||||||
|
* Dictionary are useful for better compression of small data (KB range).
|
||||||
|
* While LZ4 itself accepts any input as dictionary, dictionary efficiency is also a topic.
|
||||||
|
* When in doubt, employ the Zstandard's Dictionary Builder.
|
||||||
|
* Loading a size of 0 is allowed, and is the same as reset.
|
||||||
|
* @return : loaded dictionary size, in bytes (note: only the last 64 KB are loaded)
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
|
||||||
|
|
||||||
|
/*! LZ4_loadDictSlow() : v1.10.0+
|
||||||
|
* Same as LZ4_loadDict(),
|
||||||
|
* but uses a bit more cpu to reference the dictionary content more thoroughly.
|
||||||
|
* This is expected to slightly improve compression ratio.
|
||||||
|
* The extra-cpu cost is likely worth it if the dictionary is re-used across multiple sessions.
|
||||||
|
* @return : loaded dictionary size, in bytes (note: only the last 64 KB are loaded)
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_loadDictSlow(LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
|
||||||
|
|
||||||
|
/*! LZ4_attach_dictionary() : stable since v1.10.0
|
||||||
|
*
|
||||||
|
* This allows efficient re-use of a static dictionary multiple times.
|
||||||
|
*
|
||||||
|
* Rather than re-loading the dictionary buffer into a working context before
|
||||||
|
* each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a
|
||||||
|
* working LZ4_stream_t, this function introduces a no-copy setup mechanism,
|
||||||
|
* in which the working stream references @dictionaryStream in-place.
|
||||||
|
*
|
||||||
|
* Several assumptions are made about the state of @dictionaryStream.
|
||||||
|
* Currently, only states which have been prepared by LZ4_loadDict() or
|
||||||
|
* LZ4_loadDictSlow() should be expected to work.
|
||||||
|
*
|
||||||
|
* Alternatively, the provided @dictionaryStream may be NULL,
|
||||||
|
* in which case any existing dictionary stream is unset.
|
||||||
|
*
|
||||||
|
* If a dictionary is provided, it replaces any pre-existing stream history.
|
||||||
|
* The dictionary contents are the only history that can be referenced and
|
||||||
|
* logically immediately precede the data compressed in the first subsequent
|
||||||
|
* compression call.
|
||||||
|
*
|
||||||
|
* The dictionary will only remain attached to the working stream through the
|
||||||
|
* first compression call, at the end of which it is cleared.
|
||||||
|
* @dictionaryStream stream (and source buffer) must remain in-place / accessible / unchanged
|
||||||
|
* through the completion of the compression session.
|
||||||
|
*
|
||||||
|
* Note: there is no equivalent LZ4_attach_*() method on the decompression side
|
||||||
|
* because there is no initialization cost, hence no need to share the cost across multiple sessions.
|
||||||
|
* To decompress LZ4 blocks using dictionary, attached or not,
|
||||||
|
* just employ the regular LZ4_setStreamDecode() for streaming,
|
||||||
|
* or the stateless LZ4_decompress_safe_usingDict() for one-shot decompression.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API void
|
||||||
|
LZ4_attach_dictionary(LZ4_stream_t* workingStream,
|
||||||
|
const LZ4_stream_t* dictionaryStream);
|
||||||
|
|
||||||
|
/*! LZ4_compress_fast_continue() :
|
||||||
|
* Compress 'src' content using data from previously compressed blocks, for better compression ratio.
|
||||||
|
* 'dst' buffer must be already allocated.
|
||||||
|
* If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
|
||||||
|
*
|
||||||
|
* @return : size of compressed block
|
||||||
|
* or 0 if there is an error (typically, cannot fit into 'dst').
|
||||||
|
*
|
||||||
|
* Note 1 : Each invocation to LZ4_compress_fast_continue() generates a new block.
|
||||||
|
* Each block has precise boundaries.
|
||||||
|
* Each block must be decompressed separately, calling LZ4_decompress_*() with relevant metadata.
|
||||||
|
* It's not possible to append blocks together and expect a single invocation of LZ4_decompress_*() to decompress them together.
|
||||||
|
*
|
||||||
|
* Note 2 : The previous 64KB of source data is __assumed__ to remain present, unmodified, at same address in memory !
|
||||||
|
*
|
||||||
|
* Note 3 : When input is structured as a double-buffer, each buffer can have any size, including < 64 KB.
|
||||||
|
* Make sure that buffers are separated, by at least one byte.
|
||||||
|
* This construction ensures that each block only depends on previous block.
|
||||||
|
*
|
||||||
|
* Note 4 : If input buffer is a ring-buffer, it can have any size, including < 64 KB.
|
||||||
|
*
|
||||||
|
* Note 5 : After an error, the stream status is undefined (invalid), it can only be reset or freed.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
|
||||||
|
|
||||||
|
/*! LZ4_saveDict() :
|
||||||
|
* If last 64KB data cannot be guaranteed to remain available at its current memory location,
|
||||||
|
* save it into a safer place (char* safeBuffer).
|
||||||
|
* This is schematically equivalent to a memcpy() followed by LZ4_loadDict(),
|
||||||
|
* but is much faster, because LZ4_saveDict() doesn't need to rebuild tables.
|
||||||
|
* @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize);
|
||||||
|
|
||||||
|
|
||||||
|
/*-**********************************************
|
||||||
|
* Streaming Decompression Functions
|
||||||
|
* Bufferless synchronous API
|
||||||
|
************************************************/
|
||||||
|
typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* tracking context */
|
||||||
|
|
||||||
|
/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :
|
||||||
|
* creation / destruction of streaming decompression tracking context.
|
||||||
|
* A tracking context can be re-used multiple times.
|
||||||
|
*/
|
||||||
|
#if !defined(RC_INVOKED) /* https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros */
|
||||||
|
#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
|
||||||
|
LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
|
||||||
|
LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
|
||||||
|
#endif /* !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! LZ4_setStreamDecode() :
|
||||||
|
* An LZ4_streamDecode_t context can be allocated once and re-used multiple times.
|
||||||
|
* Use this function to start decompression of a new stream of blocks.
|
||||||
|
* A dictionary can optionally be set. Use NULL or size 0 for a reset order.
|
||||||
|
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
|
||||||
|
* @return : 1 if OK, 0 if error
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
|
||||||
|
|
||||||
|
/*! LZ4_decoderRingBufferSize() : v1.8.2+
|
||||||
|
* Note : in a ring buffer scenario (optional),
|
||||||
|
* blocks are presumed decompressed next to each other
|
||||||
|
* up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize),
|
||||||
|
* at which stage it resumes from beginning of ring buffer.
|
||||||
|
* When setting such a ring buffer for streaming decompression,
|
||||||
|
* provides the minimum size of this ring buffer
|
||||||
|
* to be compatible with any source respecting maxBlockSize condition.
|
||||||
|
* @return : minimum ring buffer size,
|
||||||
|
* or 0 if there is an error (invalid maxBlockSize).
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize);
|
||||||
|
#define LZ4_DECODER_RING_BUFFER_SIZE(maxBlockSize) (65536 + 14 + (maxBlockSize)) /* for static allocation; maxBlockSize presumed valid */
|
||||||
|
|
||||||
|
/*! LZ4_decompress_safe_continue() :
|
||||||
|
* This decoding function allows decompression of consecutive blocks in "streaming" mode.
|
||||||
|
* The difference with the usual independent blocks is that
|
||||||
|
* new blocks are allowed to find references into former blocks.
|
||||||
|
* A block is an unsplittable entity, and must be presented entirely to the decompression function.
|
||||||
|
* LZ4_decompress_safe_continue() only accepts one block at a time.
|
||||||
|
* It's modeled after `LZ4_decompress_safe()` and behaves similarly.
|
||||||
|
*
|
||||||
|
* @LZ4_streamDecode : decompression state, tracking the position in memory of past data
|
||||||
|
* @compressedSize : exact complete size of one compressed block.
|
||||||
|
* @dstCapacity : size of destination buffer (which must be already allocated),
|
||||||
|
* must be an upper bound of decompressed size.
|
||||||
|
* @return : number of bytes decompressed into destination buffer (necessarily <= dstCapacity)
|
||||||
|
* If destination buffer is not large enough, decoding will stop and output an error code (negative value).
|
||||||
|
* If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||||
|
*
|
||||||
|
* The last 64KB of previously decoded data *must* remain available and unmodified
|
||||||
|
* at the memory position where they were previously decoded.
|
||||||
|
* If less than 64KB of data has been decoded, all the data must be present.
|
||||||
|
*
|
||||||
|
* Special : if decompression side sets a ring buffer, it must respect one of the following conditions :
|
||||||
|
* - Decompression buffer size is _at least_ LZ4_decoderRingBufferSize(maxBlockSize).
|
||||||
|
* maxBlockSize is the maximum size of any single block. It can have any value > 16 bytes.
|
||||||
|
* In which case, encoding and decoding buffers do not need to be synchronized.
|
||||||
|
* Actually, data can be produced by any source compliant with LZ4 format specification, and respecting maxBlockSize.
|
||||||
|
* - Synchronized mode :
|
||||||
|
* Decompression buffer size is _exactly_ the same as compression buffer size,
|
||||||
|
* and follows exactly same update rule (block boundaries at same positions),
|
||||||
|
* and decoding function is provided with exact decompressed size of each block (exception for last block of the stream),
|
||||||
|
* _then_ decoding & encoding ring buffer can have any size, including small ones ( < 64 KB).
|
||||||
|
* - Decompression buffer is larger than encoding buffer, by a minimum of maxBlockSize more bytes.
|
||||||
|
* In which case, encoding and decoding buffers do not need to be synchronized,
|
||||||
|
* and encoding ring buffer can have any size, including small ones ( < 64 KB).
|
||||||
|
*
|
||||||
|
* Whenever these conditions are not possible,
|
||||||
|
* save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression,
|
||||||
|
* then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int
|
||||||
|
LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode,
|
||||||
|
const char* src, char* dst,
|
||||||
|
int srcSize, int dstCapacity);
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_decompress_safe_usingDict() :
|
||||||
|
* Works the same as
|
||||||
|
* a combination of LZ4_setStreamDecode() followed by LZ4_decompress_safe_continue()
|
||||||
|
* However, it's stateless: it doesn't need any LZ4_streamDecode_t state.
|
||||||
|
* Dictionary is presumed stable : it must remain accessible and unmodified during decompression.
|
||||||
|
* Performance tip : Decompression speed can be substantially increased
|
||||||
|
* when dst == dictStart + dictSize.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int
|
||||||
|
LZ4_decompress_safe_usingDict(const char* src, char* dst,
|
||||||
|
int srcSize, int dstCapacity,
|
||||||
|
const char* dictStart, int dictSize);
|
||||||
|
|
||||||
|
/*! LZ4_decompress_safe_partial_usingDict() :
|
||||||
|
* Behaves the same as LZ4_decompress_safe_partial()
|
||||||
|
* with the added ability to specify a memory segment for past data.
|
||||||
|
* Performance tip : Decompression speed can be substantially increased
|
||||||
|
* when dst == dictStart + dictSize.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int
|
||||||
|
LZ4_decompress_safe_partial_usingDict(const char* src, char* dst,
|
||||||
|
int compressedSize,
|
||||||
|
int targetOutputSize, int maxOutputSize,
|
||||||
|
const char* dictStart, int dictSize);
|
||||||
|
|
||||||
|
#endif /* LZ4_H_2983827168210 */
|
||||||
|
|
||||||
|
|
||||||
|
/*^*************************************
|
||||||
|
* !!!!!! STATIC LINKING ONLY !!!!!!
|
||||||
|
***************************************/
|
||||||
|
|
||||||
|
/*-****************************************************************************
|
||||||
|
* Experimental section
|
||||||
|
*
|
||||||
|
* Symbols declared in this section must be considered unstable. Their
|
||||||
|
* signatures or semantics may change, or they may be removed altogether in the
|
||||||
|
* future. They are therefore only safe to depend on when the caller is
|
||||||
|
* statically linked against the library.
|
||||||
|
*
|
||||||
|
* To protect against unsafe usage, not only are the declarations guarded,
|
||||||
|
* the definitions are hidden by default
|
||||||
|
* when building LZ4 as a shared/dynamic library.
|
||||||
|
*
|
||||||
|
* In order to access these declarations,
|
||||||
|
* define LZ4_STATIC_LINKING_ONLY in your application
|
||||||
|
* before including LZ4's headers.
|
||||||
|
*
|
||||||
|
* In order to make their implementations accessible dynamically, you must
|
||||||
|
* define LZ4_PUBLISH_STATIC_FUNCTIONS when building the LZ4 library.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifdef LZ4_STATIC_LINKING_ONLY
|
||||||
|
|
||||||
|
#ifndef LZ4_STATIC_3504398509
|
||||||
|
#define LZ4_STATIC_3504398509
|
||||||
|
|
||||||
|
#ifdef LZ4_PUBLISH_STATIC_FUNCTIONS
|
||||||
|
# define LZ4LIB_STATIC_API LZ4LIB_API
|
||||||
|
#else
|
||||||
|
# define LZ4LIB_STATIC_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_compress_fast_extState_fastReset() :
|
||||||
|
* A variant of LZ4_compress_fast_extState().
|
||||||
|
*
|
||||||
|
* Using this variant avoids an expensive initialization step.
|
||||||
|
* It is only safe to call if the state buffer is known to be correctly initialized already
|
||||||
|
* (see above comment on LZ4_resetStream_fast() for a definition of "correctly initialized").
|
||||||
|
* From a high level, the difference is that
|
||||||
|
* this function initializes the provided state with a call to something like LZ4_resetStream_fast()
|
||||||
|
* while LZ4_compress_fast_extState() starts with a call to LZ4_resetStream().
|
||||||
|
*/
|
||||||
|
LZ4LIB_STATIC_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
|
||||||
|
|
||||||
|
/*! LZ4_compress_destSize_extState() : introduced in v1.10.0
|
||||||
|
* Same as LZ4_compress_destSize(), but using an externally allocated state.
|
||||||
|
* Also: exposes @acceleration
|
||||||
|
*/
|
||||||
|
int LZ4_compress_destSize_extState(void* state, const char* src, char* dst, int* srcSizePtr, int targetDstSize, int acceleration);
|
||||||
|
|
||||||
|
/*! In-place compression and decompression
|
||||||
|
*
|
||||||
|
* It's possible to have input and output sharing the same buffer,
|
||||||
|
* for highly constrained memory environments.
|
||||||
|
* In both cases, it requires input to lay at the end of the buffer,
|
||||||
|
* and decompression to start at beginning of the buffer.
|
||||||
|
* Buffer size must feature some margin, hence be larger than final size.
|
||||||
|
*
|
||||||
|
* |<------------------------buffer--------------------------------->|
|
||||||
|
* |<-----------compressed data--------->|
|
||||||
|
* |<-----------decompressed size------------------>|
|
||||||
|
* |<----margin---->|
|
||||||
|
*
|
||||||
|
* This technique is more useful for decompression,
|
||||||
|
* since decompressed size is typically larger,
|
||||||
|
* and margin is short.
|
||||||
|
*
|
||||||
|
* In-place decompression will work inside any buffer
|
||||||
|
* which size is >= LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize).
|
||||||
|
* This presumes that decompressedSize > compressedSize.
|
||||||
|
* Otherwise, it means compression actually expanded data,
|
||||||
|
* and it would be more efficient to store such data with a flag indicating it's not compressed.
|
||||||
|
* This can happen when data is not compressible (already compressed, or encrypted).
|
||||||
|
*
|
||||||
|
* For in-place compression, margin is larger, as it must be able to cope with both
|
||||||
|
* history preservation, requiring input data to remain unmodified up to LZ4_DISTANCE_MAX,
|
||||||
|
* and data expansion, which can happen when input is not compressible.
|
||||||
|
* As a consequence, buffer size requirements are much higher,
|
||||||
|
* and memory savings offered by in-place compression are more limited.
|
||||||
|
*
|
||||||
|
* There are ways to limit this cost for compression :
|
||||||
|
* - Reduce history size, by modifying LZ4_DISTANCE_MAX.
|
||||||
|
* Note that it is a compile-time constant, so all compressions will apply this limit.
|
||||||
|
* Lower values will reduce compression ratio, except when input_size < LZ4_DISTANCE_MAX,
|
||||||
|
* so it's a reasonable trick when inputs are known to be small.
|
||||||
|
* - Require the compressor to deliver a "maximum compressed size".
|
||||||
|
* This is the `dstCapacity` parameter in `LZ4_compress*()`.
|
||||||
|
* When this size is < LZ4_COMPRESSBOUND(inputSize), then compression can fail,
|
||||||
|
* in which case, the return code will be 0 (zero).
|
||||||
|
* The caller must be ready for these cases to happen,
|
||||||
|
* and typically design a backup scheme to send data uncompressed.
|
||||||
|
* The combination of both techniques can significantly reduce
|
||||||
|
* the amount of margin required for in-place compression.
|
||||||
|
*
|
||||||
|
* In-place compression can work in any buffer
|
||||||
|
* which size is >= (maxCompressedSize)
|
||||||
|
* with maxCompressedSize == LZ4_COMPRESSBOUND(srcSize) for guaranteed compression success.
|
||||||
|
* LZ4_COMPRESS_INPLACE_BUFFER_SIZE() depends on both maxCompressedSize and LZ4_DISTANCE_MAX,
|
||||||
|
* so it's possible to reduce memory requirements by playing with them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LZ4_DECOMPRESS_INPLACE_MARGIN(compressedSize) (((compressedSize) >> 8) + 32)
|
||||||
|
#define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) ((decompressedSize) + LZ4_DECOMPRESS_INPLACE_MARGIN(decompressedSize)) /**< note: presumes that compressedSize < decompressedSize. note2: margin is overestimated a bit, since it could use compressedSize instead */
|
||||||
|
|
||||||
|
#ifndef LZ4_DISTANCE_MAX /* history window size; can be user-defined at compile time */
|
||||||
|
# define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LZ4_COMPRESS_INPLACE_MARGIN (LZ4_DISTANCE_MAX + 32) /* LZ4_DISTANCE_MAX can be safely replaced by srcSize when it's smaller */
|
||||||
|
#define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) ((maxCompressedSize) + LZ4_COMPRESS_INPLACE_MARGIN) /**< maxCompressedSize is generally LZ4_COMPRESSBOUND(inputSize), but can be set to any lower value, with the risk that compression can fail (return code 0(zero)) */
|
||||||
|
|
||||||
|
#endif /* LZ4_STATIC_3504398509 */
|
||||||
|
#endif /* LZ4_STATIC_LINKING_ONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef LZ4_H_98237428734687
|
||||||
|
#define LZ4_H_98237428734687
|
||||||
|
|
||||||
|
/*-************************************************************
|
||||||
|
* Private Definitions
|
||||||
|
**************************************************************
|
||||||
|
* Do not use these definitions directly.
|
||||||
|
* They are only exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`.
|
||||||
|
* Accessing members will expose user code to API and/or ABI break in future versions of the library.
|
||||||
|
**************************************************************/
|
||||||
|
#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)
|
||||||
|
#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
|
||||||
|
#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */
|
||||||
|
|
||||||
|
#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
||||||
|
# include <stdint.h>
|
||||||
|
typedef int8_t LZ4_i8;
|
||||||
|
typedef unsigned char LZ4_byte;
|
||||||
|
typedef uint16_t LZ4_u16;
|
||||||
|
typedef uint32_t LZ4_u32;
|
||||||
|
#else
|
||||||
|
typedef signed char LZ4_i8;
|
||||||
|
typedef unsigned char LZ4_byte;
|
||||||
|
typedef unsigned short LZ4_u16;
|
||||||
|
typedef unsigned int LZ4_u32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! LZ4_stream_t :
|
||||||
|
* Never ever use below internal definitions directly !
|
||||||
|
* These definitions are not API/ABI safe, and may change in future versions.
|
||||||
|
* If you need static allocation, declare or allocate an LZ4_stream_t object.
|
||||||
|
**/
|
||||||
|
|
||||||
|
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
|
||||||
|
struct LZ4_stream_t_internal {
|
||||||
|
LZ4_u32 hashTable[LZ4_HASH_SIZE_U32];
|
||||||
|
const LZ4_byte* dictionary;
|
||||||
|
const LZ4_stream_t_internal* dictCtx;
|
||||||
|
LZ4_u32 currentOffset;
|
||||||
|
LZ4_u32 tableType;
|
||||||
|
LZ4_u32 dictSize;
|
||||||
|
/* Implicit padding to ensure structure is aligned */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LZ4_STREAM_MINSIZE ((1UL << (LZ4_MEMORY_USAGE)) + 32) /* static size, for inter-version compatibility */
|
||||||
|
union LZ4_stream_u {
|
||||||
|
char minStateSize[LZ4_STREAM_MINSIZE];
|
||||||
|
LZ4_stream_t_internal internal_donotuse;
|
||||||
|
}; /* previously typedef'd to LZ4_stream_t */
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_initStream() : v1.9.0+
|
||||||
|
* An LZ4_stream_t structure must be initialized at least once.
|
||||||
|
* This is automatically done when invoking LZ4_createStream(),
|
||||||
|
* but it's not when the structure is simply declared on stack (for example).
|
||||||
|
*
|
||||||
|
* Use LZ4_initStream() to properly initialize a newly declared LZ4_stream_t.
|
||||||
|
* It can also initialize any arbitrary buffer of sufficient size,
|
||||||
|
* and will @return a pointer of proper type upon initialization.
|
||||||
|
*
|
||||||
|
* Note : initialization fails if size and alignment conditions are not respected.
|
||||||
|
* In which case, the function will @return NULL.
|
||||||
|
* Note2: An LZ4_stream_t structure guarantees correct alignment and size.
|
||||||
|
* Note3: Before v1.9.0, use LZ4_resetStream() instead
|
||||||
|
**/
|
||||||
|
LZ4LIB_API LZ4_stream_t* LZ4_initStream (void* stateBuffer, size_t size);
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_streamDecode_t :
|
||||||
|
* Never ever use below internal definitions directly !
|
||||||
|
* These definitions are not API/ABI safe, and may change in future versions.
|
||||||
|
* If you need static allocation, declare or allocate an LZ4_streamDecode_t object.
|
||||||
|
**/
|
||||||
|
typedef struct {
|
||||||
|
const LZ4_byte* externalDict;
|
||||||
|
const LZ4_byte* prefixEnd;
|
||||||
|
size_t extDictSize;
|
||||||
|
size_t prefixSize;
|
||||||
|
} LZ4_streamDecode_t_internal;
|
||||||
|
|
||||||
|
#define LZ4_STREAMDECODE_MINSIZE 32
|
||||||
|
union LZ4_streamDecode_u {
|
||||||
|
char minStateSize[LZ4_STREAMDECODE_MINSIZE];
|
||||||
|
LZ4_streamDecode_t_internal internal_donotuse;
|
||||||
|
} ; /* previously typedef'd to LZ4_streamDecode_t */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Obsolete Functions
|
||||||
|
**************************************/
|
||||||
|
|
||||||
|
/*! Deprecation warnings
|
||||||
|
*
|
||||||
|
* Deprecated functions make the compiler generate a warning when invoked.
|
||||||
|
* This is meant to invite users to update their source code.
|
||||||
|
* Should deprecation warnings be a problem, it is generally possible to disable them,
|
||||||
|
* typically with -Wno-deprecated-declarations for gcc
|
||||||
|
* or _CRT_SECURE_NO_WARNINGS in Visual.
|
||||||
|
*
|
||||||
|
* Another method is to define LZ4_DISABLE_DEPRECATE_WARNINGS
|
||||||
|
* before including the header file.
|
||||||
|
*/
|
||||||
|
#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
|
||||||
|
# define LZ4_DEPRECATED(message) /* disable deprecation warnings */
|
||||||
|
#else
|
||||||
|
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
|
||||||
|
# define LZ4_DEPRECATED(message) [[deprecated(message)]]
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
|
||||||
|
# elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45))
|
||||||
|
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||||
|
# elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31)
|
||||||
|
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
|
||||||
|
# else
|
||||||
|
# pragma message("WARNING: LZ4_DEPRECATED needs custom implementation for this compiler")
|
||||||
|
# define LZ4_DEPRECATED(message) /* disabled */
|
||||||
|
# endif
|
||||||
|
#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */
|
||||||
|
|
||||||
|
/*! Obsolete compression functions (since v1.7.3) */
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* src, char* dest, int srcSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* src, char* dest, int srcSize, int maxOutputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||||
|
|
||||||
|
/*! Obsolete decompression functions (since v1.8.0) */
|
||||||
|
LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
|
||||||
|
|
||||||
|
/* Obsolete streaming functions (since v1.7.0)
|
||||||
|
* degraded functionality; do not use!
|
||||||
|
*
|
||||||
|
* In order to perform streaming compression, these functions depended on data
|
||||||
|
* that is no longer tracked in the state. They have been preserved as well as
|
||||||
|
* possible: using them will still produce a correct output. However, they don't
|
||||||
|
* actually retain any history between compression calls. The compression ratio
|
||||||
|
* achieved will therefore be no better than compressing each chunk
|
||||||
|
* independently.
|
||||||
|
*/
|
||||||
|
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer);
|
||||||
|
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);
|
||||||
|
LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer);
|
||||||
|
LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state);
|
||||||
|
|
||||||
|
/*! Obsolete streaming decoding functions (since v1.7.0) */
|
||||||
|
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
|
||||||
|
|
||||||
|
/*! Obsolete LZ4_decompress_fast variants (since v1.9.0) :
|
||||||
|
* These functions used to be faster than LZ4_decompress_safe(),
|
||||||
|
* but this is no longer the case. They are now slower.
|
||||||
|
* This is because LZ4_decompress_fast() doesn't know the input size,
|
||||||
|
* and therefore must progress more cautiously into the input buffer to not read beyond the end of block.
|
||||||
|
* On top of that `LZ4_decompress_fast()` is not protected vs malformed or malicious inputs, making it a security liability.
|
||||||
|
* As a consequence, LZ4_decompress_fast() is strongly discouraged, and deprecated.
|
||||||
|
*
|
||||||
|
* The last remaining LZ4_decompress_fast() specificity is that
|
||||||
|
* it can decompress a block without knowing its compressed size.
|
||||||
|
* Such functionality can be achieved in a more secure manner
|
||||||
|
* by employing LZ4_decompress_safe_partial().
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* originalSize : is the uncompressed size to regenerate.
|
||||||
|
* `dst` must be already allocated, its size must be >= 'originalSize' bytes.
|
||||||
|
* @return : number of bytes read from source buffer (== compressed size).
|
||||||
|
* The function expects to finish at block's end exactly.
|
||||||
|
* If the source stream is detected malformed, the function stops decoding and returns a negative result.
|
||||||
|
* note : LZ4_decompress_fast*() requires originalSize. Thanks to this information, it never writes past the output buffer.
|
||||||
|
* However, since it doesn't know its 'src' size, it may read an unknown amount of input, past input buffer bounds.
|
||||||
|
* Also, since match offsets are not validated, match reads from 'src' may underflow too.
|
||||||
|
* These issues never happen if input (compressed) data is correct.
|
||||||
|
* But they may happen if input data is invalid (error or intentional tampering).
|
||||||
|
* As a consequence, use these functions in trusted environments with trusted data **only**.
|
||||||
|
*/
|
||||||
|
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_partial() instead")
|
||||||
|
LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize);
|
||||||
|
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider migrating towards LZ4_decompress_safe_continue() instead. "
|
||||||
|
"Note that the contract will change (requires block's compressed size, instead of decompressed size)")
|
||||||
|
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize);
|
||||||
|
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_partial_usingDict() instead")
|
||||||
|
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);
|
||||||
|
|
||||||
|
/*! LZ4_resetStream() :
|
||||||
|
* An LZ4_stream_t structure must be initialized at least once.
|
||||||
|
* This is done with LZ4_initStream(), or LZ4_resetStream().
|
||||||
|
* Consider switching to LZ4_initStream(),
|
||||||
|
* invoking LZ4_resetStream() will trigger deprecation warnings in the future.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* LZ4_H_98237428734687 */
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
2169
kernel/lz4/lz4frame.c
Normal file
2169
kernel/lz4/lz4frame.c
Normal file
File diff suppressed because it is too large
Load Diff
771
kernel/lz4/lz4frame.h
Normal file
771
kernel/lz4/lz4frame.h
Normal file
@@ -0,0 +1,771 @@
|
|||||||
|
/*
|
||||||
|
LZ4F - LZ4-Frame library
|
||||||
|
Header File
|
||||||
|
Copyright (c) Yann Collet. All rights reserved.
|
||||||
|
|
||||||
|
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||||
|
|
||||||
|
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
|
||||||
|
OWNER 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 :
|
||||||
|
- LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* LZ4F is a stand-alone API able to create and decode LZ4 frames
|
||||||
|
* conformant with specification v1.6.1 in doc/lz4_Frame_format.md .
|
||||||
|
* Generated frames are compatible with `lz4` CLI.
|
||||||
|
*
|
||||||
|
* LZ4F also offers streaming capabilities.
|
||||||
|
*
|
||||||
|
* lz4.h is not required when using lz4frame.h,
|
||||||
|
* except to extract common constants such as LZ4_VERSION_NUMBER.
|
||||||
|
* */
|
||||||
|
|
||||||
|
#ifndef LZ4F_H_09782039843
|
||||||
|
#define LZ4F_H_09782039843
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* --- Dependency --- */
|
||||||
|
#include <stddef.h> /* size_t */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Introduction
|
||||||
|
*
|
||||||
|
* lz4frame.h implements LZ4 frame specification: see doc/lz4_Frame_format.md .
|
||||||
|
* LZ4 Frames are compatible with `lz4` CLI,
|
||||||
|
* and designed to be interoperable with any system.
|
||||||
|
**/
|
||||||
|
|
||||||
|
/*-***************************************************************
|
||||||
|
* Compiler specifics
|
||||||
|
*****************************************************************/
|
||||||
|
/* LZ4_DLL_EXPORT :
|
||||||
|
* Enable exporting of functions when building a Windows DLL
|
||||||
|
* LZ4FLIB_VISIBILITY :
|
||||||
|
* Control library symbols visibility.
|
||||||
|
*/
|
||||||
|
#ifndef LZ4FLIB_VISIBILITY
|
||||||
|
# if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||||
|
# define LZ4FLIB_VISIBILITY __attribute__ ((visibility ("default")))
|
||||||
|
# else
|
||||||
|
# define LZ4FLIB_VISIBILITY
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
|
||||||
|
# define LZ4FLIB_API __declspec(dllexport) LZ4FLIB_VISIBILITY
|
||||||
|
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
|
||||||
|
# define LZ4FLIB_API __declspec(dllimport) LZ4FLIB_VISIBILITY
|
||||||
|
#else
|
||||||
|
# define LZ4FLIB_API LZ4FLIB_VISIBILITY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LZ4F_DISABLE_DEPRECATE_WARNINGS
|
||||||
|
# define LZ4F_DEPRECATE(x) x
|
||||||
|
#else
|
||||||
|
# if defined(_MSC_VER)
|
||||||
|
# define LZ4F_DEPRECATE(x) x /* __declspec(deprecated) x - only works with C++ */
|
||||||
|
# elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
|
||||||
|
# define LZ4F_DEPRECATE(x) x __attribute__((deprecated))
|
||||||
|
# else
|
||||||
|
# define LZ4F_DEPRECATE(x) x /* no deprecation warning for this compiler */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Error management
|
||||||
|
**************************************/
|
||||||
|
typedef size_t LZ4F_errorCode_t;
|
||||||
|
|
||||||
|
LZ4FLIB_API unsigned LZ4F_isError(LZ4F_errorCode_t code); /**< tells when a function result is an error code */
|
||||||
|
LZ4FLIB_API const char* LZ4F_getErrorName(LZ4F_errorCode_t code); /**< return error code string; for debugging */
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Frame compression types
|
||||||
|
************************************* */
|
||||||
|
/* #define LZ4F_ENABLE_OBSOLETE_ENUMS // uncomment to enable obsolete enums */
|
||||||
|
#ifdef LZ4F_ENABLE_OBSOLETE_ENUMS
|
||||||
|
# define LZ4F_OBSOLETE_ENUM(x) , LZ4F_DEPRECATE(x) = LZ4F_##x
|
||||||
|
#else
|
||||||
|
# define LZ4F_OBSOLETE_ENUM(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The larger the block size, the (slightly) better the compression ratio,
|
||||||
|
* though there are diminishing returns.
|
||||||
|
* Larger blocks also increase memory usage on both compression and decompression sides.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
LZ4F_default=0,
|
||||||
|
LZ4F_max64KB=4,
|
||||||
|
LZ4F_max256KB=5,
|
||||||
|
LZ4F_max1MB=6,
|
||||||
|
LZ4F_max4MB=7
|
||||||
|
LZ4F_OBSOLETE_ENUM(max64KB)
|
||||||
|
LZ4F_OBSOLETE_ENUM(max256KB)
|
||||||
|
LZ4F_OBSOLETE_ENUM(max1MB)
|
||||||
|
LZ4F_OBSOLETE_ENUM(max4MB)
|
||||||
|
} LZ4F_blockSizeID_t;
|
||||||
|
|
||||||
|
/* Linked blocks sharply reduce inefficiencies when using small blocks,
|
||||||
|
* they compress better.
|
||||||
|
* However, some LZ4 decoders are only compatible with independent blocks */
|
||||||
|
typedef enum {
|
||||||
|
LZ4F_blockLinked=0,
|
||||||
|
LZ4F_blockIndependent
|
||||||
|
LZ4F_OBSOLETE_ENUM(blockLinked)
|
||||||
|
LZ4F_OBSOLETE_ENUM(blockIndependent)
|
||||||
|
} LZ4F_blockMode_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LZ4F_noContentChecksum=0,
|
||||||
|
LZ4F_contentChecksumEnabled
|
||||||
|
LZ4F_OBSOLETE_ENUM(noContentChecksum)
|
||||||
|
LZ4F_OBSOLETE_ENUM(contentChecksumEnabled)
|
||||||
|
} LZ4F_contentChecksum_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LZ4F_noBlockChecksum=0,
|
||||||
|
LZ4F_blockChecksumEnabled
|
||||||
|
} LZ4F_blockChecksum_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LZ4F_frame=0,
|
||||||
|
LZ4F_skippableFrame
|
||||||
|
LZ4F_OBSOLETE_ENUM(skippableFrame)
|
||||||
|
} LZ4F_frameType_t;
|
||||||
|
|
||||||
|
#ifdef LZ4F_ENABLE_OBSOLETE_ENUMS
|
||||||
|
typedef LZ4F_blockSizeID_t blockSizeID_t;
|
||||||
|
typedef LZ4F_blockMode_t blockMode_t;
|
||||||
|
typedef LZ4F_frameType_t frameType_t;
|
||||||
|
typedef LZ4F_contentChecksum_t contentChecksum_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! LZ4F_frameInfo_t :
|
||||||
|
* makes it possible to set or read frame parameters.
|
||||||
|
* Structure must be first init to 0, using memset() or LZ4F_INIT_FRAMEINFO,
|
||||||
|
* setting all parameters to default.
|
||||||
|
* It's then possible to update selectively some parameters */
|
||||||
|
typedef struct {
|
||||||
|
LZ4F_blockSizeID_t blockSizeID; /* max64KB, max256KB, max1MB, max4MB; 0 == default (LZ4F_max64KB) */
|
||||||
|
LZ4F_blockMode_t blockMode; /* LZ4F_blockLinked, LZ4F_blockIndependent; 0 == default (LZ4F_blockLinked) */
|
||||||
|
LZ4F_contentChecksum_t contentChecksumFlag; /* 1: add a 32-bit checksum of frame's decompressed data; 0 == default (disabled) */
|
||||||
|
LZ4F_frameType_t frameType; /* read-only field : LZ4F_frame or LZ4F_skippableFrame */
|
||||||
|
unsigned long long contentSize; /* Size of uncompressed content ; 0 == unknown */
|
||||||
|
unsigned dictID; /* Dictionary ID, sent by compressor to help decoder select correct dictionary; 0 == no dictID provided */
|
||||||
|
LZ4F_blockChecksum_t blockChecksumFlag; /* 1: each block followed by a checksum of block's compressed data; 0 == default (disabled) */
|
||||||
|
} LZ4F_frameInfo_t;
|
||||||
|
|
||||||
|
#define LZ4F_INIT_FRAMEINFO { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum } /* v1.8.3+ */
|
||||||
|
|
||||||
|
/*! LZ4F_preferences_t :
|
||||||
|
* makes it possible to supply advanced compression instructions to streaming interface.
|
||||||
|
* Structure must be first init to 0, using memset() or LZ4F_INIT_PREFERENCES,
|
||||||
|
* setting all parameters to default.
|
||||||
|
* All reserved fields must be set to zero. */
|
||||||
|
typedef struct {
|
||||||
|
LZ4F_frameInfo_t frameInfo;
|
||||||
|
int compressionLevel; /* 0: default (fast mode); values > LZ4HC_CLEVEL_MAX count as LZ4HC_CLEVEL_MAX; values < 0 trigger "fast acceleration" */
|
||||||
|
unsigned autoFlush; /* 1: always flush; reduces usage of internal buffers */
|
||||||
|
unsigned favorDecSpeed; /* 1: parser favors decompression speed vs compression ratio. Only works for high compression modes (>= LZ4HC_CLEVEL_OPT_MIN) */ /* v1.8.2+ */
|
||||||
|
unsigned reserved[3]; /* must be zero for forward compatibility */
|
||||||
|
} LZ4F_preferences_t;
|
||||||
|
|
||||||
|
#define LZ4F_INIT_PREFERENCES { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } } /* v1.8.3+ */
|
||||||
|
|
||||||
|
|
||||||
|
/*-*********************************
|
||||||
|
* Simple compression function
|
||||||
|
***********************************/
|
||||||
|
|
||||||
|
/*! LZ4F_compressFrame() :
|
||||||
|
* Compress srcBuffer content into an LZ4-compressed frame.
|
||||||
|
* It's a one shot operation, all input content is consumed, and all output is generated.
|
||||||
|
*
|
||||||
|
* Note : it's a stateless operation (no LZ4F_cctx state needed).
|
||||||
|
* In order to reduce load on the allocator, LZ4F_compressFrame(), by default,
|
||||||
|
* uses the stack to allocate space for the compression state and some table.
|
||||||
|
* If this usage of the stack is too much for your application,
|
||||||
|
* consider compiling `lz4frame.c` with compile-time macro LZ4F_HEAPMODE set to 1 instead.
|
||||||
|
* All state allocations will use the Heap.
|
||||||
|
* It also means each invocation of LZ4F_compressFrame() will trigger several internal alloc/free invocations.
|
||||||
|
*
|
||||||
|
* @dstCapacity MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
|
||||||
|
* @preferencesPtr is optional : one can provide NULL, in which case all preferences are set to default.
|
||||||
|
* @return : number of bytes written into dstBuffer.
|
||||||
|
* or an error code if it fails (can be tested using LZ4F_isError())
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity,
|
||||||
|
const void* srcBuffer, size_t srcSize,
|
||||||
|
const LZ4F_preferences_t* preferencesPtr);
|
||||||
|
|
||||||
|
/*! LZ4F_compressFrameBound() :
|
||||||
|
* Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences.
|
||||||
|
* `preferencesPtr` is optional. It can be replaced by NULL, in which case, the function will assume default preferences.
|
||||||
|
* Note : this result is only usable with LZ4F_compressFrame().
|
||||||
|
* It may also be relevant to LZ4F_compressUpdate() _only if_ no flush() operation is ever performed.
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4F_compressionLevel_max() :
|
||||||
|
* @return maximum allowed compression level (currently: 12)
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API int LZ4F_compressionLevel_max(void); /* v1.8.0+ */
|
||||||
|
|
||||||
|
|
||||||
|
/*-***********************************
|
||||||
|
* Advanced compression functions
|
||||||
|
*************************************/
|
||||||
|
typedef struct LZ4F_cctx_s LZ4F_cctx; /* incomplete type */
|
||||||
|
typedef LZ4F_cctx* LZ4F_compressionContext_t; /* for compatibility with older APIs, prefer using LZ4F_cctx */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned stableSrc; /* 1 == src content will remain present on future calls to LZ4F_compress(); skip copying src content within tmp buffer */
|
||||||
|
unsigned reserved[3];
|
||||||
|
} LZ4F_compressOptions_t;
|
||||||
|
|
||||||
|
/*--- Resource Management ---*/
|
||||||
|
|
||||||
|
#define LZ4F_VERSION 100 /* This number can be used to check for an incompatible API breaking change */
|
||||||
|
LZ4FLIB_API unsigned LZ4F_getVersion(void);
|
||||||
|
|
||||||
|
/*! LZ4F_createCompressionContext() :
|
||||||
|
* The first thing to do is to create a compressionContext object,
|
||||||
|
* which will keep track of operation state during streaming compression.
|
||||||
|
* This is achieved using LZ4F_createCompressionContext(), which takes as argument a version,
|
||||||
|
* and a pointer to LZ4F_cctx*, to write the resulting pointer into.
|
||||||
|
* @version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL.
|
||||||
|
* The function provides a pointer to a fully allocated LZ4F_cctx object.
|
||||||
|
* @cctxPtr MUST be != NULL.
|
||||||
|
* If @return != zero, context creation failed.
|
||||||
|
* A created compression context can be employed multiple times for consecutive streaming operations.
|
||||||
|
* Once all streaming compression jobs are completed,
|
||||||
|
* the state object can be released using LZ4F_freeCompressionContext().
|
||||||
|
* Note1 : LZ4F_freeCompressionContext() is always successful. Its return value can be ignored.
|
||||||
|
* Note2 : LZ4F_freeCompressionContext() works fine with NULL input pointers (do nothing).
|
||||||
|
**/
|
||||||
|
LZ4FLIB_API LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_cctx** cctxPtr, unsigned version);
|
||||||
|
LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx);
|
||||||
|
|
||||||
|
|
||||||
|
/*---- Compression ----*/
|
||||||
|
|
||||||
|
#define LZ4F_HEADER_SIZE_MIN 7 /* LZ4 Frame header size can vary, depending on selected parameters */
|
||||||
|
#define LZ4F_HEADER_SIZE_MAX 19
|
||||||
|
|
||||||
|
/* Size in bytes of a block header in little-endian format. Highest bit indicates if block data is uncompressed */
|
||||||
|
#define LZ4F_BLOCK_HEADER_SIZE 4
|
||||||
|
|
||||||
|
/* Size in bytes of a block checksum footer in little-endian format. */
|
||||||
|
#define LZ4F_BLOCK_CHECKSUM_SIZE 4
|
||||||
|
|
||||||
|
/* Size in bytes of the content checksum. */
|
||||||
|
#define LZ4F_CONTENT_CHECKSUM_SIZE 4
|
||||||
|
|
||||||
|
/* Size in bytes of the endmark. */
|
||||||
|
#define LZ4F_ENDMARK_SIZE 4
|
||||||
|
|
||||||
|
/*! LZ4F_compressBegin() :
|
||||||
|
* will write the frame header into dstBuffer.
|
||||||
|
* dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
|
||||||
|
* `prefsPtr` is optional : NULL can be provided to set all preferences to default.
|
||||||
|
* @return : number of bytes written into dstBuffer for the header
|
||||||
|
* or an error code (which can be tested using LZ4F_isError())
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_compressBegin(LZ4F_cctx* cctx,
|
||||||
|
void* dstBuffer, size_t dstCapacity,
|
||||||
|
const LZ4F_preferences_t* prefsPtr);
|
||||||
|
|
||||||
|
/*! LZ4F_compressBound() :
|
||||||
|
* Provides minimum dstCapacity required to guarantee success of
|
||||||
|
* LZ4F_compressUpdate(), given a srcSize and preferences, for a worst case scenario.
|
||||||
|
* When srcSize==0, LZ4F_compressBound() provides an upper bound for LZ4F_flush() and LZ4F_compressEnd() instead.
|
||||||
|
* Note that the result is only valid for a single invocation of LZ4F_compressUpdate().
|
||||||
|
* When invoking LZ4F_compressUpdate() multiple times,
|
||||||
|
* if the output buffer is gradually filled up instead of emptied and re-used from its start,
|
||||||
|
* one must check if there is enough remaining capacity before each invocation, using LZ4F_compressBound().
|
||||||
|
* @return is always the same for a srcSize and prefsPtr.
|
||||||
|
* prefsPtr is optional : when NULL is provided, preferences will be set to cover worst case scenario.
|
||||||
|
* tech details :
|
||||||
|
* @return if automatic flushing is not enabled, includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes.
|
||||||
|
* It also includes frame footer (ending + checksum), since it might be generated by LZ4F_compressEnd().
|
||||||
|
* @return doesn't include frame header, as it was already generated by LZ4F_compressBegin().
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* prefsPtr);
|
||||||
|
|
||||||
|
/*! LZ4F_compressUpdate() :
|
||||||
|
* LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary.
|
||||||
|
* Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations.
|
||||||
|
* This value is provided by LZ4F_compressBound().
|
||||||
|
* If this condition is not respected, LZ4F_compress() will fail (result is an errorCode).
|
||||||
|
* After an error, the state is left in a UB state, and must be re-initialized or freed.
|
||||||
|
* If previously an uncompressed block was written, buffered data is flushed
|
||||||
|
* before appending compressed data is continued.
|
||||||
|
* `cOptPtr` is optional : NULL can be provided, in which case all options are set to default.
|
||||||
|
* @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered).
|
||||||
|
* or an error code if it fails (which can be tested using LZ4F_isError())
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_compressUpdate(LZ4F_cctx* cctx,
|
||||||
|
void* dstBuffer, size_t dstCapacity,
|
||||||
|
const void* srcBuffer, size_t srcSize,
|
||||||
|
const LZ4F_compressOptions_t* cOptPtr);
|
||||||
|
|
||||||
|
/*! LZ4F_flush() :
|
||||||
|
* When data must be generated and sent immediately, without waiting for a block to be completely filled,
|
||||||
|
* it's possible to call LZ4_flush(). It will immediately compress any data buffered within cctx.
|
||||||
|
* `dstCapacity` must be large enough to ensure the operation will be successful.
|
||||||
|
* `cOptPtr` is optional : it's possible to provide NULL, all options will be set to default.
|
||||||
|
* @return : nb of bytes written into dstBuffer (can be zero, when there is no data stored within cctx)
|
||||||
|
* or an error code if it fails (which can be tested using LZ4F_isError())
|
||||||
|
* Note : LZ4F_flush() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr).
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_flush(LZ4F_cctx* cctx,
|
||||||
|
void* dstBuffer, size_t dstCapacity,
|
||||||
|
const LZ4F_compressOptions_t* cOptPtr);
|
||||||
|
|
||||||
|
/*! LZ4F_compressEnd() :
|
||||||
|
* To properly finish an LZ4 frame, invoke LZ4F_compressEnd().
|
||||||
|
* It will flush whatever data remained within `cctx` (like LZ4_flush())
|
||||||
|
* and properly finalize the frame, with an endMark and a checksum.
|
||||||
|
* `cOptPtr` is optional : NULL can be provided, in which case all options will be set to default.
|
||||||
|
* @return : nb of bytes written into dstBuffer, necessarily >= 4 (endMark),
|
||||||
|
* or an error code if it fails (which can be tested using LZ4F_isError())
|
||||||
|
* Note : LZ4F_compressEnd() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr).
|
||||||
|
* A successful call to LZ4F_compressEnd() makes `cctx` available again for another compression task.
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_compressEnd(LZ4F_cctx* cctx,
|
||||||
|
void* dstBuffer, size_t dstCapacity,
|
||||||
|
const LZ4F_compressOptions_t* cOptPtr);
|
||||||
|
|
||||||
|
|
||||||
|
/*-*********************************
|
||||||
|
* Decompression functions
|
||||||
|
***********************************/
|
||||||
|
typedef struct LZ4F_dctx_s LZ4F_dctx; /* incomplete type */
|
||||||
|
typedef LZ4F_dctx* LZ4F_decompressionContext_t; /* compatibility with previous API versions */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned stableDst; /* pledges that last 64KB decompressed data is present right before @dstBuffer pointer.
|
||||||
|
* This optimization skips internal storage operations.
|
||||||
|
* Once set, this pledge must remain valid up to the end of current frame. */
|
||||||
|
unsigned skipChecksums; /* disable checksum calculation and verification, even when one is present in frame, to save CPU time.
|
||||||
|
* Setting this option to 1 once disables all checksums for the rest of the frame. */
|
||||||
|
unsigned reserved1; /* must be set to zero for forward compatibility */
|
||||||
|
unsigned reserved0; /* idem */
|
||||||
|
} LZ4F_decompressOptions_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Resource management */
|
||||||
|
|
||||||
|
/*! LZ4F_createDecompressionContext() :
|
||||||
|
* Create an LZ4F_dctx object, to track all decompression operations.
|
||||||
|
* @version provided MUST be LZ4F_VERSION.
|
||||||
|
* @dctxPtr MUST be valid.
|
||||||
|
* The function fills @dctxPtr with the value of a pointer to an allocated and initialized LZ4F_dctx object.
|
||||||
|
* The @return is an errorCode, which can be tested using LZ4F_isError().
|
||||||
|
* dctx memory can be released using LZ4F_freeDecompressionContext();
|
||||||
|
* Result of LZ4F_freeDecompressionContext() indicates current state of decompressionContext when being released.
|
||||||
|
* That is, it should be == 0 if decompression has been completed fully and correctly.
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx** dctxPtr, unsigned version);
|
||||||
|
LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx);
|
||||||
|
|
||||||
|
|
||||||
|
/*-***********************************
|
||||||
|
* Streaming decompression functions
|
||||||
|
*************************************/
|
||||||
|
|
||||||
|
#define LZ4F_MAGICNUMBER 0x184D2204U
|
||||||
|
#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
|
||||||
|
#define LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH 5
|
||||||
|
|
||||||
|
/*! LZ4F_headerSize() : v1.9.0+
|
||||||
|
* Provide the header size of a frame starting at `src`.
|
||||||
|
* `srcSize` must be >= LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH,
|
||||||
|
* which is enough to decode the header length.
|
||||||
|
* @return : size of frame header
|
||||||
|
* or an error code, which can be tested using LZ4F_isError()
|
||||||
|
* note : Frame header size is variable, but is guaranteed to be
|
||||||
|
* >= LZ4F_HEADER_SIZE_MIN bytes, and <= LZ4F_HEADER_SIZE_MAX bytes.
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t LZ4F_headerSize(const void* src, size_t srcSize);
|
||||||
|
|
||||||
|
/*! LZ4F_getFrameInfo() :
|
||||||
|
* This function extracts frame parameters (max blockSize, dictID, etc.).
|
||||||
|
* Its usage is optional: user can also invoke LZ4F_decompress() directly.
|
||||||
|
*
|
||||||
|
* Extracted information will fill an existing LZ4F_frameInfo_t structure.
|
||||||
|
* This can be useful for allocation and dictionary identification purposes.
|
||||||
|
*
|
||||||
|
* LZ4F_getFrameInfo() can work in the following situations :
|
||||||
|
*
|
||||||
|
* 1) At the beginning of a new frame, before any invocation of LZ4F_decompress().
|
||||||
|
* It will decode header from `srcBuffer`,
|
||||||
|
* consuming the header and starting the decoding process.
|
||||||
|
*
|
||||||
|
* Input size must be large enough to contain the full frame header.
|
||||||
|
* Frame header size can be known beforehand by LZ4F_headerSize().
|
||||||
|
* Frame header size is variable, but is guaranteed to be >= LZ4F_HEADER_SIZE_MIN bytes,
|
||||||
|
* and not more than <= LZ4F_HEADER_SIZE_MAX bytes.
|
||||||
|
* Hence, blindly providing LZ4F_HEADER_SIZE_MAX bytes or more will always work.
|
||||||
|
* It's allowed to provide more input data than the header size,
|
||||||
|
* LZ4F_getFrameInfo() will only consume the header.
|
||||||
|
*
|
||||||
|
* If input size is not large enough,
|
||||||
|
* aka if it's smaller than header size,
|
||||||
|
* function will fail and return an error code.
|
||||||
|
*
|
||||||
|
* 2) After decoding has been started,
|
||||||
|
* it's possible to invoke LZ4F_getFrameInfo() anytime
|
||||||
|
* to extract already decoded frame parameters stored within dctx.
|
||||||
|
*
|
||||||
|
* Note that, if decoding has barely started,
|
||||||
|
* and not yet read enough information to decode the header,
|
||||||
|
* LZ4F_getFrameInfo() will fail.
|
||||||
|
*
|
||||||
|
* The number of bytes consumed from srcBuffer will be updated in *srcSizePtr (necessarily <= original value).
|
||||||
|
* LZ4F_getFrameInfo() only consumes bytes when decoding has not yet started,
|
||||||
|
* and when decoding the header has been successful.
|
||||||
|
* Decompression must then resume from (srcBuffer + *srcSizePtr).
|
||||||
|
*
|
||||||
|
* @return : a hint about how many srcSize bytes LZ4F_decompress() expects for next call,
|
||||||
|
* or an error code which can be tested using LZ4F_isError().
|
||||||
|
* note 1 : in case of error, dctx is not modified. Decoding operation can resume from beginning safely.
|
||||||
|
* note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure.
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t
|
||||||
|
LZ4F_getFrameInfo(LZ4F_dctx* dctx,
|
||||||
|
LZ4F_frameInfo_t* frameInfoPtr,
|
||||||
|
const void* srcBuffer, size_t* srcSizePtr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Incrementally decompresses an LZ4 frame into user-provided buffers.
|
||||||
|
*
|
||||||
|
* Call repeatedly until the return value is 0 (frame fully decoded) or an error is reported.
|
||||||
|
* On each call, the function consumes up to *srcSizePtr bytes from @p srcBuffer and
|
||||||
|
* produces up to *dstSizePtr bytes into @p dstBuffer. It updates both size pointers with
|
||||||
|
* the actual number of bytes consumed/produced. There is no separate flush step.
|
||||||
|
*
|
||||||
|
* Typical loop:
|
||||||
|
* - Provide whatever input you have and an available output buffer.
|
||||||
|
* - Read how much input was consumed and how much output was produced.
|
||||||
|
* - Use the returned value as a hint for how many source bytes are ideal next time.
|
||||||
|
*
|
||||||
|
* @param[in] dctx A valid decompression context created by LZ4F_createDecompressionContext().
|
||||||
|
* @param[out] dstBuffer Destination buffer for decompressed bytes. May change between calls.
|
||||||
|
* @param[in,out] dstSizePtr In: capacity of @p dstBuffer in bytes. Out: number of bytes written (<= input value).
|
||||||
|
* @param[in] srcBuffer Source buffer containing (more) compressed data. May point to the middle of a larger buffer.
|
||||||
|
* @param[in,out] srcSizePtr In: number of available bytes in @p srcBuffer. Out: number of bytes consumed (<= input value).
|
||||||
|
* @param[in] optionsPtr Optional decompression options; pass NULL for defaults.
|
||||||
|
*
|
||||||
|
* @return See @retval cases.
|
||||||
|
* @retval >0 Hint (in bytes) for how many source bytes are ideal to provide on the next call.
|
||||||
|
* This also indicates the current frame is not yet complete: the decompressor
|
||||||
|
* expects more input, or may require additional output space to make progress.
|
||||||
|
* User can always pass any amount of input; this value is only a performance hint.
|
||||||
|
* @retval 0 The current frame is fully decoded. If *srcSizePtr is less than the provided value,
|
||||||
|
* the unconsumed tail is the start of another frame (if any).
|
||||||
|
* @retval error An error code; test with LZ4F_isError(ret). After an error, dctx is not
|
||||||
|
* resumable: call LZ4F_resetDecompressionContext() before reusing it.
|
||||||
|
*
|
||||||
|
* @pre @p dctx is a valid state created by LZ4F_createDecompressionContext().
|
||||||
|
* @post *srcSizePtr and *dstSizePtr are updated with the actual bytes consumed/produced.
|
||||||
|
* @p dstBuffer contents in [0, *dstSizePtr) are valid decompressed data.
|
||||||
|
*
|
||||||
|
* @note The function may not consume all provided input on each call. Always check *srcSizePtr.
|
||||||
|
* Present any unconsumed source bytes again on the next call.
|
||||||
|
* @note @p dstBuffer content is overwritten; it does not need to be stable across calls.
|
||||||
|
* @note After finishing a frame (return==0), you may immediately start feeding the next frame
|
||||||
|
* into the same @p dctx (optionally, one can use LZ4F_resetDecompressionContext()).
|
||||||
|
*
|
||||||
|
* @warning If you called LZ4F_getFrameInfo() beforehand, you must advance @p srcBuffer and
|
||||||
|
* decrease *srcSizePtr by the number of bytes it consumed (the frame header). Failing
|
||||||
|
* to do so can cause decompression failure or, worse, silent corruption.
|
||||||
|
*
|
||||||
|
* @see LZ4F_getFrameInfo(), LZ4F_isError(), LZ4F_resetDecompressionContext(),
|
||||||
|
* LZ4F_createDecompressionContext(), LZ4F_freeDecompressionContext()
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t
|
||||||
|
LZ4F_decompress(LZ4F_dctx* dctx,
|
||||||
|
void* dstBuffer, size_t* dstSizePtr,
|
||||||
|
const void* srcBuffer, size_t* srcSizePtr,
|
||||||
|
const LZ4F_decompressOptions_t* dOptPtr);
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4F_resetDecompressionContext() : added in v1.8.0
|
||||||
|
* In case of an error, the context is left in "undefined" state.
|
||||||
|
* In which case, it's necessary to reset it, before re-using it.
|
||||||
|
* This method can also be used to abruptly stop any unfinished decompression,
|
||||||
|
* and start a new one using same context resources. */
|
||||||
|
LZ4FLIB_API void LZ4F_resetDecompressionContext(LZ4F_dctx* dctx); /* always successful */
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* Dictionary compression API
|
||||||
|
*********************************/
|
||||||
|
|
||||||
|
/* A Dictionary is useful for the compression of small messages (KB range).
|
||||||
|
* It dramatically improves compression efficiency.
|
||||||
|
*
|
||||||
|
* LZ4 can ingest any input as dictionary, though only the last 64 KB are useful.
|
||||||
|
* Better results are generally achieved by using Zstandard's Dictionary Builder
|
||||||
|
* to generate a high-quality dictionary from a set of samples.
|
||||||
|
*
|
||||||
|
* The same dictionary will have to be used on the decompression side
|
||||||
|
* for decoding to be successful.
|
||||||
|
* To help identify the correct dictionary at decoding stage,
|
||||||
|
* the frame header allows optional embedding of a dictID field.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! LZ4F_compressBegin_usingDict() : stable since v1.10
|
||||||
|
* Inits dictionary compression streaming, and writes the frame header into dstBuffer.
|
||||||
|
* @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
|
||||||
|
* @prefsPtr is optional : one may provide NULL as argument,
|
||||||
|
* however, it's the only way to provide dictID in the frame header.
|
||||||
|
* @dictBuffer must outlive the compression session.
|
||||||
|
* @return : number of bytes written into dstBuffer for the header,
|
||||||
|
* or an error code (which can be tested using LZ4F_isError())
|
||||||
|
* NOTE: The LZ4Frame spec allows each independent block to be compressed with the dictionary,
|
||||||
|
* but this entry supports a more limited scenario, where only the first block uses the dictionary.
|
||||||
|
* This is still useful for small data, which only need one block anyway.
|
||||||
|
* For larger inputs, one may be more interested in LZ4F_compressFrame_usingCDict() below.
|
||||||
|
*/
|
||||||
|
LZ4FLIB_API size_t
|
||||||
|
LZ4F_compressBegin_usingDict(LZ4F_cctx* cctx,
|
||||||
|
void* dstBuffer, size_t dstCapacity,
|
||||||
|
const void* dictBuffer, size_t dictSize,
|
||||||
|
const LZ4F_preferences_t* prefsPtr);
|
||||||
|
|
||||||
|
/*! LZ4F_decompress_usingDict() : stable since v1.10
|
||||||
|
* Same as LZ4F_decompress(), using a predefined dictionary.
|
||||||
|
* Dictionary is used "in place", without any preprocessing.
|
||||||
|
** It must remain accessible throughout the entire frame decoding. */
|
||||||
|
LZ4FLIB_API size_t
|
||||||
|
LZ4F_decompress_usingDict(LZ4F_dctx* dctxPtr,
|
||||||
|
void* dstBuffer, size_t* dstSizePtr,
|
||||||
|
const void* srcBuffer, size_t* srcSizePtr,
|
||||||
|
const void* dict, size_t dictSize,
|
||||||
|
const LZ4F_decompressOptions_t* decompressOptionsPtr);
|
||||||
|
|
||||||
|
/*****************************************
|
||||||
|
* Bulk processing dictionary compression
|
||||||
|
*****************************************/
|
||||||
|
|
||||||
|
/* Loading a dictionary has a cost, since it involves construction of tables.
|
||||||
|
* The Bulk processing dictionary API makes it possible to share this cost
|
||||||
|
* over an arbitrary number of compression jobs, even concurrently,
|
||||||
|
* markedly improving compression latency for these cases.
|
||||||
|
*
|
||||||
|
* Note that there is no corresponding bulk API for the decompression side,
|
||||||
|
* because dictionary does not carry any initialization cost for decompression.
|
||||||
|
* Use the regular LZ4F_decompress_usingDict() there.
|
||||||
|
*/
|
||||||
|
typedef struct LZ4F_CDict_s LZ4F_CDict;
|
||||||
|
|
||||||
|
/*! LZ4_createCDict() : stable since v1.10
|
||||||
|
* When compressing multiple messages / blocks using the same dictionary, it's recommended to initialize it just once.
|
||||||
|
* LZ4_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay.
|
||||||
|
* LZ4_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only.
|
||||||
|
* @dictBuffer can be released after LZ4_CDict creation, since its content is copied within CDict. */
|
||||||
|
LZ4FLIB_API LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize);
|
||||||
|
LZ4FLIB_API void LZ4F_freeCDict(LZ4F_CDict* CDict);
|
||||||
|
|
||||||
|
/*! LZ4_compressFrame_usingCDict() : stable since v1.10
|
||||||
|
* Compress an entire srcBuffer into a valid LZ4 frame using a digested Dictionary.
|
||||||
|
* @cctx must point to a context created by LZ4F_createCompressionContext().
|
||||||
|
* If @cdict==NULL, compress without a dictionary.
|
||||||
|
* @dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
|
||||||
|
* If this condition is not respected, function will fail (@return an errorCode).
|
||||||
|
* The LZ4F_preferences_t structure is optional : one may provide NULL as argument,
|
||||||
|
* but it's not recommended, as it's the only way to provide @dictID in the frame header.
|
||||||
|
* @return : number of bytes written into dstBuffer.
|
||||||
|
* or an error code if it fails (can be tested using LZ4F_isError())
|
||||||
|
* Note: for larger inputs generating multiple independent blocks,
|
||||||
|
* this entry point uses the dictionary for each block. */
|
||||||
|
LZ4FLIB_API size_t
|
||||||
|
LZ4F_compressFrame_usingCDict(LZ4F_cctx* cctx,
|
||||||
|
void* dst, size_t dstCapacity,
|
||||||
|
const void* src, size_t srcSize,
|
||||||
|
const LZ4F_CDict* cdict,
|
||||||
|
const LZ4F_preferences_t* preferencesPtr);
|
||||||
|
|
||||||
|
/*! LZ4F_compressBegin_usingCDict() : stable since v1.10
|
||||||
|
* Inits streaming dictionary compression, and writes the frame header into dstBuffer.
|
||||||
|
* @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
|
||||||
|
* @prefsPtr is optional : one may provide NULL as argument,
|
||||||
|
* note however that it's the only way to insert a @dictID in the frame header.
|
||||||
|
* @cdict must outlive the compression session.
|
||||||
|
* @return : number of bytes written into dstBuffer for the header,
|
||||||
|
* or an error code, which can be tested using LZ4F_isError(). */
|
||||||
|
LZ4FLIB_API size_t
|
||||||
|
LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctx,
|
||||||
|
void* dstBuffer, size_t dstCapacity,
|
||||||
|
const LZ4F_CDict* cdict,
|
||||||
|
const LZ4F_preferences_t* prefsPtr);
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LZ4F_H_09782039843 */
|
||||||
|
|
||||||
|
#if defined(LZ4F_STATIC_LINKING_ONLY) && !defined(LZ4F_H_STATIC_09782039843)
|
||||||
|
#define LZ4F_H_STATIC_09782039843
|
||||||
|
|
||||||
|
/* Note :
|
||||||
|
* The below declarations are not stable and may change in the future.
|
||||||
|
* They are therefore only safe to depend on
|
||||||
|
* when the caller is statically linked against the library.
|
||||||
|
* To access their declarations, define LZ4F_STATIC_LINKING_ONLY.
|
||||||
|
*
|
||||||
|
* By default, these symbols aren't published into shared/dynamic libraries.
|
||||||
|
* You can override this behavior and force them to be published
|
||||||
|
* by defining LZ4F_PUBLISH_STATIC_FUNCTIONS.
|
||||||
|
* Use at your own risk.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LZ4F_PUBLISH_STATIC_FUNCTIONS
|
||||||
|
# define LZ4FLIB_STATIC_API LZ4FLIB_API
|
||||||
|
#else
|
||||||
|
# define LZ4FLIB_STATIC_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* --- Error List --- */
|
||||||
|
#define LZ4F_LIST_ERRORS(ITEM) \
|
||||||
|
ITEM(OK_NoError) \
|
||||||
|
ITEM(ERROR_GENERIC) \
|
||||||
|
ITEM(ERROR_maxBlockSize_invalid) \
|
||||||
|
ITEM(ERROR_blockMode_invalid) \
|
||||||
|
ITEM(ERROR_parameter_invalid) \
|
||||||
|
ITEM(ERROR_compressionLevel_invalid) \
|
||||||
|
ITEM(ERROR_headerVersion_wrong) \
|
||||||
|
ITEM(ERROR_blockChecksum_invalid) \
|
||||||
|
ITEM(ERROR_reservedFlag_set) \
|
||||||
|
ITEM(ERROR_allocation_failed) \
|
||||||
|
ITEM(ERROR_srcSize_tooLarge) \
|
||||||
|
ITEM(ERROR_dstMaxSize_tooSmall) \
|
||||||
|
ITEM(ERROR_frameHeader_incomplete) \
|
||||||
|
ITEM(ERROR_frameType_unknown) \
|
||||||
|
ITEM(ERROR_frameSize_wrong) \
|
||||||
|
ITEM(ERROR_srcPtr_wrong) \
|
||||||
|
ITEM(ERROR_decompressionFailed) \
|
||||||
|
ITEM(ERROR_headerChecksum_invalid) \
|
||||||
|
ITEM(ERROR_contentChecksum_invalid) \
|
||||||
|
ITEM(ERROR_frameDecoding_alreadyStarted) \
|
||||||
|
ITEM(ERROR_compressionState_uninitialized) \
|
||||||
|
ITEM(ERROR_parameter_null) \
|
||||||
|
ITEM(ERROR_io_write) \
|
||||||
|
ITEM(ERROR_io_read) \
|
||||||
|
ITEM(ERROR_maxCode)
|
||||||
|
|
||||||
|
#define LZ4F_GENERATE_ENUM(ENUM) LZ4F_##ENUM,
|
||||||
|
|
||||||
|
/* enum list is exposed, to handle specific errors */
|
||||||
|
typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM)
|
||||||
|
_LZ4F_dummy_error_enum_for_c89_never_used } LZ4F_errorCodes;
|
||||||
|
|
||||||
|
LZ4FLIB_STATIC_API LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult);
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* Advanced compression operations
|
||||||
|
*********************************/
|
||||||
|
|
||||||
|
/*! LZ4F_getBlockSize() :
|
||||||
|
* @return, in scalar format (size_t),
|
||||||
|
* the maximum block size associated with @blockSizeID,
|
||||||
|
* or an error code (can be tested using LZ4F_isError()) if @blockSizeID is invalid.
|
||||||
|
**/
|
||||||
|
LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(LZ4F_blockSizeID_t blockSizeID);
|
||||||
|
|
||||||
|
/*! LZ4F_uncompressedUpdate() :
|
||||||
|
* LZ4F_uncompressedUpdate() can be called repetitively to add data stored as uncompressed blocks.
|
||||||
|
* Important rule: dstCapacity MUST be large enough to store the entire source buffer as
|
||||||
|
* no compression is done for this operation
|
||||||
|
* If this condition is not respected, LZ4F_uncompressedUpdate() will fail (result is an errorCode).
|
||||||
|
* After an error, the state is left in a UB state, and must be re-initialized or freed.
|
||||||
|
* If previously a compressed block was written, buffered data is flushed first,
|
||||||
|
* before appending uncompressed data is continued.
|
||||||
|
* This operation is only supported when LZ4F_blockIndependent is used.
|
||||||
|
* `cOptPtr` is optional : NULL can be provided, in which case all options are set to default.
|
||||||
|
* @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered).
|
||||||
|
* or an error code if it fails (which can be tested using LZ4F_isError())
|
||||||
|
*/
|
||||||
|
LZ4FLIB_STATIC_API size_t
|
||||||
|
LZ4F_uncompressedUpdate(LZ4F_cctx* cctx,
|
||||||
|
void* dstBuffer, size_t dstCapacity,
|
||||||
|
const void* srcBuffer, size_t srcSize,
|
||||||
|
const LZ4F_compressOptions_t* cOptPtr);
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* Custom memory allocation
|
||||||
|
*********************************/
|
||||||
|
|
||||||
|
/*! Custom memory allocation : v1.9.4+
|
||||||
|
* These prototypes make it possible to pass custom allocation/free functions.
|
||||||
|
* LZ4F_customMem is provided at state creation time, using LZ4F_create*_advanced() listed below.
|
||||||
|
* All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones.
|
||||||
|
*/
|
||||||
|
typedef void* (*LZ4F_AllocFunction) (void* opaqueState, size_t size);
|
||||||
|
typedef void* (*LZ4F_CallocFunction) (void* opaqueState, size_t size);
|
||||||
|
typedef void (*LZ4F_FreeFunction) (void* opaqueState, void* address);
|
||||||
|
typedef struct {
|
||||||
|
LZ4F_AllocFunction customAlloc;
|
||||||
|
LZ4F_CallocFunction customCalloc; /* optional; when not defined, uses customAlloc + memset */
|
||||||
|
LZ4F_FreeFunction customFree;
|
||||||
|
void* opaqueState;
|
||||||
|
} LZ4F_CustomMem;
|
||||||
|
static
|
||||||
|
#ifdef __GNUC__
|
||||||
|
__attribute__((__unused__))
|
||||||
|
#endif
|
||||||
|
LZ4F_CustomMem const LZ4F_defaultCMem = { NULL, NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */
|
||||||
|
|
||||||
|
LZ4FLIB_STATIC_API LZ4F_cctx* LZ4F_createCompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version);
|
||||||
|
LZ4FLIB_STATIC_API LZ4F_dctx* LZ4F_createDecompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version);
|
||||||
|
LZ4FLIB_STATIC_API LZ4F_CDict* LZ4F_createCDict_advanced(LZ4F_CustomMem customMem, const void* dictBuffer, size_t dictSize);
|
||||||
|
|
||||||
|
/*! Context size inspection : v1.10.1+
|
||||||
|
* These functions return the total memory footprint of the provided context.
|
||||||
|
*/
|
||||||
|
LZ4FLIB_STATIC_API size_t LZ4F_cctx_size(const LZ4F_cctx* cctx);
|
||||||
|
LZ4FLIB_STATIC_API size_t LZ4F_dctx_size(const LZ4F_dctx* dctx);
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* defined(LZ4F_STATIC_LINKING_ONLY) && !defined(LZ4F_H_STATIC_09782039843) */
|
||||||
2255
kernel/lz4/lz4hc.c
Normal file
2255
kernel/lz4/lz4hc.c
Normal file
File diff suppressed because it is too large
Load Diff
421
kernel/lz4/lz4hc.h
Normal file
421
kernel/lz4/lz4hc.h
Normal file
@@ -0,0 +1,421 @@
|
|||||||
|
/*
|
||||||
|
LZ4 HC - High Compression Mode of LZ4
|
||||||
|
Header File
|
||||||
|
Copyright (c) Yann Collet. All rights reserved.
|
||||||
|
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||||
|
|
||||||
|
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
|
||||||
|
OWNER 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 :
|
||||||
|
- LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
*/
|
||||||
|
#ifndef LZ4_HC_H_19834876238432
|
||||||
|
#define LZ4_HC_H_19834876238432
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* --- Dependency --- */
|
||||||
|
/* note : lz4hc requires lz4.h/lz4.c for compilation */
|
||||||
|
#include "lz4.h" /* stddef, LZ4LIB_API, LZ4_DEPRECATED */
|
||||||
|
|
||||||
|
|
||||||
|
/* --- Useful constants --- */
|
||||||
|
#define LZ4HC_CLEVEL_MIN 2
|
||||||
|
#define LZ4HC_CLEVEL_DEFAULT 9
|
||||||
|
#define LZ4HC_CLEVEL_OPT_MIN 10
|
||||||
|
#define LZ4HC_CLEVEL_MAX 12
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Block Compression
|
||||||
|
**************************************/
|
||||||
|
/*! LZ4_compress_HC() :
|
||||||
|
* Compress data from `src` into `dst`, using the powerful but slower "HC" algorithm.
|
||||||
|
* `dst` must be already allocated.
|
||||||
|
* Compression is guaranteed to succeed if `dstCapacity >= LZ4_compressBound(srcSize)` (see "lz4.h")
|
||||||
|
* Max supported `srcSize` value is LZ4_MAX_INPUT_SIZE (see "lz4.h")
|
||||||
|
* `compressionLevel` : any value between 1 and LZ4HC_CLEVEL_MAX will work.
|
||||||
|
* Values > LZ4HC_CLEVEL_MAX behave the same as LZ4HC_CLEVEL_MAX.
|
||||||
|
* @return : the number of bytes written into 'dst'
|
||||||
|
* or 0 if compression fails.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compress_HC (const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel);
|
||||||
|
|
||||||
|
|
||||||
|
/* Note :
|
||||||
|
* Decompression functions are provided within "lz4.h" (BSD license)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_compress_HC_extStateHC() :
|
||||||
|
* Same as LZ4_compress_HC(), but using an externally allocated memory segment for `state`.
|
||||||
|
* `state` size is provided by LZ4_sizeofStateHC().
|
||||||
|
* Memory segment must be aligned on 8-bytes boundaries (which a normal malloc() should do properly).
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_sizeofStateHC(void);
|
||||||
|
LZ4LIB_API int LZ4_compress_HC_extStateHC(void* stateHC, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel);
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_compress_HC_destSize() : v1.9.0+
|
||||||
|
* Will compress as much data as possible from `src`
|
||||||
|
* to fit into `targetDstSize` budget.
|
||||||
|
* Result is provided in 2 parts :
|
||||||
|
* @return : the number of bytes written into 'dst' (necessarily <= targetDstSize)
|
||||||
|
* or 0 if compression fails.
|
||||||
|
* `srcSizePtr` : on success, *srcSizePtr is updated to indicate how much bytes were read from `src`
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compress_HC_destSize(void* stateHC,
|
||||||
|
const char* src, char* dst,
|
||||||
|
int* srcSizePtr, int targetDstSize,
|
||||||
|
int compressionLevel);
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Streaming Compression
|
||||||
|
* Bufferless synchronous API
|
||||||
|
**************************************/
|
||||||
|
typedef union LZ4_streamHC_u LZ4_streamHC_t; /* incomplete type (defined later) */
|
||||||
|
|
||||||
|
/*! LZ4_createStreamHC() and LZ4_freeStreamHC() :
|
||||||
|
* These functions create and release memory for LZ4 HC streaming state.
|
||||||
|
* Newly created states are automatically initialized.
|
||||||
|
* A same state can be used multiple times consecutively,
|
||||||
|
* starting with LZ4_resetStreamHC_fast() to start a new stream of blocks.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API LZ4_streamHC_t* LZ4_createStreamHC(void);
|
||||||
|
LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
These functions compress data in successive blocks of any size,
|
||||||
|
using previous blocks as dictionary, to improve compression ratio.
|
||||||
|
One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks.
|
||||||
|
There is an exception for ring buffers, which can be smaller than 64 KB.
|
||||||
|
Ring-buffer scenario is automatically detected and handled within LZ4_compress_HC_continue().
|
||||||
|
|
||||||
|
Before starting compression, state must be allocated and properly initialized.
|
||||||
|
LZ4_createStreamHC() does both, though compression level is set to LZ4HC_CLEVEL_DEFAULT.
|
||||||
|
|
||||||
|
Selecting the compression level can be done with LZ4_resetStreamHC_fast() (starts a new stream)
|
||||||
|
or LZ4_setCompressionLevel() (anytime, between blocks in the same stream) (experimental).
|
||||||
|
LZ4_resetStreamHC_fast() only works on states which have been properly initialized at least once,
|
||||||
|
which is automatically the case when state is created using LZ4_createStreamHC().
|
||||||
|
|
||||||
|
After reset, a first "fictional block" can be designated as initial dictionary,
|
||||||
|
using LZ4_loadDictHC() (Optional).
|
||||||
|
Note: In order for LZ4_loadDictHC() to create the correct data structure,
|
||||||
|
it is essential to set the compression level _before_ loading the dictionary.
|
||||||
|
|
||||||
|
Invoke LZ4_compress_HC_continue() to compress each successive block.
|
||||||
|
The number of blocks is unlimited.
|
||||||
|
Previous input blocks, including initial dictionary when present,
|
||||||
|
must remain accessible and unmodified during compression.
|
||||||
|
|
||||||
|
It's allowed to update compression level anytime between blocks,
|
||||||
|
using LZ4_setCompressionLevel() (experimental).
|
||||||
|
|
||||||
|
@dst buffer should be sized to handle worst case scenarios
|
||||||
|
(see LZ4_compressBound(), it ensures compression success).
|
||||||
|
In case of failure, the API does not guarantee recovery,
|
||||||
|
so the state _must_ be reset.
|
||||||
|
To ensure compression success
|
||||||
|
whenever @dst buffer size cannot be made >= LZ4_compressBound(),
|
||||||
|
consider using LZ4_compress_HC_continue_destSize().
|
||||||
|
|
||||||
|
Whenever previous input blocks can't be preserved unmodified in-place during compression of next blocks,
|
||||||
|
it's possible to copy the last blocks into a more stable memory space, using LZ4_saveDictHC().
|
||||||
|
Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer' (<= 64 KB)
|
||||||
|
|
||||||
|
After completing a streaming compression,
|
||||||
|
it's possible to start a new stream of blocks, using the same LZ4_streamHC_t state,
|
||||||
|
just by resetting it, using LZ4_resetStreamHC_fast().
|
||||||
|
*/
|
||||||
|
|
||||||
|
LZ4LIB_API void LZ4_resetStreamHC_fast(LZ4_streamHC_t* streamHCPtr, int compressionLevel); /* v1.9.0+ */
|
||||||
|
LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize);
|
||||||
|
|
||||||
|
LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr,
|
||||||
|
const char* src, char* dst,
|
||||||
|
int srcSize, int maxDstSize);
|
||||||
|
|
||||||
|
/*! LZ4_compress_HC_continue_destSize() : v1.9.0+
|
||||||
|
* Similar to LZ4_compress_HC_continue(),
|
||||||
|
* but will read as much data as possible from `src`
|
||||||
|
* to fit into `targetDstSize` budget.
|
||||||
|
* Result is provided into 2 parts :
|
||||||
|
* @return : the number of bytes written into 'dst' (necessarily <= targetDstSize)
|
||||||
|
* or 0 if compression fails.
|
||||||
|
* `srcSizePtr` : on success, *srcSizePtr will be updated to indicate how much bytes were read from `src`.
|
||||||
|
* Note that this function may not consume the entire input.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr,
|
||||||
|
const char* src, char* dst,
|
||||||
|
int* srcSizePtr, int targetDstSize);
|
||||||
|
|
||||||
|
/*! LZ4_saveDictHC():
|
||||||
|
* save history content (up to 64 KB) into a user-provided buffer @param safeBuffer.
|
||||||
|
* @return value is the size of dictionary effectively saved (<= MIN(maxDictSize, 64 KB)).
|
||||||
|
* This function is always successful, and expects its arguments to be valid.
|
||||||
|
* To this end, let's remind that (NULL,0) is valid,
|
||||||
|
* but (NULL,!0) is not, and will result in a segfault (or assert() depending on compilation mode).
|
||||||
|
*/
|
||||||
|
LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize);
|
||||||
|
|
||||||
|
|
||||||
|
/*! LZ4_attach_HC_dictionary() : stable since v1.10.0
|
||||||
|
* This API allows for the efficient re-use of a static dictionary many times.
|
||||||
|
*
|
||||||
|
* Rather than re-loading the dictionary buffer into a working context before
|
||||||
|
* each compression, or copying a pre-loaded dictionary's LZ4_streamHC_t into a
|
||||||
|
* working LZ4_streamHC_t, this function introduces a no-copy setup mechanism,
|
||||||
|
* in which the working stream references the dictionary stream in-place.
|
||||||
|
*
|
||||||
|
* Several assumptions are made about the state of the dictionary stream.
|
||||||
|
* Currently, only streams which have been prepared by LZ4_loadDictHC() should
|
||||||
|
* be expected to work.
|
||||||
|
*
|
||||||
|
* Alternatively, the provided dictionary stream pointer may be NULL, in which
|
||||||
|
* case any existing dictionary stream is unset.
|
||||||
|
*
|
||||||
|
* A dictionary should only be attached to a stream without any history (i.e.,
|
||||||
|
* a stream that has just been reset).
|
||||||
|
*
|
||||||
|
* The dictionary will remain attached to the working stream only for the
|
||||||
|
* current stream session. Calls to LZ4_resetStreamHC(_fast) will remove the
|
||||||
|
* dictionary context association from the working stream. The dictionary
|
||||||
|
* stream (and source buffer) must remain in-place / accessible / unchanged
|
||||||
|
* through the lifetime of the stream session.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API void
|
||||||
|
LZ4_attach_HC_dictionary(LZ4_streamHC_t* working_stream,
|
||||||
|
const LZ4_streamHC_t* dictionary_stream);
|
||||||
|
|
||||||
|
|
||||||
|
/*^**********************************************
|
||||||
|
* !!!!!! STATIC LINKING ONLY !!!!!!
|
||||||
|
***********************************************/
|
||||||
|
|
||||||
|
/*-******************************************************************
|
||||||
|
* PRIVATE DEFINITIONS :
|
||||||
|
* Do not use these definitions directly.
|
||||||
|
* They are merely exposed to allow static allocation of `LZ4_streamHC_t`.
|
||||||
|
* Declare an `LZ4_streamHC_t` directly, rather than any type below.
|
||||||
|
* Even then, only do so in the context of static linking, as definitions may change between versions.
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
#define LZ4HC_DICTIONARY_LOGSIZE 16
|
||||||
|
#define LZ4HC_MAXD (1<<LZ4HC_DICTIONARY_LOGSIZE)
|
||||||
|
#define LZ4HC_MAXD_MASK (LZ4HC_MAXD - 1)
|
||||||
|
|
||||||
|
#define LZ4HC_HASH_LOG 15
|
||||||
|
#define LZ4HC_HASHTABLESIZE (1 << LZ4HC_HASH_LOG)
|
||||||
|
#define LZ4HC_HASH_MASK (LZ4HC_HASHTABLESIZE - 1)
|
||||||
|
|
||||||
|
|
||||||
|
/* Never ever use these definitions directly !
|
||||||
|
* Declare or allocate an LZ4_streamHC_t instead.
|
||||||
|
**/
|
||||||
|
typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal;
|
||||||
|
struct LZ4HC_CCtx_internal
|
||||||
|
{
|
||||||
|
LZ4_u32 hashTable[LZ4HC_HASHTABLESIZE];
|
||||||
|
LZ4_u16 chainTable[LZ4HC_MAXD];
|
||||||
|
const LZ4_byte* end; /* next block here to continue on current prefix */
|
||||||
|
const LZ4_byte* prefixStart; /* Indexes relative to this position */
|
||||||
|
const LZ4_byte* dictStart; /* alternate reference for extDict */
|
||||||
|
LZ4_u32 dictLimit; /* below that point, need extDict */
|
||||||
|
LZ4_u32 lowLimit; /* below that point, no more history */
|
||||||
|
LZ4_u32 nextToUpdate; /* index from which to continue dictionary update */
|
||||||
|
short compressionLevel;
|
||||||
|
LZ4_i8 favorDecSpeed; /* favor decompression speed if this flag set,
|
||||||
|
otherwise, favor compression ratio */
|
||||||
|
LZ4_i8 dirty; /* stream has to be fully reset if this flag is set */
|
||||||
|
const LZ4HC_CCtx_internal* dictCtx;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LZ4_STREAMHC_MINSIZE 262200 /* static size, for inter-version compatibility */
|
||||||
|
union LZ4_streamHC_u {
|
||||||
|
char minStateSize[LZ4_STREAMHC_MINSIZE];
|
||||||
|
LZ4HC_CCtx_internal internal_donotuse;
|
||||||
|
}; /* previously typedef'd to LZ4_streamHC_t */
|
||||||
|
|
||||||
|
/* LZ4_streamHC_t :
|
||||||
|
* This structure allows static allocation of LZ4 HC streaming state.
|
||||||
|
* This can be used to allocate statically on stack, or as part of a larger structure.
|
||||||
|
*
|
||||||
|
* Such state **must** be initialized using LZ4_initStreamHC() before first use.
|
||||||
|
*
|
||||||
|
* Note that invoking LZ4_initStreamHC() is not required when
|
||||||
|
* the state was created using LZ4_createStreamHC() (which is recommended).
|
||||||
|
* Using the normal builder, a newly created state is automatically initialized.
|
||||||
|
*
|
||||||
|
* Static allocation shall only be used in combination with static linking.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* LZ4_initStreamHC() : v1.9.0+
|
||||||
|
* Required before first use of a statically allocated LZ4_streamHC_t.
|
||||||
|
* Before v1.9.0 : use LZ4_resetStreamHC() instead
|
||||||
|
*/
|
||||||
|
LZ4LIB_API LZ4_streamHC_t* LZ4_initStreamHC(void* buffer, size_t size);
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Deprecated Functions
|
||||||
|
**************************************/
|
||||||
|
/* see lz4.h LZ4_DISABLE_DEPRECATE_WARNINGS to turn off deprecation warnings */
|
||||||
|
|
||||||
|
/* deprecated compression functions */
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC (const char* source, char* dest, int inputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||||
|
|
||||||
|
/* Obsolete streaming functions; degraded functionality; do not use!
|
||||||
|
*
|
||||||
|
* In order to perform streaming compression, these functions depended on data
|
||||||
|
* that is no longer tracked in the state. They have been preserved as well as
|
||||||
|
* possible: using them will still produce a correct output. However, use of
|
||||||
|
* LZ4_slideInputBufferHC() will truncate the history of the stream, rather
|
||||||
|
* than preserve a window-sized chunk of history.
|
||||||
|
*/
|
||||||
|
#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
|
||||||
|
LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API void* LZ4_createHC (const char* inputBuffer);
|
||||||
|
LZ4_DEPRECATED("use LZ4_freeStreamHC() instead") LZ4LIB_API int LZ4_freeHC (void* LZ4HC_Data);
|
||||||
|
#endif
|
||||||
|
LZ4_DEPRECATED("use LZ4_saveDictHC() instead") LZ4LIB_API char* LZ4_slideInputBufferHC (void* LZ4HC_Data);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel);
|
||||||
|
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
||||||
|
LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API int LZ4_sizeofStreamStateHC(void);
|
||||||
|
LZ4_DEPRECATED("use LZ4_initStreamHC() instead") LZ4LIB_API int LZ4_resetStreamStateHC(void* state, char* inputBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
/* LZ4_resetStreamHC() is now replaced by LZ4_initStreamHC().
|
||||||
|
* The intention is to emphasize the difference with LZ4_resetStreamHC_fast(),
|
||||||
|
* which is now the recommended function to start a new stream of blocks,
|
||||||
|
* but cannot be used to initialize a memory segment containing arbitrary garbage data.
|
||||||
|
*
|
||||||
|
* It is recommended to switch to LZ4_initStreamHC().
|
||||||
|
* LZ4_resetStreamHC() will generate deprecation warnings in a future version.
|
||||||
|
*/
|
||||||
|
LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel);
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LZ4_HC_H_19834876238432 */
|
||||||
|
|
||||||
|
|
||||||
|
/*-**************************************************
|
||||||
|
* !!!!! STATIC LINKING ONLY !!!!!
|
||||||
|
* Following definitions are considered experimental.
|
||||||
|
* They should not be linked from DLL,
|
||||||
|
* as there is no guarantee of API stability yet.
|
||||||
|
* Prototypes will be promoted to "stable" status
|
||||||
|
* after successful usage in real-life scenarios.
|
||||||
|
***************************************************/
|
||||||
|
#ifdef LZ4_HC_STATIC_LINKING_ONLY /* protection macro */
|
||||||
|
#ifndef LZ4_HC_SLO_098092834
|
||||||
|
#define LZ4_HC_SLO_098092834
|
||||||
|
|
||||||
|
#define LZ4_STATIC_LINKING_ONLY /* LZ4LIB_STATIC_API */
|
||||||
|
#include "lz4.h"
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! LZ4_setCompressionLevel() : v1.8.0+ (experimental)
|
||||||
|
* It's possible to change compression level
|
||||||
|
* between successive invocations of LZ4_compress_HC_continue*()
|
||||||
|
* for dynamic adaptation.
|
||||||
|
*/
|
||||||
|
LZ4LIB_STATIC_API void LZ4_setCompressionLevel(
|
||||||
|
LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
|
||||||
|
|
||||||
|
/*! LZ4_favorDecompressionSpeed() : v1.8.2+ (experimental)
|
||||||
|
* Opt. Parser will favor decompression speed over compression ratio.
|
||||||
|
* Only applicable to levels >= LZ4HC_CLEVEL_OPT_MIN.
|
||||||
|
*/
|
||||||
|
LZ4LIB_STATIC_API void LZ4_favorDecompressionSpeed(
|
||||||
|
LZ4_streamHC_t* LZ4_streamHCPtr, int favor);
|
||||||
|
|
||||||
|
/*! LZ4_resetStreamHC_fast() : v1.9.0+
|
||||||
|
* When an LZ4_streamHC_t is known to be in a internally coherent state,
|
||||||
|
* it can often be prepared for a new compression with almost no work, only
|
||||||
|
* sometimes falling back to the full, expensive reset that is always required
|
||||||
|
* when the stream is in an indeterminate state (i.e., the reset performed by
|
||||||
|
* LZ4_resetStreamHC()).
|
||||||
|
*
|
||||||
|
* LZ4_streamHCs are guaranteed to be in a valid state when:
|
||||||
|
* - returned from LZ4_createStreamHC()
|
||||||
|
* - reset by LZ4_resetStreamHC()
|
||||||
|
* - memset(stream, 0, sizeof(LZ4_streamHC_t))
|
||||||
|
* - the stream was in a valid state and was reset by LZ4_resetStreamHC_fast()
|
||||||
|
* - the stream was in a valid state and was then used in any compression call
|
||||||
|
* that returned success
|
||||||
|
* - the stream was in an indeterminate state and was used in a compression
|
||||||
|
* call that fully reset the state (LZ4_compress_HC_extStateHC()) and that
|
||||||
|
* returned success
|
||||||
|
*
|
||||||
|
* Note:
|
||||||
|
* A stream that was last used in a compression call that returned an error
|
||||||
|
* may be passed to this function. However, it will be fully reset, which will
|
||||||
|
* clear any existing history and settings from the context.
|
||||||
|
*/
|
||||||
|
LZ4LIB_STATIC_API void LZ4_resetStreamHC_fast(
|
||||||
|
LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
|
||||||
|
|
||||||
|
/*! LZ4_compress_HC_extStateHC_fastReset() :
|
||||||
|
* A variant of LZ4_compress_HC_extStateHC().
|
||||||
|
*
|
||||||
|
* Using this variant avoids an expensive initialization step. It is only safe
|
||||||
|
* to call if the state buffer is known to be correctly initialized already
|
||||||
|
* (see above comment on LZ4_resetStreamHC_fast() for a definition of
|
||||||
|
* "correctly initialized"). From a high level, the difference is that this
|
||||||
|
* function initializes the provided state with a call to
|
||||||
|
* LZ4_resetStreamHC_fast() while LZ4_compress_HC_extStateHC() starts with a
|
||||||
|
* call to LZ4_resetStreamHC().
|
||||||
|
*/
|
||||||
|
LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset (
|
||||||
|
void* state,
|
||||||
|
const char* src, char* dst,
|
||||||
|
int srcSize, int dstCapacity,
|
||||||
|
int compressionLevel);
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LZ4_HC_SLO_098092834 */
|
||||||
|
#endif /* LZ4_HC_STATIC_LINKING_ONLY */
|
||||||
9
kernel/lz4/src.mk
Normal file
9
kernel/lz4/src.mk
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
c += lz4/lz4.c \
|
||||||
|
lz4/lz4frame.c \
|
||||||
|
lz4/lz4hc.c \
|
||||||
|
lz4/xxhash.c
|
||||||
|
|
||||||
|
o += lz4/lz4.o \
|
||||||
|
lz4/lz4frame.o \
|
||||||
|
lz4/lz4hc.o \
|
||||||
|
lz4/xxhash.o
|
||||||
1049
kernel/lz4/xxhash.c
Normal file
1049
kernel/lz4/xxhash.c
Normal file
File diff suppressed because it is too large
Load Diff
330
kernel/lz4/xxhash.h
Normal file
330
kernel/lz4/xxhash.h
Normal file
@@ -0,0 +1,330 @@
|
|||||||
|
/*
|
||||||
|
xxHash - Extremely Fast Hash algorithm
|
||||||
|
Header File
|
||||||
|
Copyright (C) 2012-2016, Yann Collet.
|
||||||
|
|
||||||
|
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||||
|
|
||||||
|
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
|
||||||
|
OWNER 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 :
|
||||||
|
- xxHash source repository : https://github.com/Cyan4973/xxHash
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Notice extracted from xxHash homepage :
|
||||||
|
|
||||||
|
xxHash is an extremely fast Hash algorithm, running at RAM speed limits.
|
||||||
|
It also successfully passes all tests from the SMHasher suite.
|
||||||
|
|
||||||
|
Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz)
|
||||||
|
|
||||||
|
Name Speed Q.Score Author
|
||||||
|
xxHash 5.4 GB/s 10
|
||||||
|
CrapWow 3.2 GB/s 2 Andrew
|
||||||
|
MumurHash 3a 2.7 GB/s 10 Austin Appleby
|
||||||
|
SpookyHash 2.0 GB/s 10 Bob Jenkins
|
||||||
|
SBox 1.4 GB/s 9 Bret Mulvey
|
||||||
|
Lookup3 1.2 GB/s 9 Bob Jenkins
|
||||||
|
SuperFastHash 1.2 GB/s 1 Paul Hsieh
|
||||||
|
CityHash64 1.05 GB/s 10 Pike & Alakuijala
|
||||||
|
FNV 0.55 GB/s 5 Fowler, Noll, Vo
|
||||||
|
CRC32 0.43 GB/s 9
|
||||||
|
MD5-32 0.33 GB/s 10 Ronald L. Rivest
|
||||||
|
SHA1-32 0.28 GB/s 10
|
||||||
|
|
||||||
|
Q.Score is a measure of quality of the hash function.
|
||||||
|
It depends on successfully passing SMHasher test set.
|
||||||
|
10 is a perfect score.
|
||||||
|
|
||||||
|
A 64-bit version, named XXH64, is available since r35.
|
||||||
|
It offers much better speed, but for 64-bit applications only.
|
||||||
|
Name Speed on 64 bits Speed on 32 bits
|
||||||
|
XXH64 13.8 GB/s 1.9 GB/s
|
||||||
|
XXH32 6.8 GB/s 6.0 GB/s
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XXHASH_H_5627135585666179
|
||||||
|
#define XXHASH_H_5627135585666179 1
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ****************************
|
||||||
|
* Definitions
|
||||||
|
******************************/
|
||||||
|
#include <stddef.h> /* size_t */
|
||||||
|
typedef enum { XXH_OK = 0, XXH_ERROR } XXH_errorcode;
|
||||||
|
|
||||||
|
/* ****************************
|
||||||
|
* API modifier
|
||||||
|
******************************/
|
||||||
|
/** XXH_INLINE_ALL (and XXH_PRIVATE_API)
|
||||||
|
* This is useful to include xxhash functions in `static` mode
|
||||||
|
* in order to inline them, and remove their symbol from the public list.
|
||||||
|
* Inlining can offer dramatic performance improvement on small keys.
|
||||||
|
* Methodology :
|
||||||
|
* #define XXH_INLINE_ALL
|
||||||
|
* #include "xxhash.h"
|
||||||
|
* `xxhash.c` is automatically included.
|
||||||
|
* It's not useful to compile and link it as a separate module.
|
||||||
|
*/
|
||||||
|
#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)
|
||||||
|
#ifndef XXH_STATIC_LINKING_ONLY
|
||||||
|
#define XXH_STATIC_LINKING_ONLY
|
||||||
|
#endif
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define XXH_PUBLIC_API static __inline __attribute__ ((unused))
|
||||||
|
#elif defined(__cplusplus) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 \
|
||||||
|
*/)
|
||||||
|
#define XXH_PUBLIC_API static inline
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#define XXH_PUBLIC_API static __inline
|
||||||
|
#else
|
||||||
|
/* this version may generate warnings for unused static functions */
|
||||||
|
#define XXH_PUBLIC_API static
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define XXH_PUBLIC_API /* do nothing */
|
||||||
|
#endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */
|
||||||
|
|
||||||
|
/*! XXH_NAMESPACE, aka Namespace Emulation :
|
||||||
|
*
|
||||||
|
* If you want to include _and expose_ xxHash functions from within your own library,
|
||||||
|
* but also want to avoid symbol collisions with other libraries which may also include xxHash,
|
||||||
|
*
|
||||||
|
* you can use XXH_NAMESPACE, to automatically prefix any public symbol from xxhash library
|
||||||
|
* with the value of XXH_NAMESPACE (therefore, avoid NULL and numeric values).
|
||||||
|
*
|
||||||
|
* Note that no change is required within the calling program as long as it includes `xxhash.h` :
|
||||||
|
* regular symbol name will be automatically translated by this header.
|
||||||
|
*/
|
||||||
|
#ifdef XXH_NAMESPACE
|
||||||
|
#define XXH_CAT(A, B) A##B
|
||||||
|
#define XXH_NAME2(A, B) XXH_CAT (A, B)
|
||||||
|
#define XXH_versionNumber XXH_NAME2 (XXH_NAMESPACE, XXH_versionNumber)
|
||||||
|
#define XXH32 XXH_NAME2 (XXH_NAMESPACE, XXH32)
|
||||||
|
#define XXH32_createState XXH_NAME2 (XXH_NAMESPACE, XXH32_createState)
|
||||||
|
#define XXH32_freeState XXH_NAME2 (XXH_NAMESPACE, XXH32_freeState)
|
||||||
|
#define XXH32_reset XXH_NAME2 (XXH_NAMESPACE, XXH32_reset)
|
||||||
|
#define XXH32_update XXH_NAME2 (XXH_NAMESPACE, XXH32_update)
|
||||||
|
#define XXH32_digest XXH_NAME2 (XXH_NAMESPACE, XXH32_digest)
|
||||||
|
#define XXH32_copyState XXH_NAME2 (XXH_NAMESPACE, XXH32_copyState)
|
||||||
|
#define XXH32_canonicalFromHash XXH_NAME2 (XXH_NAMESPACE, XXH32_canonicalFromHash)
|
||||||
|
#define XXH32_hashFromCanonical XXH_NAME2 (XXH_NAMESPACE, XXH32_hashFromCanonical)
|
||||||
|
#define XXH64 XXH_NAME2 (XXH_NAMESPACE, XXH64)
|
||||||
|
#define XXH64_createState XXH_NAME2 (XXH_NAMESPACE, XXH64_createState)
|
||||||
|
#define XXH64_freeState XXH_NAME2 (XXH_NAMESPACE, XXH64_freeState)
|
||||||
|
#define XXH64_reset XXH_NAME2 (XXH_NAMESPACE, XXH64_reset)
|
||||||
|
#define XXH64_update XXH_NAME2 (XXH_NAMESPACE, XXH64_update)
|
||||||
|
#define XXH64_digest XXH_NAME2 (XXH_NAMESPACE, XXH64_digest)
|
||||||
|
#define XXH64_copyState XXH_NAME2 (XXH_NAMESPACE, XXH64_copyState)
|
||||||
|
#define XXH64_canonicalFromHash XXH_NAME2 (XXH_NAMESPACE, XXH64_canonicalFromHash)
|
||||||
|
#define XXH64_hashFromCanonical XXH_NAME2 (XXH_NAMESPACE, XXH64_hashFromCanonical)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* *************************************
|
||||||
|
* Version
|
||||||
|
***************************************/
|
||||||
|
#define XXH_VERSION_MAJOR 0
|
||||||
|
#define XXH_VERSION_MINOR 6
|
||||||
|
#define XXH_VERSION_RELEASE 5
|
||||||
|
#define XXH_VERSION_NUMBER \
|
||||||
|
(XXH_VERSION_MAJOR * 100 * 100 + XXH_VERSION_MINOR * 100 + XXH_VERSION_RELEASE)
|
||||||
|
XXH_PUBLIC_API unsigned XXH_versionNumber (void);
|
||||||
|
|
||||||
|
/*-**********************************************************************
|
||||||
|
* 32-bit hash
|
||||||
|
************************************************************************/
|
||||||
|
typedef unsigned int XXH32_hash_t;
|
||||||
|
|
||||||
|
/*! XXH32() :
|
||||||
|
Calculate the 32-bit hash of sequence "length" bytes stored at memory address "input".
|
||||||
|
The memory between input & input+length must be valid (allocated and read-accessible).
|
||||||
|
"seed" can be used to alter the result predictably.
|
||||||
|
Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s */
|
||||||
|
XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, unsigned int seed);
|
||||||
|
|
||||||
|
/*====== Streaming ======*/
|
||||||
|
typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */
|
||||||
|
XXH_PUBLIC_API XXH32_state_t* XXH32_createState (void);
|
||||||
|
XXH_PUBLIC_API XXH_errorcode XXH32_freeState (XXH32_state_t* statePtr);
|
||||||
|
XXH_PUBLIC_API void XXH32_copyState (XXH32_state_t* dst_state, const XXH32_state_t* src_state);
|
||||||
|
|
||||||
|
XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned int seed);
|
||||||
|
XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input,
|
||||||
|
size_t length);
|
||||||
|
XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Streaming functions generate the xxHash of an input provided in multiple segments.
|
||||||
|
* Note that, for small input, they are slower than single-call functions, due to state management.
|
||||||
|
* For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized.
|
||||||
|
*
|
||||||
|
* XXH state must first be allocated, using XXH*_createState() .
|
||||||
|
*
|
||||||
|
* Start a new hash by initializing state with a seed, using XXH*_reset().
|
||||||
|
*
|
||||||
|
* Then, feed the hash state by calling XXH*_update() as many times as necessary.
|
||||||
|
* The function returns an error code, with 0 meaning OK, and any other value meaning there is an
|
||||||
|
* error.
|
||||||
|
*
|
||||||
|
* Finally, a hash value can be produced anytime, by using XXH*_digest().
|
||||||
|
* This function returns the nn-bits hash as an int or long long.
|
||||||
|
*
|
||||||
|
* It's still possible to continue inserting input into the hash state after a digest,
|
||||||
|
* and generate some new hashes later on, by calling again XXH*_digest().
|
||||||
|
*
|
||||||
|
* When done, free XXH state space if it was allocated dynamically.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*====== Canonical representation ======*/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned char digest[4];
|
||||||
|
} XXH32_canonical_t;
|
||||||
|
XXH_PUBLIC_API void XXH32_canonicalFromHash (XXH32_canonical_t* dst, XXH32_hash_t hash);
|
||||||
|
XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical (const XXH32_canonical_t* src);
|
||||||
|
|
||||||
|
/* Default result type for XXH functions are primitive unsigned 32 and 64 bits.
|
||||||
|
* The canonical representation uses human-readable write convention, aka big-endian (large digits
|
||||||
|
* first). These functions allow transformation of hash result into and from its canonical format.
|
||||||
|
* This way, hash values can be written into a file / memory, and remain comparable on different
|
||||||
|
* systems and programs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XXH_NO_LONG_LONG
|
||||||
|
/*-**********************************************************************
|
||||||
|
* 64-bit hash
|
||||||
|
************************************************************************/
|
||||||
|
typedef unsigned long long XXH64_hash_t;
|
||||||
|
|
||||||
|
/*! XXH64() :
|
||||||
|
Calculate the 64-bit hash of sequence of length "len" stored at memory address "input".
|
||||||
|
"seed" can be used to alter the result predictably.
|
||||||
|
This function runs faster on 64-bit systems, but slower on 32-bit systems (see benchmark).
|
||||||
|
*/
|
||||||
|
XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed);
|
||||||
|
|
||||||
|
/*====== Streaming ======*/
|
||||||
|
typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */
|
||||||
|
XXH_PUBLIC_API XXH64_state_t* XXH64_createState (void);
|
||||||
|
XXH_PUBLIC_API XXH_errorcode XXH64_freeState (XXH64_state_t* statePtr);
|
||||||
|
XXH_PUBLIC_API void XXH64_copyState (XXH64_state_t* dst_state, const XXH64_state_t* src_state);
|
||||||
|
|
||||||
|
XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed);
|
||||||
|
XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input,
|
||||||
|
size_t length);
|
||||||
|
XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr);
|
||||||
|
|
||||||
|
/*====== Canonical representation ======*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned char digest[8];
|
||||||
|
} XXH64_canonical_t;
|
||||||
|
XXH_PUBLIC_API void XXH64_canonicalFromHash (XXH64_canonical_t* dst, XXH64_hash_t hash);
|
||||||
|
XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical (const XXH64_canonical_t* src);
|
||||||
|
#endif /* XXH_NO_LONG_LONG */
|
||||||
|
|
||||||
|
#ifdef XXH_STATIC_LINKING_ONLY
|
||||||
|
|
||||||
|
/* ================================================================================================
|
||||||
|
This section contains declarations which are not guaranteed to remain stable.
|
||||||
|
They may change in future versions, becoming incompatible with a different version of the
|
||||||
|
library. These declarations should only be used with static linking. Never use them in association
|
||||||
|
with dynamic linking !
|
||||||
|
===================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* These definitions are only present to allow
|
||||||
|
* static allocation of XXH state, on stack or in a struct for example.
|
||||||
|
* Never **ever** use members directly. */
|
||||||
|
|
||||||
|
#if !defined(__VMS) && \
|
||||||
|
(defined(__cplusplus) || \
|
||||||
|
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */))
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
struct XXH32_state_s {
|
||||||
|
uint32_t total_len_32;
|
||||||
|
uint32_t large_len;
|
||||||
|
uint32_t v1;
|
||||||
|
uint32_t v2;
|
||||||
|
uint32_t v3;
|
||||||
|
uint32_t v4;
|
||||||
|
uint32_t mem32[4];
|
||||||
|
uint32_t memsize;
|
||||||
|
uint32_t reserved; /* never read nor write, might be removed in a future version */
|
||||||
|
}; /* typedef'd to XXH32_state_t */
|
||||||
|
|
||||||
|
struct XXH64_state_s {
|
||||||
|
uint64_t total_len;
|
||||||
|
uint64_t v1;
|
||||||
|
uint64_t v2;
|
||||||
|
uint64_t v3;
|
||||||
|
uint64_t v4;
|
||||||
|
uint64_t mem64[4];
|
||||||
|
uint32_t memsize;
|
||||||
|
uint32_t reserved[2]; /* never read nor write, might be removed in a future version */
|
||||||
|
}; /* typedef'd to XXH64_state_t */
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
struct XXH32_state_s {
|
||||||
|
unsigned total_len_32;
|
||||||
|
unsigned large_len;
|
||||||
|
unsigned v1;
|
||||||
|
unsigned v2;
|
||||||
|
unsigned v3;
|
||||||
|
unsigned v4;
|
||||||
|
unsigned mem32[4];
|
||||||
|
unsigned memsize;
|
||||||
|
unsigned reserved; /* never read nor write, might be removed in a future version */
|
||||||
|
}; /* typedef'd to XXH32_state_t */
|
||||||
|
|
||||||
|
#ifndef XXH_NO_LONG_LONG /* remove 64-bit support */
|
||||||
|
struct XXH64_state_s {
|
||||||
|
unsigned long long total_len;
|
||||||
|
unsigned long long v1;
|
||||||
|
unsigned long long v2;
|
||||||
|
unsigned long long v3;
|
||||||
|
unsigned long long v4;
|
||||||
|
unsigned long long mem64[4];
|
||||||
|
unsigned memsize;
|
||||||
|
unsigned reserved[2]; /* never read nor write, might be removed in a future version */
|
||||||
|
}; /* typedef'd to XXH64_state_t */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)
|
||||||
|
#include "xxhash.c" /* include xxhash function bodies as `static`, for inlining */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* XXH_STATIC_LINKING_ONLY */
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* XXHASH_H_5627135585666179 */
|
||||||
@@ -10,6 +10,7 @@ include fs/src.mk
|
|||||||
include device/src.mk
|
include device/src.mk
|
||||||
include Flanterm/src.mk
|
include Flanterm/src.mk
|
||||||
include id/src.mk
|
include id/src.mk
|
||||||
|
include lz4/src.mk
|
||||||
|
|
||||||
ifeq ($(PLATFORM_ACPI),1)
|
ifeq ($(PLATFORM_ACPI),1)
|
||||||
include uACPI/src.mk
|
include uACPI/src.mk
|
||||||
|
|||||||
70
lz4/.circleci/config.yml
Normal file
70
lz4/.circleci/config.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# This configuration was automatically generated from a CircleCI 1.0 config.
|
||||||
|
# It should include any build commands you had along with commands that CircleCI
|
||||||
|
# inferred from your project structure. We strongly recommend you read all the
|
||||||
|
# comments in this file to understand the structure of CircleCI 2.0, as the idiom
|
||||||
|
# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather
|
||||||
|
# than the prescribed lifecycle of 1.0. In general, we recommend using this generated
|
||||||
|
# configuration as a reference rather than using it in production, though in most
|
||||||
|
# cases it should duplicate the execution of your original 1.0 config.
|
||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
working_directory: ~/lz4/lz4
|
||||||
|
# Parallelism is broken in this file : it just plays the same tests twice.
|
||||||
|
# The script will have to be modified to support parallelism properly
|
||||||
|
# In the meantime, set it to 1.
|
||||||
|
parallelism: 1
|
||||||
|
shell: /bin/bash --login
|
||||||
|
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did.
|
||||||
|
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables .
|
||||||
|
environment:
|
||||||
|
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||||
|
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||||
|
# In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages.
|
||||||
|
# In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images.
|
||||||
|
# The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job.
|
||||||
|
# We have selected a pre-built image that mirrors the build environment we use on
|
||||||
|
# the 1.0 platform, but we recommend you choose an image more tailored to the needs
|
||||||
|
# of each job. For more information on choosing an image (or alternatively using a
|
||||||
|
# VM instead of a container) see https://circleci.com/docs/2.0/executor-types/
|
||||||
|
# To see the list of pre-built images that CircleCI provides for most common languages see
|
||||||
|
# https://circleci.com/docs/2.0/circleci-images/
|
||||||
|
docker:
|
||||||
|
- image: fbopensource/lz4-circleci-primary:0.0.4
|
||||||
|
steps:
|
||||||
|
# Machine Setup
|
||||||
|
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||||
|
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
||||||
|
- checkout
|
||||||
|
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
|
||||||
|
# In many cases you can simplify this from what is generated here.
|
||||||
|
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
|
||||||
|
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
||||||
|
# Test
|
||||||
|
# This would typically be a build job when using workflows, possibly combined with build
|
||||||
|
# This is based on your 1.0 configuration file or project settings
|
||||||
|
- run: CC=clang CFLAGS="-Werror -O0" make all && make clean
|
||||||
|
- run: c++ -v; make cxxtest V=1 && make clean
|
||||||
|
- run: cc -v; c++ -v; make ctocxxtest && make clean
|
||||||
|
- run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -Werror" make check && make clean
|
||||||
|
- run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean
|
||||||
|
- run: gcc-6 -v; CC=gcc-6 CFLAGS="-O2 -Werror" make check && make clean
|
||||||
|
- run: make cmakebuild && make clean
|
||||||
|
- run: make -C tests test-lz4
|
||||||
|
- run: make -C tests test-lz4c
|
||||||
|
- run: make -C tests test-frametest
|
||||||
|
- run: make -C tests test-fuzzer && make clean
|
||||||
|
- run: make -C lib all && make clean
|
||||||
|
- run: pyenv global 3.14; CPPFLAGS=-I/usr/include/x86_64-linux-gnu make versionsTest && make clean
|
||||||
|
- run: make test-install && make clean
|
||||||
|
- run: gcc -v; CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean
|
||||||
|
# Teardown
|
||||||
|
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||||
|
# Save test results
|
||||||
|
- store_test_results:
|
||||||
|
path: /tmp/circleci-test-results
|
||||||
|
# Save artifacts
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-artifacts
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-test-results
|
||||||
12
lz4/.circleci/images/primary/Dockerfile
Normal file
12
lz4/.circleci/images/primary/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM circleci/buildpack-deps:bionic
|
||||||
|
|
||||||
|
RUN sudo apt-get -y -qq update
|
||||||
|
RUN sudo apt-get -y install software-properties-common
|
||||||
|
RUN sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
|
RUN sudo apt-get -y install cmake
|
||||||
|
RUN sudo apt-get -y install qemu-system-ppc qemu-user-static qemu-system-arm
|
||||||
|
RUN sudo apt-get -y install libc6-dev-armel-cross libc6-dev-arm64-cross libc6-dev-i386
|
||||||
|
RUN sudo apt-get -y install clang clang-tools
|
||||||
|
RUN sudo apt-get -y install gcc-5 gcc-5-multilib gcc-6
|
||||||
|
RUN sudo apt-get -y install valgrind
|
||||||
|
RUN sudo apt-get -y install gcc-multilib-powerpc-linux-gnu gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu
|
||||||
9
lz4/.cirrus.yml
Normal file
9
lz4/.cirrus.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
task:
|
||||||
|
name: FreeBSD
|
||||||
|
freebsd_instance:
|
||||||
|
matrix:
|
||||||
|
image_family: freebsd-15-0-amd64-zfs
|
||||||
|
install_script: pkg install -y gmake
|
||||||
|
script: |
|
||||||
|
cc -v
|
||||||
|
gmake test
|
||||||
132
lz4/.clang-format
Normal file
132
lz4/.clang-format
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
# This is the configuration file for clang-format, an automatic code formatter.
|
||||||
|
# Introduction: https://clang.llvm.org/docs/ClangFormat.html
|
||||||
|
# Supported options: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||||
|
|
||||||
|
Language: Cpp
|
||||||
|
Standard: Latest
|
||||||
|
|
||||||
|
ColumnLimit: 110
|
||||||
|
|
||||||
|
UseTab: Never
|
||||||
|
IndentWidth: 4
|
||||||
|
PPIndentWidth: 2
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
|
||||||
|
LineEnding: LF
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentGotoLabels: false
|
||||||
|
IndentPPDirectives: AfterHash
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignArrayOfStructures: Right
|
||||||
|
AlignEscapedNewlines: Left
|
||||||
|
AlignOperands: Align
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignTrailingComments:
|
||||||
|
Kind: Leave
|
||||||
|
OverEmptyLines: 0
|
||||||
|
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: false
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
AfterFunction: true
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
BreakAfterAttributes: Never
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BreakBeforeInlineASMColon: OnlyMultiline
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
PointerAlignment: Left
|
||||||
|
|
||||||
|
QualifierAlignment: Custom
|
||||||
|
QualifierOrder: ["inline", "static", "volatile", "restrict", "const", "type"]
|
||||||
|
|
||||||
|
ReflowComments: false
|
||||||
|
BreakStringLiterals: false
|
||||||
|
RemoveSemicolon: true
|
||||||
|
RemoveParentheses: ReturnStatement
|
||||||
|
InsertBraces: false
|
||||||
|
SeparateDefinitionBlocks: Always
|
||||||
|
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
|
||||||
|
SortIncludes: Never
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeIsMainRegex: ""
|
||||||
|
IncludeCategories:
|
||||||
|
- {Regex: "<.*>", Priority: -2, CaseSensitive: true}
|
||||||
|
- {Regex: "\".*\"", Priority: -1, CaseSensitive: true}
|
||||||
|
|
||||||
|
AttributeMacros: ["__capability"]
|
||||||
|
StatementAttributeLikeMacros: []
|
||||||
|
StatementMacros: []
|
||||||
|
|
||||||
|
PenaltyBreakAssignment: 200
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyExcessCharacter: 10
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
21
lz4/.gitattributes
vendored
Normal file
21
lz4/.gitattributes
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Set the default behavior
|
||||||
|
* text eol=lf
|
||||||
|
|
||||||
|
# Explicitly declare source files
|
||||||
|
*.c text eol=lf
|
||||||
|
*.h text eol=lf
|
||||||
|
|
||||||
|
# Denote files that should not be modified.
|
||||||
|
*.odt binary
|
||||||
|
*.png binary
|
||||||
|
|
||||||
|
# Visual Studio
|
||||||
|
*.sln text eol=crlf
|
||||||
|
*.vcxproj* text eol=crlf
|
||||||
|
*.vcproj* text eol=crlf
|
||||||
|
*.suo binary
|
||||||
|
*.rc text eol=crlf
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
32
lz4/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
32
lz4/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
Please describe what you expected to happen.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error '...'
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**System (please complete the following information):**
|
||||||
|
- OS: [e.g. Mac]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
- Compiler [e.g. gcc]
|
||||||
|
- Build System [e.g. Makefile]
|
||||||
|
- Other hardware specs [e.g. Core 2 duo...]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
lz4/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
lz4/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
7
lz4/.github/dependabot.yaml
vendored
Normal file
7
lz4/.github/dependabot.yaml
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
56
lz4/.github/workflows/README.md
vendored
Normal file
56
lz4/.github/workflows/README.md
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
This directory contains [GitHub Actions](https://github.com/features/actions) workflow files.
|
||||||
|
|
||||||
|
# Workflow Organization
|
||||||
|
|
||||||
|
The CI/CD workflows are organized into focused, maintainable files:
|
||||||
|
|
||||||
|
## Core Testing Workflows
|
||||||
|
- **`compilers.yml`** - Tests compatibility across different C compilers (GCC, Clang versions)
|
||||||
|
- **`core-tests.yml`** - Core LZ4 functionality testing (benchmarks, fuzzing, frame format, ABI compatibility, etc.)
|
||||||
|
- **`sanitizers.yml`** - Memory safety testing (AddressSanitizer, MemorySanitizer, UBSan, ThreadSanitizer)
|
||||||
|
|
||||||
|
## Platform & Build System Testing
|
||||||
|
- **`cross-platform.yml`** - Cross-platform testing using QEMU emulation and native macOS builds
|
||||||
|
- **`build-systems.yml`** - Alternative build systems (Visual Studio, Meson)
|
||||||
|
- **`cmake-test.yml`** - CMake build system testing
|
||||||
|
|
||||||
|
## Code Quality & Analysis
|
||||||
|
- **`code-quality.yml`** - Static analysis tools (cppcheck, scan-build, valgrind, unicode lint)
|
||||||
|
- **`oss-fuzz.yml`** - OSS-Fuzz integration for continuous fuzzing
|
||||||
|
|
||||||
|
## Utilities & Environment
|
||||||
|
- **`release-environment.yml`** - Release validation and environment information gathering
|
||||||
|
- **`scorecard.yml`** - Security scorecard analysis
|
||||||
|
|
||||||
|
This organization provides:
|
||||||
|
- **Better maintainability** - Changes to specific test categories only affect relevant files
|
||||||
|
- **Improved parallelization** - Workflows run independently and in parallel
|
||||||
|
- **Clearer failure isolation** - Easier to identify which types of tests are failing
|
||||||
|
- **Enhanced readability** - Each workflow has a single, clear responsibility
|
||||||
|
|
||||||
|
# Known issues
|
||||||
|
|
||||||
|
## Sanitizers (UBSan, ASan) - `sanitizers.yml`
|
||||||
|
|
||||||
|
### UBSan (UndefinedBehaviorSanitizer)
|
||||||
|
For now, UBSan tests use the `-fsanitize-recover=pointer-overflow` flag:
|
||||||
|
there are known cases of pointer overflow arithmetic within `lz4.c` fast compression.
|
||||||
|
These cases are not dangerous with known architecture,
|
||||||
|
but they are not guaranteed to work by the C standard,
|
||||||
|
which means that, in some future, some new architecture or some new compiler
|
||||||
|
may decide to do something funny that could break this behavior.
|
||||||
|
Hence, in anticipation, it's better to remove them.
|
||||||
|
This has been already achieved in `lz4hc.c`.
|
||||||
|
However, the same attempt in `lz4.c` resulted in massive speed losses,
|
||||||
|
which is not an acceptable cost for preemptively solving a "potential future" problem
|
||||||
|
not active anywhere today.
|
||||||
|
Therefore, a more acceptable work-around will have to be found first.
|
||||||
|
|
||||||
|
|
||||||
|
## cppcheck - `code-quality.yml`
|
||||||
|
|
||||||
|
This test script ignores the exit code of `make cppcheck`.
|
||||||
|
Because this project doesn't 100% follow their recommendation.
|
||||||
|
Also sometimes it reports false positives.
|
||||||
|
|
||||||
|
|
||||||
109
lz4/.github/workflows/build-systems.yml
vendored
Normal file
109
lz4/.github/workflows/build-systems.yml
vendored
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# Build system testing (Visual Studio, Meson)
|
||||||
|
name: Build Systems
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
windows-visual-studio:
|
||||||
|
name: ${{ matrix.system.os }} Visual Studio
|
||||||
|
runs-on: ${{ matrix.system.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
system:
|
||||||
|
- { os: windows-2022, build_path: ".\\build\\VS2022" }
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Build Win32 Debug
|
||||||
|
# Switching to debug mode, since vs2022 optimizations seem to introduce a bug since July 2024
|
||||||
|
run: |
|
||||||
|
pushd ${{ matrix.system.build_path }}
|
||||||
|
.\\build-and-test-win32-debug.bat
|
||||||
|
popd
|
||||||
|
|
||||||
|
- name: Build x64 Debug
|
||||||
|
# Switching to debug mode, since vs2022 optimizations seem to introduce a bug since July 2024
|
||||||
|
run: |
|
||||||
|
pushd ${{ matrix.system.build_path }}
|
||||||
|
.\\build-and-test-x64-debug.bat
|
||||||
|
popd
|
||||||
|
|
||||||
|
- name: Generate VS solution
|
||||||
|
run: |
|
||||||
|
pushd ".\\build\\visual"
|
||||||
|
.\\generate_vs2022.cmd
|
||||||
|
popd
|
||||||
|
|
||||||
|
- name: Upload generated VS2022 directory
|
||||||
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||||
|
with:
|
||||||
|
name: VS2022-Build-Dir
|
||||||
|
path: "build/visual/Visual Studio 17 2022"
|
||||||
|
|
||||||
|
- name: Build executable with generated solution
|
||||||
|
run: cmake --build "build/visual/Visual Studio 17 2022" --config Debug
|
||||||
|
|
||||||
|
- name: Run minimal runtime test
|
||||||
|
run: |
|
||||||
|
& ".\\build\\visual\\Visual Studio 17 2022\\Debug\\lz4.exe" -vvV
|
||||||
|
& ".\\build\\visual\\Visual Studio 17 2022\\Debug\\lz4.exe" -bi1
|
||||||
|
& ".\\build\\visual\\Visual Studio 17 2022\\Debug\\lz4.exe" ".\\build\\visual\\Visual Studio 17 2022\\Debug\\lz4.exe"
|
||||||
|
& ".\\build\\visual\\Visual Studio 17 2022\\Debug\\lz4.exe" -t ".\\build\\visual\\Visual Studio 17 2022\\Debug\\lz4.exe.lz4"
|
||||||
|
|
||||||
|
meson:
|
||||||
|
name: Meson + Ninja
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install build tools
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install tree ninja-build
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip3 install --user meson
|
||||||
|
|
||||||
|
- name: Display environment info
|
||||||
|
run: |
|
||||||
|
type clang && which clang && clang --version
|
||||||
|
type python && which python && python --version
|
||||||
|
type meson && which meson && meson --version
|
||||||
|
|
||||||
|
- name: Configure build
|
||||||
|
run: >
|
||||||
|
meson setup
|
||||||
|
--fatal-meson-warnings
|
||||||
|
--buildtype=debug
|
||||||
|
-Db_lundef=false
|
||||||
|
-Dauto_features=enabled
|
||||||
|
-Dprograms=true
|
||||||
|
-Dcontrib=true
|
||||||
|
-Dtests=true
|
||||||
|
-Dexamples=true
|
||||||
|
build/meson builddir
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: meson test -C builddir
|
||||||
|
|
||||||
|
- name: Test installation
|
||||||
|
run: |
|
||||||
|
cd builddir
|
||||||
|
DESTDIR=./staging ninja install
|
||||||
|
tree ./staging
|
||||||
127
lz4/.github/workflows/cmake-test.yml
vendored
Normal file
127
lz4/.github/workflows/cmake-test.yml
vendored
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
# Simplified CMake Build Tests
|
||||||
|
name: CMake Build Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ['dev', 'release', '*cmake*']
|
||||||
|
pull_request:
|
||||||
|
branches: ['dev', 'release']
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Core functionality test - multi-platform
|
||||||
|
cmake-core-tests:
|
||||||
|
name: Core Tests (${{ matrix.os }}, ${{ matrix.build_type }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
build_type: Release
|
||||||
|
generator: ""
|
||||||
|
- os: ubuntu-latest
|
||||||
|
build_type: Debug
|
||||||
|
generator: ""
|
||||||
|
- os: windows-latest
|
||||||
|
build_type: Release
|
||||||
|
generator: '-G "Visual Studio 17 2022" -A x64'
|
||||||
|
- os: macos-latest
|
||||||
|
build_type: Release
|
||||||
|
generator: ""
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
|
- name: Set up MSVC (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
uses: microsoft/setup-msbuild@v2
|
||||||
|
|
||||||
|
- name: Set up CMake
|
||||||
|
uses: jwlawson/actions-setup-cmake@v2
|
||||||
|
with:
|
||||||
|
cmake-version: latest
|
||||||
|
|
||||||
|
- name: Configure and Build
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir cmakebuild && cd cmakebuild
|
||||||
|
cmake ../build/cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||||
|
cmake --build . --config ${{ matrix.build_type }}
|
||||||
|
|
||||||
|
- name: Test Installation (Linux only)
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd cmakebuild
|
||||||
|
cmake --install . --prefix install-test
|
||||||
|
test -f "install-test/lib/liblz4.a" || test -f "install-test/lib/liblz4.so"
|
||||||
|
test -f "install-test/include/lz4.h"
|
||||||
|
|
||||||
|
# CMake compatibility and integration tests
|
||||||
|
cmake-extended-tests:
|
||||||
|
name: Extended Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
test_type:
|
||||||
|
- cmake_versions
|
||||||
|
- static_lib
|
||||||
|
- integration
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
|
- name: Set up CMake
|
||||||
|
uses: jwlawson/actions-setup-cmake@v2
|
||||||
|
with:
|
||||||
|
cmake-version: ${{ matrix.test_type == 'cmake_versions' && '3.10.0' || 'latest' }}
|
||||||
|
|
||||||
|
- name: CMake Version Compatibility Test
|
||||||
|
if: matrix.test_type == 'cmake_versions'
|
||||||
|
run: |
|
||||||
|
mkdir cmakebuild && cd cmakebuild
|
||||||
|
cmake ../build/cmake
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
- name: Static Library Test
|
||||||
|
if: matrix.test_type == 'static_lib'
|
||||||
|
run: |
|
||||||
|
# Build and install static library
|
||||||
|
CFLAGS="-Werror -O1" cmake -S build/cmake -B build -DBUILD_STATIC_LIBS=ON -DCMAKE_INSTALL_PREFIX=$PWD/install
|
||||||
|
cmake --build build --target install
|
||||||
|
|
||||||
|
# Test find_package with static library
|
||||||
|
cmake -S tests/cmake -B build_test -DCMAKE_PREFIX_PATH=$PWD/install
|
||||||
|
cmake --build build_test
|
||||||
|
|
||||||
|
- name: Integration Test
|
||||||
|
if: matrix.test_type == 'integration'
|
||||||
|
run: |
|
||||||
|
# Build and install
|
||||||
|
cmake -S build/cmake -B build -DCMAKE_INSTALL_PREFIX=$PWD/install
|
||||||
|
cmake --build build --target install
|
||||||
|
|
||||||
|
# Test find_package
|
||||||
|
cmake -S tests/cmake -B test_build -DCMAKE_PREFIX_PATH=$PWD/install
|
||||||
|
cmake --build test_build
|
||||||
|
cd test_build && ctest -V
|
||||||
|
|
||||||
|
# Makefile wrapper test
|
||||||
|
make-cmake-test:
|
||||||
|
name: Make CMake
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6.0.2
|
||||||
|
- name: Test via Makefile
|
||||||
|
run: make clean && make cmakebuild
|
||||||
105
lz4/.github/workflows/code-quality.yml
vendored
Normal file
105
lz4/.github/workflows/code-quality.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# Static analysis and code quality checks
|
||||||
|
name: Code Quality
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cppcheck:
|
||||||
|
name: Cppcheck Static Analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install cppcheck
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install cppcheck
|
||||||
|
|
||||||
|
- name: Display cppcheck version
|
||||||
|
run: |
|
||||||
|
type cppcheck && which cppcheck && cppcheck --version
|
||||||
|
|
||||||
|
- name: Run cppcheck analysis
|
||||||
|
# This test script ignores the exit code of cppcheck.
|
||||||
|
# See known issues in README.md.
|
||||||
|
run: make V=1 clean cppcheck || echo "There are some cppcheck reports but we ignore them for now."
|
||||||
|
|
||||||
|
scan-build:
|
||||||
|
name: Clang Static Analyzer
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install clang-tools
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install clang-tools
|
||||||
|
|
||||||
|
- name: Display environment info
|
||||||
|
run: |
|
||||||
|
type gcc && which gcc && gcc --version
|
||||||
|
type clang && which clang && clang --version
|
||||||
|
type scan-build && which scan-build
|
||||||
|
type make && which make && make -v
|
||||||
|
cat /proc/cpuinfo || echo "/proc/cpuinfo is not present"
|
||||||
|
|
||||||
|
- name: Run static analysis
|
||||||
|
run: make V=1 clean staticAnalyze
|
||||||
|
|
||||||
|
valgrind:
|
||||||
|
name: Valgrind Memory Analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install valgrind
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install valgrind
|
||||||
|
|
||||||
|
- name: Display environment info
|
||||||
|
run: |
|
||||||
|
type cc && which cc && cc --version
|
||||||
|
type valgrind && which valgrind && valgrind --version
|
||||||
|
|
||||||
|
- name: Run memory analysis
|
||||||
|
run: make V=1 -C tests test-mem
|
||||||
|
|
||||||
|
unicode-lint:
|
||||||
|
name: Unicode Linting
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Check for unicode issues
|
||||||
|
run: bash ./tests/unicode_lint.sh
|
||||||
|
|
||||||
|
examples:
|
||||||
|
name: Build Examples
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: sudo apt-get update
|
||||||
|
|
||||||
|
- name: Display compiler info
|
||||||
|
run: |
|
||||||
|
type cc && which cc && cc --version
|
||||||
|
type c++ && which c++ && c++ --version
|
||||||
|
|
||||||
|
- name: Build examples
|
||||||
|
run: make V=1 examples
|
||||||
112
lz4/.github/workflows/compilers.yml
vendored
Normal file
112
lz4/.github/workflows/compilers.yml
vendored
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
# Compiler compatibility testing across multiple C compilers
|
||||||
|
name: Compiler Tests
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
compiler-matrix:
|
||||||
|
name: ${{ matrix.cc }} on ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
# System default compilers
|
||||||
|
- { pkgs: '', cc: cc, cxx: c++, x86: true, cxxtest: true, freestanding: true, os: ubuntu-latest }
|
||||||
|
- { pkgs: '', cc: gcc, cxx: g++, x86: true, cxxtest: true, freestanding: true, os: ubuntu-latest }
|
||||||
|
|
||||||
|
# GCC versions - latest stable and LTS
|
||||||
|
- { pkgs: 'gcc-14 g++-14 lib32gcc-14-dev', cc: gcc-14, cxx: g++-14, x86: true, cxxtest: true, freestanding: true, os: ubuntu-24.04 }
|
||||||
|
- { pkgs: 'gcc-11 g++-11 lib32gcc-11-dev', cc: gcc-11, cxx: g++-11, x86: true, cxxtest: true, freestanding: true, os: ubuntu-22.04 }
|
||||||
|
|
||||||
|
# Clang versions - system default, latest stable, and older stable
|
||||||
|
- { pkgs: 'lib32gcc-12-dev', cc: clang, cxx: clang++, x86: true, cxxtest: true, freestanding: false, os: ubuntu-latest }
|
||||||
|
- { pkgs: 'clang-18 lib32gcc-12-dev', cc: clang-18, cxx: clang++-18, x86: true, cxxtest: true, freestanding: false, os: ubuntu-24.04 }
|
||||||
|
- { pkgs: 'clang-14 lib32gcc-12-dev', cc: clang-14, cxx: clang++-14, x86: true, cxxtest: true, freestanding: false, os: ubuntu-22.04 }
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
CC: ${{ matrix.cc }}
|
||||||
|
CXX: ${{ matrix.cxx }}
|
||||||
|
FIXME__LZ4_CI_IGNORE: ' echo Error. But we ignore it for now.'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib
|
||||||
|
if [ "${{ matrix.pkgs }}" != "" ]; then
|
||||||
|
sudo apt-get install ${{ matrix.pkgs }}
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Display environment info
|
||||||
|
run: |
|
||||||
|
echo "=== Compiler Information ==="
|
||||||
|
type $CC && which $CC && $CC --version
|
||||||
|
echo "=== C++ Compiler Information ==="
|
||||||
|
type $CXX && which $CXX && $CXX --version
|
||||||
|
|
||||||
|
- name: Basic build test
|
||||||
|
run: make -j V=1
|
||||||
|
|
||||||
|
- name: Installation test
|
||||||
|
run: make -C tests test-install V=1
|
||||||
|
|
||||||
|
- name: Build all with strict flags
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS="-Werror -O0" make -j all V=1
|
||||||
|
|
||||||
|
- name: C90 standard compliance test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
make -j c_standards_c90 V=1
|
||||||
|
|
||||||
|
- name: C11 standard compliance test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
make -j c_standards_c11 V=1
|
||||||
|
|
||||||
|
- name: C library for C++ program test
|
||||||
|
if: ${{ matrix.cxxtest }}
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
make -j ctocxxtest V=1
|
||||||
|
|
||||||
|
- name: C++ compilation test
|
||||||
|
if: ${{ matrix.cxxtest }}
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
make -j cxxtest V=1
|
||||||
|
|
||||||
|
- name: Freestanding environment test
|
||||||
|
if: ${{ matrix.freestanding }}
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
make test-freestanding V=1
|
||||||
|
|
||||||
|
- name: Fortified build test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS='-fPIC' LDFLAGS='-pie -fPIE -D_FORTIFY_SOURCE=2' make -j -C programs default V=1
|
||||||
|
|
||||||
|
- name: Core functionality test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CPPFLAGS=-DLZ4IO_NO_TSAN_ONLY make -j V=1 -C tests test-lz4
|
||||||
|
|
||||||
|
- name: 32-bit compatibility test
|
||||||
|
if: ${{ matrix.x86 }}
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS='-Werror -O1' make -j -C tests test-lz4c32 V=1
|
||||||
163
lz4/.github/workflows/core-tests.yml
vendored
Normal file
163
lz4/.github/workflows/core-tests.yml
vendored
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
# Core LZ4 functionality testing
|
||||||
|
name: Core Tests
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
benchmark:
|
||||||
|
name: Benchmark Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib
|
||||||
|
|
||||||
|
- name: Basic compression test
|
||||||
|
run: make -j -C tests test-lz4c V=1
|
||||||
|
|
||||||
|
- name: Full benchmark test
|
||||||
|
run: make -j -C tests test-fullbench V=1
|
||||||
|
|
||||||
|
- name: 32-bit benchmark test
|
||||||
|
run: make -j -C tests test-fullbench32 V=1
|
||||||
|
|
||||||
|
fuzzer:
|
||||||
|
name: Fuzzer Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib
|
||||||
|
|
||||||
|
- name: Setup memory mapping
|
||||||
|
run: sudo sysctl -w vm.mmap_min_addr=4096
|
||||||
|
|
||||||
|
- name: Fuzzer test (64-bit)
|
||||||
|
run: make -j -C tests test-fuzzer V=1
|
||||||
|
|
||||||
|
- name: Fuzzer test (32-bit)
|
||||||
|
run: make -C tests test-fuzzer32 V=1
|
||||||
|
|
||||||
|
versions:
|
||||||
|
name: Version Compatibility Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib
|
||||||
|
|
||||||
|
- name: Version compatibility test
|
||||||
|
run: make -j -C tests versionsTest V=1
|
||||||
|
|
||||||
|
abi:
|
||||||
|
name: ABI Compatibility Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib
|
||||||
|
|
||||||
|
- name: ABI compatibility test
|
||||||
|
run: make -j -C tests abiTests V=1
|
||||||
|
|
||||||
|
frame:
|
||||||
|
name: LZ4 Frame Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib
|
||||||
|
|
||||||
|
- name: Frame format test (64-bit)
|
||||||
|
run: make -j -C tests test-frametest V=1
|
||||||
|
|
||||||
|
- name: Frame format test (32-bit)
|
||||||
|
run: make -j -C tests test-frametest32 V=1
|
||||||
|
|
||||||
|
memory-usage:
|
||||||
|
name: Memory Usage Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Test different LZ4_MEMORY_USAGE values
|
||||||
|
run: make V=1 -C tests test-compile-with-lz4-memory-usage
|
||||||
|
|
||||||
|
custom-distance:
|
||||||
|
name: Custom Configuration Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Custom LZ4_DISTANCE_MAX test
|
||||||
|
run: |
|
||||||
|
CPPFLAGS='-DLZ4_DISTANCE_MAX=8000' make V=1 check
|
||||||
|
make clean
|
||||||
|
|
||||||
|
- name: Dynamic library linking test
|
||||||
|
run: |
|
||||||
|
make -C programs lz4-wlib V=1
|
||||||
|
make clean
|
||||||
|
|
||||||
|
- name: User memory functions test
|
||||||
|
run: |
|
||||||
|
make -C tests fullbench-wmalloc V=1
|
||||||
|
make clean
|
||||||
|
CC="c++ -Wno-deprecated" make -C tests fullbench-wmalloc V=1
|
||||||
|
|
||||||
|
makefile-variables:
|
||||||
|
name: Makefile Standard Variables Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Test standard variable propagation
|
||||||
|
run: make test_stdvars V=1
|
||||||
|
|
||||||
|
block-device:
|
||||||
|
name: Block Device Compression Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Test block device compression
|
||||||
|
run: |
|
||||||
|
make lz4
|
||||||
|
dd if=/dev/zero of=full0.img bs=2M count=1
|
||||||
|
BLOCK_DEVICE=$(sudo losetup --show -fP full0.img)
|
||||||
|
sudo chmod 666 $BLOCK_DEVICE
|
||||||
|
./lz4 -v $BLOCK_DEVICE -c > /dev/null
|
||||||
|
sudo losetup -d $BLOCK_DEVICE
|
||||||
|
rm full0.img
|
||||||
93
lz4/.github/workflows/cross-platform.yml
vendored
Normal file
93
lz4/.github/workflows/cross-platform.yml
vendored
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
# Cross-platform testing using QEMU emulation
|
||||||
|
name: Cross Platform
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
qemu-platforms:
|
||||||
|
name: ${{ matrix.arch }} (QEMU)
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { arch: ARM, pkgs: 'qemu-system-arm gcc-arm-linux-gnueabi', xcc: arm-linux-gnueabi-gcc, xemu: qemu-arm-static, makevar: "" }
|
||||||
|
- { arch: ARM64, pkgs: 'qemu-system-arm gcc-aarch64-linux-gnu', xcc: aarch64-linux-gnu-gcc, xemu: qemu-aarch64-static, makevar: "" }
|
||||||
|
- { arch: PPC, pkgs: 'qemu-system-ppc gcc-powerpc-linux-gnu', xcc: powerpc-linux-gnu-gcc, xemu: qemu-ppc-static, makevar: "" }
|
||||||
|
- { arch: PPC64LE, pkgs: 'qemu-system-ppc gcc-powerpc64le-linux-gnu', xcc: powerpc64le-linux-gnu-gcc, xemu: qemu-ppc64le-static, makevar: "" }
|
||||||
|
- { arch: S390X, pkgs: 'qemu-system-s390x gcc-s390x-linux-gnu', xcc: s390x-linux-gnu-gcc, xemu: qemu-s390x-static, makevar: "" }
|
||||||
|
- { arch: MIPS, pkgs: 'qemu-system-mips gcc-mips-linux-gnu', xcc: mips-linux-gnu-gcc, xemu: qemu-mips-static, makevar: "" }
|
||||||
|
- { arch: M68K, pkgs: 'qemu-system-m68k gcc-m68k-linux-gnu', xcc: m68k-linux-gnu-gcc, xemu: qemu-m68k-static, makevar: "HAVE_MULTITHREAD=0" }
|
||||||
|
- { arch: RISC-V, pkgs: 'qemu-system-riscv64 gcc-riscv64-linux-gnu', xcc: riscv64-linux-gnu-gcc, xemu: qemu-riscv64-static, makevar: "" }
|
||||||
|
- { arch: SPARC, pkgs: 'qemu-system-sparc gcc-sparc64-linux-gnu', xcc: sparc64-linux-gnu-gcc, xemu: qemu-sparc64-static, makevar: "" }
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
XCC: ${{ matrix.xcc }}
|
||||||
|
XEMU: ${{ matrix.xemu }}
|
||||||
|
MAKEVAR: ${{ matrix.makevar }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install cross-compilation tools
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib qemu-utils qemu-user-static
|
||||||
|
sudo apt-get install ${{ matrix.pkgs }}
|
||||||
|
|
||||||
|
- name: Display environment info
|
||||||
|
run: |
|
||||||
|
echo "=== Cross Compiler Information ==="
|
||||||
|
type $XCC && which $XCC && $XCC --version
|
||||||
|
$XCC -v # Show built-in specs
|
||||||
|
echo "=== QEMU Emulator Information ==="
|
||||||
|
type $XEMU && which $XEMU && $XEMU --version
|
||||||
|
|
||||||
|
- name: Run platform tests (ARM/ARM64/PPC/S390X)
|
||||||
|
if: contains(fromJSON('["ARM", "ARM64", "PPC", "S390X"]'), matrix.arch)
|
||||||
|
run: make platformTest V=1 CC=$XCC QEMU_SYS=$XEMU
|
||||||
|
|
||||||
|
- name: Run platform tests (PPC64LE)
|
||||||
|
if: matrix.arch == 'PPC64LE'
|
||||||
|
run: CFLAGS=-m64 make platformTest V=1 CC=$XCC QEMU_SYS=$XEMU
|
||||||
|
|
||||||
|
- name: Run platform tests (MIPS/M68K/RISC-V/SPARC)
|
||||||
|
if: contains(fromJSON('["MIPS", "M68K", "RISC-V", "SPARC"]'), matrix.arch)
|
||||||
|
run: make platformTest V=1 CC=$XCC QEMU_SYS=$XEMU $MAKEVAR
|
||||||
|
|
||||||
|
macos:
|
||||||
|
name: macOS
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Display environment info
|
||||||
|
run: |
|
||||||
|
type cc && which cc && cc --version
|
||||||
|
type make && which make && make -v
|
||||||
|
sysctl -a | grep machdep.cpu # CPU info
|
||||||
|
|
||||||
|
- name: Build with strict flags
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS="-Werror -O0" make default V=1
|
||||||
|
|
||||||
|
- name: Run comprehensive tests
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" make -j test V=1
|
||||||
|
|
||||||
|
- name: Test console independence
|
||||||
|
# Ensure `make test` doesn't depend on the status of the console
|
||||||
|
# See issue #990 for detailed explanations
|
||||||
|
run: make -j test > /dev/null
|
||||||
45
lz4/.github/workflows/oss-fuzz.yml
vendored
Normal file
45
lz4/.github/workflows/oss-fuzz.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# OSS-Fuzz integration testing
|
||||||
|
name: OSS-Fuzz
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
oss-fuzz:
|
||||||
|
name: OSS-Fuzz (${{ matrix.sanitizer }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
sanitizer: [address, undefined, memory]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Build Fuzzers
|
||||||
|
id: build
|
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||||
|
with:
|
||||||
|
oss-fuzz-project-name: 'lz4'
|
||||||
|
dry-run: false
|
||||||
|
sanitizer: ${{ matrix.sanitizer }}
|
||||||
|
|
||||||
|
- name: Run Fuzzers
|
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||||
|
with:
|
||||||
|
oss-fuzz-project-name: 'lz4'
|
||||||
|
fuzz-seconds: 100
|
||||||
|
dry-run: false
|
||||||
|
sanitizer: ${{ matrix.sanitizer }}
|
||||||
|
|
||||||
|
- name: Upload Crash Artifacts
|
||||||
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||||
|
if: failure() && steps.build.outcome == 'success'
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.sanitizer }}-artifacts
|
||||||
|
path: ./out/artifacts
|
||||||
69
lz4/.github/workflows/release-environment.yml
vendored
Normal file
69
lz4/.github/workflows/release-environment.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# Release and environment testing
|
||||||
|
name: Release & Environment
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-git-tag:
|
||||||
|
name: Git Version Tag Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Validate release tag
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
run: |
|
||||||
|
echo "tag=${GITHUB_REF#refs/*/}"
|
||||||
|
make -C tests checkTag
|
||||||
|
tests/checkTag ${GITHUB_REF#refs/*/}
|
||||||
|
|
||||||
|
environment-info:
|
||||||
|
name: Environment Info (${{ matrix.os }})
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, ubuntu-24.04, ubuntu-22.04]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Update package list
|
||||||
|
run: sudo apt-get update
|
||||||
|
|
||||||
|
- name: Display compiler versions
|
||||||
|
run: |
|
||||||
|
echo "=== Default C Compiler ==="
|
||||||
|
type cc && which cc && cc --version
|
||||||
|
echo "=== GCC ==="
|
||||||
|
type gcc && which gcc && gcc --version
|
||||||
|
echo "=== Clang ==="
|
||||||
|
type clang && which clang && clang --version
|
||||||
|
echo "=== Make ==="
|
||||||
|
type make && which make && make -v
|
||||||
|
echo "=== G++ ==="
|
||||||
|
type g++ && which g++ && g++ --version
|
||||||
|
echo "=== Git ==="
|
||||||
|
type git && which git && git --version
|
||||||
|
|
||||||
|
- name: List available package versions
|
||||||
|
run: |
|
||||||
|
echo "=== Available GCC Packages ==="
|
||||||
|
apt-cache search gcc | grep "^gcc-[0-9\.]* " | sort
|
||||||
|
echo "=== Available lib32gcc Packages (i386) ==="
|
||||||
|
apt-cache search lib32gcc | grep "^lib32gcc-" | sort
|
||||||
|
echo "=== Available GCC Multilib Packages ==="
|
||||||
|
apt-cache search multilib | grep "gcc-" | sort
|
||||||
|
echo "=== Available Clang Packages ==="
|
||||||
|
apt-cache search clang | grep "^clang-[0-9\.]* " | sort
|
||||||
|
echo "=== Available QEMU Packages ==="
|
||||||
|
apt-cache search qemu | grep "^qemu-system-.*QEMU full system" | sort
|
||||||
99
lz4/.github/workflows/sanitizers.yml
vendored
Normal file
99
lz4/.github/workflows/sanitizers.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
# Sanitizer testing (AddressSanitizer, MemorySanitizer, etc.)
|
||||||
|
name: Sanitizers
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ubsan-x64:
|
||||||
|
name: UndefinedBehaviorSanitizer (x64)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Run UBSan tests
|
||||||
|
run: make ubsan V=1
|
||||||
|
|
||||||
|
ubsan-x86:
|
||||||
|
name: UndefinedBehaviorSanitizer (x86)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Install 32-bit dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib lib32gcc-11-dev
|
||||||
|
|
||||||
|
- name: Run UBSan tests (32-bit)
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CC=clang make V=1 usan32
|
||||||
|
|
||||||
|
asan-x64:
|
||||||
|
name: AddressSanitizer (x64)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Setup memory mapping
|
||||||
|
run: sudo sysctl -w vm.mmap_min_addr=4096
|
||||||
|
|
||||||
|
- name: ASan - basic check
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address make -j check V=1
|
||||||
|
|
||||||
|
- name: ASan - frame test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address make -j -C tests test-frametest V=1
|
||||||
|
|
||||||
|
- name: ASan - fuzzer test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address make -j -C tests test-fuzzer V=1
|
||||||
|
|
||||||
|
msan-x64:
|
||||||
|
name: MemorySanitizer (x64)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: MSan - basic check
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CC=clang CFLAGS=-fsanitize=memory LDFLAGS=-fsanitize=memory make -j check V=1
|
||||||
|
|
||||||
|
- name: MSan - frame test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CC=clang CFLAGS=-fsanitize=memory LDFLAGS=-fsanitize=memory make -j -C tests test-frametest V=1
|
||||||
|
|
||||||
|
- name: MSan - fuzzer test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CC=clang CFLAGS=-fsanitize=memory LDFLAGS=-fsanitize=memory make -j -C tests test-fuzzer V=1
|
||||||
|
|
||||||
|
tsan-x64:
|
||||||
|
name: ThreadSanitizer (x64)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: TSan - CLI test
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
CC=clang CPPFLAGS="-fsanitize=thread" make -j -C tests test-lz4 V=1
|
||||||
65
lz4/.github/workflows/scorecard.yml
vendored
Normal file
65
lz4/.github/workflows/scorecard.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||||
|
# by a third-party and are governed by separate terms of service, privacy
|
||||||
|
# policy, and support documentation.
|
||||||
|
|
||||||
|
name: Scorecard supply-chain security
|
||||||
|
on:
|
||||||
|
# For Branch-Protection check. Only the default branch is supported. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||||
|
branch_protection_rule:
|
||||||
|
# To guarantee Maintained check is occasionally updated. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||||
|
schedule:
|
||||||
|
- cron: '23 22 * * 3'
|
||||||
|
push:
|
||||||
|
branches: [ "dev" ]
|
||||||
|
|
||||||
|
# Declare default permissions as read only.
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
name: Scorecard analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# Needed to upload the results to code-scanning dashboard.
|
||||||
|
security-events: write
|
||||||
|
# Needed to publish results and get a badge (see publish_results below).
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "Checkout code"
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: "Run analysis"
|
||||||
|
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
|
||||||
|
# you want to enable the Branch-Protection check on a *public* repository
|
||||||
|
# To create the PAT, follow the steps in
|
||||||
|
# https://github.com/ossf/scorecard-action#authentication-with-fine-grained-pat-optional
|
||||||
|
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
|
||||||
|
|
||||||
|
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||||
|
# - Allows the repository to include the Scorecard badge.
|
||||||
|
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||||
|
publish_results: true
|
||||||
|
|
||||||
|
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||||
|
# format to the repository Actions tab.
|
||||||
|
- name: "Upload artifact"
|
||||||
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||||
|
with:
|
||||||
|
name: SARIF file
|
||||||
|
path: results.sarif
|
||||||
|
retention-days: 5
|
||||||
|
|
||||||
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
|
- name: "Upload to code-scanning"
|
||||||
|
uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
||||||
64
lz4/.gitignore
vendored
Normal file
64
lz4/.gitignore
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
obj/
|
||||||
|
cacheObjs/
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
*.dSYM # apple
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
lz4
|
||||||
|
|
||||||
|
# Builders
|
||||||
|
cmakebuild/
|
||||||
|
builddir/
|
||||||
|
cachedObjs/
|
||||||
|
|
||||||
|
# IDE / editors files
|
||||||
|
.clang_complete
|
||||||
|
.vscode
|
||||||
|
_codelite/
|
||||||
|
_codelite_lz4/
|
||||||
|
bin/
|
||||||
|
*.zip
|
||||||
|
*.swp
|
||||||
|
compile_flags.txt
|
||||||
|
compile_commands.json
|
||||||
|
.vscode
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# analyzers
|
||||||
|
infer-out
|
||||||
|
|
||||||
|
# Mac
|
||||||
|
.DS_Store
|
||||||
|
*.dSYM
|
||||||
|
|
||||||
|
# Windows / Msys
|
||||||
|
nul
|
||||||
|
ld.exe*
|
||||||
|
|
||||||
|
# test artifacts
|
||||||
|
*.lz4
|
||||||
|
tmp*
|
||||||
|
.stdvars.log
|
||||||
|
cmake_download/
|
||||||
|
cmake_bins/
|
||||||
|
cmake_build/
|
||||||
|
cmake_install_test/
|
||||||
|
|
||||||
|
# generated Windows resource files
|
||||||
|
lib/*.rc
|
||||||
|
programs/*.rc
|
||||||
57
lz4/CODING_STYLE
Normal file
57
lz4/CODING_STYLE
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
LZ4 CODING STYLE
|
||||||
|
================
|
||||||
|
|
||||||
|
When contributing code and patches to the `LZ4` project, the following rules are expected to be followed for a successful merge.
|
||||||
|
|
||||||
|
|
||||||
|
Library
|
||||||
|
-------
|
||||||
|
|
||||||
|
The library's source code in `lib/` directory has a BSD 2-clause license.
|
||||||
|
It's designed to be integrated into 3rd party applications.
|
||||||
|
|
||||||
|
It adheres relatively strictly to vanilla `C90`, with the following exceptions:
|
||||||
|
- `long long` type is required, in order to support 64-bit values
|
||||||
|
- Variadic Macros are used for debug mode (but not required in release mode)
|
||||||
|
|
||||||
|
Beyond that, all other rules and limitations of C90 must be respected, including `/* ... */` comment style only, and variable declaration at top of block only. The automated CI test suite will check for these rules.
|
||||||
|
|
||||||
|
The code is allowed to use more modern variants (C99 / C11 / C23) when useful
|
||||||
|
as long as it provides a clean C90 backup for older compilers.
|
||||||
|
For example, C99+ compilers will employ the `restrict` keyword, while `C90` ones will ignore it, thanks to conditional macros.
|
||||||
|
This ensures maximum portability across a wide range of systems.
|
||||||
|
|
||||||
|
Moreover, in the interest of safety, the code has to respect a fairly strigent list of additional restrictions, provided through warning flags, the list of which is maintained within `Makefile`.
|
||||||
|
Among the less common ones, we want the source to be compatible with `-Wc++-compat`, which ensures that the code can be compiled "as is", with no modification, as C++ code. It makes it possible to copy-paste the code into other C++ source files, or the source files are just dropped into a C++ environment which then compiles them as C++ source files.
|
||||||
|
|
||||||
|
|
||||||
|
Command Line Interface
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
The CLI executable's source code in `programs/` directory has a GPLv2+ license.
|
||||||
|
While it's designed to be portable and freely distributable, it's not meant to be integrated into 3rd party applications.
|
||||||
|
The license difference is meant to reflect that choice.
|
||||||
|
|
||||||
|
Similar to the library, the CLI adheres relatively strictly to vanilla `C90`, and features the same exceptions:
|
||||||
|
- `long long` requirement for 64-bit values
|
||||||
|
- Variadic Macros for console messages (now used all the time, not just debug mode)
|
||||||
|
|
||||||
|
The code can also use system-specific libraries and symbols (such as `posix` ones)
|
||||||
|
as long as it provides a backup for plain `C90` platforms.
|
||||||
|
It's even allowed to lose capabilities, as long as the CLI can be cleanly compiled on `C90`.
|
||||||
|
For example, systems without `<pthread>` support nor Completion Ports will just not feature multi-threading support, and run single threaded.
|
||||||
|
|
||||||
|
In the interest of build familiarity, the CLI source code also respects the same set of advanced warning flags as the library.
|
||||||
|
That being said, this last part is debatable and could deviate in the future.
|
||||||
|
For example, there are less reasons to support `-Wc++-compat` on the CLI side, since it's not meant to be integrated into 3rd party applications.
|
||||||
|
|
||||||
|
|
||||||
|
Others
|
||||||
|
------
|
||||||
|
|
||||||
|
The repository includes other directories with their own set of compilable projects, such as `tests/`, `examples/` and `contrib/`.
|
||||||
|
|
||||||
|
These repositories do not have to respect the same set of restrictions, and can employ a larger array of different languages.
|
||||||
|
For example, some tests employ `sh`, and others employ `python`.
|
||||||
|
|
||||||
|
These directories may nonetheless include several targets employing the same coding convention as the `lz4` library. This is in a no way a rule, more like a side effect of build familiarity.
|
||||||
16
lz4/INSTALL
Normal file
16
lz4/INSTALL
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
Installation
|
||||||
|
=============
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
make install # this command may require root access
|
||||||
|
```
|
||||||
|
|
||||||
|
LZ4's `Makefile` supports standard [Makefile conventions],
|
||||||
|
including [staged installs], [redirection], or [command redefinition].
|
||||||
|
It is compatible with parallel builds (`-j#`).
|
||||||
|
|
||||||
|
[Makefile conventions]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
|
||||||
|
[staged installs]: https://www.gnu.org/prep/standards/html_node/DESTDIR.html
|
||||||
|
[redirection]: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||||
|
[command redefinition]: https://www.gnu.org/prep/standards/html_node/Utilities-in-Makefiles.html
|
||||||
12
lz4/LICENSE
Normal file
12
lz4/LICENSE
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
This repository uses 2 different licenses :
|
||||||
|
- all files in the `lib` directory use a BSD 2-Clause license
|
||||||
|
- all other files use a GPL-2.0-or-later license, unless explicitly stated otherwise
|
||||||
|
|
||||||
|
Relevant license is reminded at the top of each source file,
|
||||||
|
and with presence of COPYING or LICENSE file in associated directories.
|
||||||
|
|
||||||
|
This model is selected to emphasize that
|
||||||
|
files in the `lib` directory are designed to be included into 3rd party applications,
|
||||||
|
while all other files, in `programs`, `tests` or `examples`,
|
||||||
|
are intended to be used "as is", as part of their intended scenarios,
|
||||||
|
with no intention to support 3rd party integration use cases.
|
||||||
257
lz4/Makefile
Normal file
257
lz4/Makefile
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
# ################################################################
|
||||||
|
# LZ4 - Makefile
|
||||||
|
# Copyright (C) Yann Collet 2011-2023
|
||||||
|
# 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 :
|
||||||
|
# - LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
# ################################################################
|
||||||
|
|
||||||
|
LZ4DIR = lib
|
||||||
|
PRGDIR = programs
|
||||||
|
TESTDIR = tests
|
||||||
|
EXDIR = examples
|
||||||
|
FUZZDIR = ossfuzz
|
||||||
|
|
||||||
|
include build/make/lz4defs.make
|
||||||
|
|
||||||
|
MAKE += --no-print-directory
|
||||||
|
|
||||||
|
.PHONY: default
|
||||||
|
default: lib-release lz4-release
|
||||||
|
|
||||||
|
# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1
|
||||||
|
$(V)$(VERBOSE).SILENT:
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: allmost examples manuals build_tests
|
||||||
|
|
||||||
|
.PHONY: allmost
|
||||||
|
allmost: lib lz4
|
||||||
|
|
||||||
|
.PHONY: lib lib-release liblz4.a
|
||||||
|
lib lib-release liblz4.a:
|
||||||
|
$(MAKE) -C $(LZ4DIR) $@
|
||||||
|
|
||||||
|
.PHONY: lz4 lz4-release
|
||||||
|
lz4 lz4-release :
|
||||||
|
$(MAKE) -C $(PRGDIR) $@
|
||||||
|
$(LN_SF) $(PRGDIR)/lz4$(EXT) .
|
||||||
|
echo lz4 build completed
|
||||||
|
|
||||||
|
.PHONY: examples
|
||||||
|
examples: lib
|
||||||
|
$(MAKE) -C $(EXDIR) all
|
||||||
|
|
||||||
|
.PHONY: manuals
|
||||||
|
manuals:
|
||||||
|
$(MAKE) -C contrib/gen_manual $@
|
||||||
|
|
||||||
|
.PHONY: build_tests
|
||||||
|
build_tests:
|
||||||
|
$(MAKE) -C $(TESTDIR) all
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean: MAKEFLAGS= --no-print-directory
|
||||||
|
clean:
|
||||||
|
$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(PRGDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(TESTDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(EXDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C $(FUZZDIR) $@ > $(VOID)
|
||||||
|
$(MAKE) -C contrib/gen_manual $@ > $(VOID)
|
||||||
|
$(RM) lz4$(EXT)
|
||||||
|
$(RM) -r $(CMAKE_BUILD_DIR) $(MESON_BUILD_DIR)
|
||||||
|
@echo Cleaning completed
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# make install is validated only for Posix environments
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
ifeq ($(POSIX_ENV),Yes)
|
||||||
|
HOST_OS = POSIX
|
||||||
|
|
||||||
|
.PHONY: install uninstall
|
||||||
|
install uninstall:
|
||||||
|
$(MAKE) -C $(LZ4DIR) $@
|
||||||
|
$(MAKE) -C $(PRGDIR) $@
|
||||||
|
|
||||||
|
.PHONY: test-install
|
||||||
|
test-install:
|
||||||
|
$(MAKE) -j1 install DESTDIR=~/install_test_dir
|
||||||
|
|
||||||
|
endif # POSIX_ENV
|
||||||
|
|
||||||
|
|
||||||
|
CMAKE ?= cmake
|
||||||
|
CMAKE_BUILD_DIR ?= build/cmake/build
|
||||||
|
ifneq (,$(filter MSYS%,$(shell $(UNAME))))
|
||||||
|
HOST_OS = MSYS
|
||||||
|
CMAKE_PARAMS = -G"MSYS Makefiles"
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: cmakebuild
|
||||||
|
cmakebuild:
|
||||||
|
mkdir -p $(CMAKE_BUILD_DIR)
|
||||||
|
cd $(CMAKE_BUILD_DIR); $(CMAKE) $(CMAKE_PARAMS) ..; $(CMAKE) --build .
|
||||||
|
|
||||||
|
MESON ?= meson
|
||||||
|
MESON_BUILD_DIR ?= mesonBuildDir
|
||||||
|
|
||||||
|
.PHONY: mesonbuild
|
||||||
|
mesonbuild:
|
||||||
|
$(MESON) setup --fatal-meson-warnings --buildtype=debug -Db_lundef=false -Dauto_features=enabled -Dprograms=true -Dcontrib=true -Dtests=true -Dexamples=true build/meson $(MESON_BUILD_DIR)
|
||||||
|
$(MESON) test -C $(MESON_BUILD_DIR)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# make tests validated only for MSYS and Posix environments
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
ifneq (,$(filter $(HOST_OS),MSYS POSIX))
|
||||||
|
|
||||||
|
.PHONY: list
|
||||||
|
list:
|
||||||
|
$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check:
|
||||||
|
$(MAKE) -C $(TESTDIR) test-lz4-essentials
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
$(MAKE) -C $(TESTDIR) $@
|
||||||
|
$(MAKE) -C $(EXDIR) $@
|
||||||
|
|
||||||
|
.PHONY: usan
|
||||||
|
usan: CC = clang
|
||||||
|
usan: CFLAGS = -O3 -g -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-recover=pointer-overflow
|
||||||
|
usan: LDFLAGS = $(CFLAGS)
|
||||||
|
usan: clean
|
||||||
|
CC=$(CC) CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
|
||||||
|
|
||||||
|
.PHONY: ubsan
|
||||||
|
ubsan: usan
|
||||||
|
|
||||||
|
.PHONY: usan32
|
||||||
|
usan32: CFLAGS = -m32 -O3 -g -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-recover=pointer-overflow
|
||||||
|
usan32: LDFLAGS = $(CFLAGS)
|
||||||
|
usan32: clean
|
||||||
|
CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) V=1 test FUZZER_TIME="-T30s" NB_LOOPS=-i1
|
||||||
|
|
||||||
|
SCANBUILD ?= scan-build
|
||||||
|
SCANBUILD_FLAGS += --status-bugs -v --force-analyze-debug-code
|
||||||
|
.PHONY: staticAnalyze
|
||||||
|
staticAnalyze: clean
|
||||||
|
CPPFLAGS=-DLZ4_DEBUG=1 CFLAGS=-g $(SCANBUILD) $(SCANBUILD_FLAGS) $(MAKE) all V=1 DEBUGLEVEL=1
|
||||||
|
|
||||||
|
.PHONY: cppcheck
|
||||||
|
cppcheck:
|
||||||
|
cppcheck . --force --enable=warning,portability,performance,style --error-exitcode=1 > /dev/null
|
||||||
|
|
||||||
|
.PHONY: platformTest
|
||||||
|
platformTest: clean
|
||||||
|
@echo "\n ---- test lz4 with $(CC) compiler ----"
|
||||||
|
$(CC) -v
|
||||||
|
CFLAGS="$(CFLAGS) -O3 -Werror" $(MAKE) -C $(LZ4DIR) all
|
||||||
|
CFLAGS="$(CFLAGS) -O3 -Werror -static" $(MAKE) -C $(PRGDIR) all
|
||||||
|
CFLAGS="$(CFLAGS) -O3 -Werror -static" $(MAKE) -C $(TESTDIR) all
|
||||||
|
$(MAKE) -C $(TESTDIR) test-platform
|
||||||
|
|
||||||
|
.PHONY: versionsTest
|
||||||
|
versionsTest:
|
||||||
|
$(MAKE) -C $(TESTDIR) clean
|
||||||
|
$(MAKE) -C $(TESTDIR) $@
|
||||||
|
|
||||||
|
.PHONY: test-freestanding
|
||||||
|
test-freestanding:
|
||||||
|
$(MAKE) -C $(TESTDIR) clean
|
||||||
|
$(MAKE) -C $(TESTDIR) $@
|
||||||
|
|
||||||
|
# test linking C libraries from C++ executables
|
||||||
|
.PHONY: ctocxxtest
|
||||||
|
ctocxxtest: LIBCC="$(CC)"
|
||||||
|
ctocxxtest: EXECC="$(CXX) -Wno-deprecated"
|
||||||
|
ctocxxtest: CFLAGS=-O0
|
||||||
|
ctocxxtest:
|
||||||
|
CFLAGS="$(CFLAGS)" CC=$(LIBCC) $(MAKE) -C $(LZ4DIR) all
|
||||||
|
CC=$(LIBCC) $(MAKE) -C $(TESTDIR) CFLAGS="$(CFLAGS)" lz4.o lz4hc.o lz4frame.o
|
||||||
|
CC=$(EXECC) $(MAKE) -C $(TESTDIR) CFLAGS="$(CFLAGS)" all
|
||||||
|
|
||||||
|
.PHONY: cxxtest cxx32test
|
||||||
|
cxx32test: CFLAGS += -m32
|
||||||
|
cxxtest cxx32test: CC := "$(CXX) -Wno-deprecated"
|
||||||
|
cxxtest cxx32test: CFLAGS = -O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
|
||||||
|
cxxtest cxx32test:
|
||||||
|
$(CXX) -v
|
||||||
|
CC=$(CC) CFLAGS="$(CFLAGS)" $(MAKE) -C $(LZ4DIR) all
|
||||||
|
CC=$(CC) CFLAGS="$(CFLAGS)" $(MAKE) -C $(PRGDIR) all
|
||||||
|
CC=$(CC) CFLAGS="$(CFLAGS)" $(MAKE) -C $(TESTDIR) all
|
||||||
|
|
||||||
|
.PHONY: cxx17build
|
||||||
|
cxx17build : CC = "$(CXX) -Wno-deprecated"
|
||||||
|
cxx17build : CFLAGS = -std=c++17 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror -Wpedantic
|
||||||
|
cxx17build : clean
|
||||||
|
$(CXX) -v
|
||||||
|
CC=$(CC) $(MAKE) -C $(LZ4DIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
CC=$(CC) $(MAKE) -C $(PRGDIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
CC=$(CC) $(MAKE) -C $(TESTDIR) all CFLAGS="$(CFLAGS)"
|
||||||
|
|
||||||
|
.PHONY: c_standards
|
||||||
|
c_standards: clean c_standards_c11 c_standards_c99 c_standards_c90
|
||||||
|
|
||||||
|
.PHONY: c_standards_c90
|
||||||
|
c_standards_c90: clean
|
||||||
|
$(MAKE) clean; CFLAGS="-std=c90 -Werror -Wpedantic -Wno-long-long -Wno-variadic-macros" $(MAKE) allmost
|
||||||
|
$(MAKE) clean; CFLAGS="-std=gnu90 -Werror -Wpedantic -Wno-long-long -Wno-variadic-macros" $(MAKE) allmost
|
||||||
|
|
||||||
|
.PHONY: c_standards_c99
|
||||||
|
c_standards_c99: clean
|
||||||
|
$(MAKE) clean; CFLAGS="-std=c99 -Werror -Wpedantic" $(MAKE) all
|
||||||
|
$(MAKE) clean; CFLAGS="-std=gnu99 -Werror -Wpedantic" $(MAKE) all
|
||||||
|
|
||||||
|
.PHONY: c_standards_c11
|
||||||
|
c_standards_c11: clean
|
||||||
|
$(MAKE) clean; CFLAGS="-std=c11 -Werror" $(MAKE) all
|
||||||
|
|
||||||
|
# The following test ensures that standard Makefile variables set through environment
|
||||||
|
# are correctly transmitted at compilation stage.
|
||||||
|
# This test is meant to detect issues like https://github.com/lz4/lz4/issues/958
|
||||||
|
.PHONY: test_stdvars
|
||||||
|
test_stdvars: ## CI helper – verifies CC/CFLAGS/CPPFLAGS/LDFLAGS/LDLIBS propagation
|
||||||
|
@echo '--- standard-variable propagation test ---'
|
||||||
|
@$(RM) .stdvars.log
|
||||||
|
|
||||||
|
@$(MAKE) -rn V=1 \
|
||||||
|
CC='cc -DCC_TEST' \
|
||||||
|
CFLAGS='-DCFLAGS_TEST' \
|
||||||
|
CPPFLAGS='-DCPPFLAGS_TEST' \
|
||||||
|
LDFLAGS='-DLDFLAGS_TEST' \
|
||||||
|
LDLIBS='-DLDLIBS_TEST' \
|
||||||
|
| tee .stdvars.log >/dev/null
|
||||||
|
|
||||||
|
@tests/check_stdvars.sh .stdvars.log
|
||||||
|
@$(RM) .stdvars.log
|
||||||
|
|
||||||
|
endif # MSYS POSIX
|
||||||
366
lz4/NEWS
Normal file
366
lz4/NEWS
Normal file
@@ -0,0 +1,366 @@
|
|||||||
|
v1.10.0
|
||||||
|
cli : multithreading compression support: improves speed by X times threads allocated
|
||||||
|
cli : overlap decompression with i/o, improving speed by ~+60%
|
||||||
|
cli : support environment variables LZ4_CLEVEL and LZ4_NBWORKERS
|
||||||
|
cli : license of CLI more clearly labelled GPL-2.0-or-later
|
||||||
|
cli : fix: refuse to compress directories
|
||||||
|
cli : fix dictionary compression benchmark on multiple files
|
||||||
|
cli : change: no more implicit `stdout` (except when input is `stdin`)
|
||||||
|
lib : new level 2, offering mid-way performance (speed and compression)
|
||||||
|
lib : Improved lz4frame compression speed for small data (up to +160% at 1KB)
|
||||||
|
lib : Slightly faster (+5%) HC compression speed (levels 3-9), by @JunHe77
|
||||||
|
lib : dictionary compression support now in stable status
|
||||||
|
lib : lz4frame states can be safely reset and reused after a processing error (described by @QrczakMK)
|
||||||
|
lib : `lz4file` API improvements, by @vsolontsov-volant and @t-mat
|
||||||
|
lib : new experimental symbol `LZ4_compress_destSize_extState()`
|
||||||
|
build: cmake minimum version raised to 3.5
|
||||||
|
build: cmake improvements, by @foxeng, @Ohjurot, @LocalSpook, @teo-tsirpanis, @ur4t and @t-mat
|
||||||
|
build: meson scripts are now hosted into `build/` directory, by @eli-schwartz
|
||||||
|
build: meson improvements, by @tristan957
|
||||||
|
build: Visual Studio solutions generated by `cmake` via scripts
|
||||||
|
port : support for loongArch, risc-v, m68k, mips and sparc architectures
|
||||||
|
port : improved Visual Studio compatibility, by @t-mat
|
||||||
|
port : freestanding support improvements, by @t-mat
|
||||||
|
|
||||||
|
v1.9.4
|
||||||
|
perf : faster decoding speed (~+20%) on aarch64 platforms
|
||||||
|
perf : faster decoding speed (~+70%) for -BD4 setting in CLI
|
||||||
|
api : new function `LZ4_decompress_safe_partial_usingDict()` by @yawqi
|
||||||
|
api : lz4frame: ability to provide custom allocators at state creation
|
||||||
|
api : can skip checksum validation for improved decoding speed
|
||||||
|
api : new experimental unit `lz4file` for file i/o API, by @anjiahao1
|
||||||
|
api : new experimental function `LZ4F_uncompressedUpdate()`, by @alexmohr
|
||||||
|
cli : `--list` works on `stdin` input, by @Low-power
|
||||||
|
cli : `--no-crc` does not produce (compression) nor check (decompression) checksums
|
||||||
|
cli : fix: `--test` and `--list` produce an error code when parsing invalid input
|
||||||
|
cli : fix: `--test -m` does no longer create decompressed file artifacts
|
||||||
|
cli : fix: support skippable frames when passed via `stdin`, reported by @davidmankin
|
||||||
|
build: fix: Makefile respects CFLAGS directives passed via environment variable
|
||||||
|
build: `LZ4_FREESTANDING`, new build macro for freestanding environments, by @t-mat
|
||||||
|
build: `make` and `make test` are compatible with `-j` parallel run
|
||||||
|
build: AS/400 compatibility, by @jonrumsey
|
||||||
|
build: Solaris 10 compatibility, by @pekdon
|
||||||
|
build: MSVC 2022 support, by @t-mat
|
||||||
|
build: improved meson script, by @eli-schwartz
|
||||||
|
doc : Updated LZ4 block format, provide an "implementation notes" section
|
||||||
|
|
||||||
|
v1.9.3
|
||||||
|
perf: highly improved speed in kernel space, by @terrelln
|
||||||
|
perf: faster speed with Visual Studio, thanks to @wolfpld and @remittor
|
||||||
|
perf: improved dictionary compression speed, by @felixhandte
|
||||||
|
perf: fixed LZ4_compress_HC_destSize() ratio, detected by @hsiangkao
|
||||||
|
perf: reduced stack usage in high compression mode, by @Yanpas
|
||||||
|
api : LZ4_decompress_safe_partial() supports unknown compressed size, requested by @jfkthame
|
||||||
|
api : improved LZ4F_compressBound() with automatic flushing, by Christopher Harvie
|
||||||
|
api : can (de)compress to/from NULL without UBs
|
||||||
|
api : fix alignment test on 32-bit systems (state initialization)
|
||||||
|
api : fix LZ4_saveDictHC() in corner case scenario, detected by @IgorKorkin
|
||||||
|
cli : `-l` legacy format is now compatible with `-m` multiple files, by Filipe Calasans
|
||||||
|
cli : benchmark mode supports dictionary, by @rkoradi
|
||||||
|
cli : fix --fast with large argument, detected by @picoHz
|
||||||
|
build: link to user-defined memory functions with LZ4_USER_MEMORY_FUNCTIONS, suggested by Yuriy Levchenko
|
||||||
|
build: contrib/cmake_unofficial/ moved to build/cmake/
|
||||||
|
build: visual/* moved to build/
|
||||||
|
build: updated meson script, by @neheb
|
||||||
|
build: tinycc support, by Anton Kochkov
|
||||||
|
install: Haiku support, by Jerome Duval
|
||||||
|
doc : updated LZ4 frame format, clarify EndMark
|
||||||
|
|
||||||
|
v1.9.2
|
||||||
|
fix : out-of-bound read in exceptional circumstances when using decompress_partial(), by @terrelln
|
||||||
|
fix : slim opportunity for out-of-bound write with compress_fast() with a large enough input and when providing an output smaller than recommended (< LZ4_compressBound(inputSize)), by @terrelln
|
||||||
|
fix : rare data corruption bug with LZ4_compress_destSize(), by @terrelln
|
||||||
|
fix : data corruption bug when Streaming with an Attached Dict in HC Mode, by @felixhandte
|
||||||
|
perf: enable LZ4_FAST_DEC_LOOP on aarch64/GCC by default, by @prekageo
|
||||||
|
perf: improved lz4frame streaming API speed, by @dreambottle
|
||||||
|
perf: speed up lz4hc on slow patterns when using external dictionary, by @terrelln
|
||||||
|
api: better in-place decompression and compression support
|
||||||
|
cli : --list supports multi-frames files, by @gstedman
|
||||||
|
cli: --version outputs to stdout
|
||||||
|
cli : add option --best as an alias of -12 , by @Low-power
|
||||||
|
misc: Integration into oss-fuzz by @cmeister2, expanded list of scenarios by @terrelln
|
||||||
|
|
||||||
|
v1.9.1
|
||||||
|
fix : decompression functions were reading a few bytes beyond input size (introduced in v1.9.0, reported by @ppodolsky and @danlark1)
|
||||||
|
api : fix : lz4frame initializers compatibility with c++, reported by @degski
|
||||||
|
cli : added command --list, based on a patch by @gabrielstedman
|
||||||
|
build: improved Windows build, by @JPeterMugaas
|
||||||
|
build: AIX, by Norman Green
|
||||||
|
|
||||||
|
v1.9.0
|
||||||
|
perf: large decompression speed improvement on x86/x64 (up to +20%) by @djwatson
|
||||||
|
api : changed : _destSize() compression variants are promoted to stable API
|
||||||
|
api : new : LZ4_initStream(HC), replacing LZ4_resetStream(HC)
|
||||||
|
api : changed : LZ4_resetStream(HC) as recommended reset function, for better performance on small data
|
||||||
|
cli : support custom block sizes, by @blezsan
|
||||||
|
build: source code can be amalgamated, by Bing Xu
|
||||||
|
build: added meson build, by @lzutao
|
||||||
|
build: new build macros : LZ4_DISTANCE_MAX, LZ4_FAST_DEC_LOOP
|
||||||
|
install: MidnightBSD, by @laffer1
|
||||||
|
install: msys2 on Windows 10, by @vtorri
|
||||||
|
|
||||||
|
v1.8.3
|
||||||
|
perf: minor decompression speed improvement (~+2%) with gcc
|
||||||
|
fix : corruption in v1.8.2 at level 9 for files > 64KB under rare conditions (#560)
|
||||||
|
cli : new command --fast, by @jennifermliu
|
||||||
|
cli : fixed elapsed time, and added cpu load indicator (on -vv) (#555)
|
||||||
|
api : LZ4_decompress_safe_partial() now decodes exactly the nb of bytes requested (feature request #566)
|
||||||
|
build : added Haiku target, by @fbrosson, and MidnightBSD, by @laffer1
|
||||||
|
doc : updated documentation regarding dictionary compression
|
||||||
|
|
||||||
|
v1.8.2
|
||||||
|
perf: *much* faster dictionary compression on small files, by @felixhandte
|
||||||
|
perf: improved decompression speed and binary size, by Alexey Tourbin (@svpv)
|
||||||
|
perf: slightly faster HC compression and decompression speed
|
||||||
|
perf: very small compression ratio improvement
|
||||||
|
fix : compression compatible with low memory addresses (< 0xFFFF)
|
||||||
|
fix : decompression segfault when provided with NULL input, by @terrelln
|
||||||
|
cli : new command --favor-decSpeed
|
||||||
|
cli : benchmark mode more accurate for small inputs
|
||||||
|
fullbench : can bench _destSize() variants, by @felixhandte
|
||||||
|
doc : clarified block format parsing restrictions, by Alexey Tourbin (@svpv)
|
||||||
|
|
||||||
|
v1.8.1
|
||||||
|
perf : faster and stronger ultra modes (levels 10+)
|
||||||
|
perf : slightly faster compression and decompression speed
|
||||||
|
perf : fix bad degenerative case, reported by @c-morgenstern
|
||||||
|
fix : decompression failed when using a combination of extDict + low memory address (#397), reported and fixed by Julian Scheid (@jscheid)
|
||||||
|
cli : support for dictionary compression (`-D`), by Felix Handte @felixhandte
|
||||||
|
cli : fix : `lz4 -d --rm` preserves timestamp (#441)
|
||||||
|
cli : fix : do not modify /dev/null permission as root, by @aliceatlas
|
||||||
|
api : `_destSize()` variant supported for all compression levels
|
||||||
|
build : `make` and `make test` compatible with `-jX`, reported by @mwgamera
|
||||||
|
build : can control LZ4LIB_VISIBILITY macro, by @mikir
|
||||||
|
install: fix man page directory (#387), reported by Stuart Cardall (@itoffshore)
|
||||||
|
|
||||||
|
v1.8.0
|
||||||
|
cli : fix : do not modify /dev/null permissions, reported by @Maokaman1
|
||||||
|
cli : added GNU separator -- specifying that all following arguments are files
|
||||||
|
API : added LZ4_compress_HC_destSize(), by Oleg (@remittor)
|
||||||
|
API : added LZ4F_resetDecompressionContext()
|
||||||
|
API : lz4frame : negative compression levels trigger fast acceleration, request by Lawrence Chan
|
||||||
|
API : lz4frame : can control block checksum and dictionary ID
|
||||||
|
API : fix : expose obsolete decoding functions, reported by Chen Yufei
|
||||||
|
API : experimental : lz4frame_static : new dictionary compression API
|
||||||
|
build : fix : static lib installation, by Ido Rosen
|
||||||
|
build : dragonFlyBSD, OpenBSD, NetBSD supported
|
||||||
|
build : LZ4_MEMORY_USAGE can be modified at compile time, through external define
|
||||||
|
doc : Updated LZ4 Frame format to v1.6.0, restoring Dictionary-ID field
|
||||||
|
doc : lz4 api manual, by Przemyslaw Skibinski
|
||||||
|
|
||||||
|
v1.7.5
|
||||||
|
lz4hc : new high compression mode : levels 10-12 compress more and slower, by Przemyslaw Skibinski
|
||||||
|
lz4cat : fix : works with relative path (#284) and stdin (#285) (reported by @beiDei8z)
|
||||||
|
cli : fix minor notification when using -r recursive mode
|
||||||
|
API : lz4frame : LZ4F_frameBound(0) gives upper bound of *flush() and *End() operations (#290, #280)
|
||||||
|
doc : markdown version of man page, by Takayuki Matsuoka (#279)
|
||||||
|
build : Makefile : fix make -jX lib+exe concurrency (#277)
|
||||||
|
build : cmake : improvements by Michał Górny (#296)
|
||||||
|
|
||||||
|
v1.7.4.2
|
||||||
|
fix : Makefile : release build compatible with PIE and customized compilation directives provided through environment variables (#274, reported by Antoine Martin)
|
||||||
|
|
||||||
|
v1.7.4
|
||||||
|
Improved : much better speed in -mx32 mode
|
||||||
|
cli : fix : Large file support in 32-bits mode on Mac OS-X
|
||||||
|
fix : compilation on gcc 4.4 (#272), reported by Antoine Martin
|
||||||
|
|
||||||
|
v1.7.3
|
||||||
|
Changed : moved to versioning; package, cli and library have same version number
|
||||||
|
Improved: Small decompression speed boost
|
||||||
|
Improved: Small compression speed improvement on 64-bits systems
|
||||||
|
Improved: Small compression ratio and speed improvement on small files
|
||||||
|
Improved: Significant speed boost on ARMv6 and ARMv7
|
||||||
|
Fix : better ratio on 64-bits big-endian targets
|
||||||
|
Improved cmake build script, by Evan Nemerson
|
||||||
|
New liblz4-dll project, by Przemyslaw Skibinki
|
||||||
|
Makefile: Generates object files (*.o) for faster (re)compilation on low power systems
|
||||||
|
cli : new : --rm and --help commands
|
||||||
|
cli : new : preserved file attributes, by Przemyslaw Skibinki
|
||||||
|
cli : fix : crash on some invalid inputs
|
||||||
|
cli : fix : -t correctly validates lz4-compressed files, by Nick Terrell
|
||||||
|
cli : fix : detects and reports fread() errors, thanks to Hiroshi Fujishima report #243
|
||||||
|
cli : bench : new : -r recursive mode
|
||||||
|
lz4cat : can cat multiple files in a single command line (#184)
|
||||||
|
Added : doc/lz4_manual.html, by Przemyslaw Skibinski
|
||||||
|
Added : dictionary compression and frame decompression examples, by Nick Terrell
|
||||||
|
Added : Debianization, by Evgeniy Polyakov
|
||||||
|
|
||||||
|
r131
|
||||||
|
New : Dos/DJGPP target, thanks to Louis Santillan (#114)
|
||||||
|
Added : Example using lz4frame library, by Zbigniew Jędrzejewski-Szmek (#118)
|
||||||
|
Changed: xxhash symbols are modified (namespace emulation) within liblz4
|
||||||
|
|
||||||
|
r130:
|
||||||
|
Fixed : incompatibility sparse mode vs console, reported by Yongwoon Cho (#105)
|
||||||
|
Fixed : LZ4IO exits too early when frame crc not present, reported by Yongwoon Cho (#106)
|
||||||
|
Fixed : incompatibility sparse mode vs append mode, reported by Takayuki Matsuoka (#110)
|
||||||
|
Performance fix : big compression speed boost for clang (+30%)
|
||||||
|
New : cross-version test, by Takayuki Matsuoka
|
||||||
|
|
||||||
|
r129:
|
||||||
|
Added : LZ4_compress_fast(), LZ4_compress_fast_continue()
|
||||||
|
Added : LZ4_compress_destSize()
|
||||||
|
Changed: New lz4 and lz4hc compression API. Previous function prototypes still supported.
|
||||||
|
Changed: Sparse file support enabled by default
|
||||||
|
New : LZ4 CLI improved performance compressing/decompressing multiple files (#86, kind contribution from Kyle J. Harper & Takayuki Matsuoka)
|
||||||
|
Fixed : GCC 4.9+ optimization bug - Reported by Markus Trippelsdorf, Greg Slazinski & Evan Nemerson
|
||||||
|
Changed: Enums converted to LZ4F_ namespace convention - by Takayuki Matsuoka
|
||||||
|
Added : AppVeyor CI environment, for Visual tests - Suggested by Takayuki Matsuoka
|
||||||
|
Modified:Obsolete functions generate warnings - Suggested by Evan Nemerson, contributed by Takayuki Matsuoka
|
||||||
|
Fixed : Bug #75 (unfinished stream), reported by Yongwoon Cho
|
||||||
|
Updated: Documentation converted to MarkDown format
|
||||||
|
|
||||||
|
r128:
|
||||||
|
New : lz4cli sparse file support (Requested by Neil Wilson, and contributed by Takayuki Matsuoka)
|
||||||
|
New : command -m, to compress multiple files in a single command (suggested by Kyle J. Harper)
|
||||||
|
Fixed : Restored lz4hc compression ratio (slightly lower since r124)
|
||||||
|
New : lz4 cli supports long commands (suggested by Takayuki Matsuoka)
|
||||||
|
New : lz4frame & lz4cli frame content size support
|
||||||
|
New : lz4frame supports skippable frames, as requested by Sergey Cherepanov
|
||||||
|
Changed: Default "make install" directory is /usr/local, as notified by Ron Johnson
|
||||||
|
New : lz4 cli supports "pass-through" mode, requested by Neil Wilson
|
||||||
|
New : datagen can generate sparse files
|
||||||
|
New : scan-build tests, thanks to kind help by Takayuki Matsuoka
|
||||||
|
New : g++ compatibility tests
|
||||||
|
New : arm cross-compilation test, thanks to kind help by Takayuki Matsuoka
|
||||||
|
Fixed : Fuzzer + frametest compatibility with NetBSD (issue #48, reported by Thomas Klausner)
|
||||||
|
Added : Visual project directory
|
||||||
|
Updated: Man page & Specification
|
||||||
|
|
||||||
|
r127:
|
||||||
|
N/A : added a file on SVN
|
||||||
|
|
||||||
|
r126:
|
||||||
|
New : lz4frame API is now integrated into liblz4
|
||||||
|
Fixed : GCC 4.9 bug on highest performance settings, reported by Greg Slazinski
|
||||||
|
Fixed : bug within LZ4 HC streaming mode, reported by James Boyle
|
||||||
|
Fixed : older compiler don't like nameless unions, reported by Cheyi Lin
|
||||||
|
Changed : lz4 is C90 compatible
|
||||||
|
Changed : added -pedantic option, fixed a few mminor warnings
|
||||||
|
|
||||||
|
r125:
|
||||||
|
Changed : endian and alignment code
|
||||||
|
Changed : directory structure : new "lib" directory
|
||||||
|
Updated : lz4io, now uses lz4frame
|
||||||
|
Improved: slightly improved decoding speed
|
||||||
|
Fixed : LZ4_compress_limitedOutput(); Special thanks to Christopher Speller !
|
||||||
|
Fixed : some alignment warnings under clang
|
||||||
|
Fixed : deprecated function LZ4_slideInputBufferHC()
|
||||||
|
|
||||||
|
r124:
|
||||||
|
New : LZ4 HC streaming mode
|
||||||
|
Fixed : LZ4F_compressBound() using null preferencesPtr
|
||||||
|
Updated : xxHash to r38
|
||||||
|
Updated library number, to 1.4.0
|
||||||
|
|
||||||
|
r123:
|
||||||
|
Added : experimental lz4frame API, thanks to Takayuki Matsuoka and Christopher Jackson for testings
|
||||||
|
Fix : s390x support, thanks to Nobuhiro Iwamatsu
|
||||||
|
Fix : test mode (-t) no longer requires confirmation, thanks to Thary Nguyen
|
||||||
|
|
||||||
|
r122:
|
||||||
|
Fix : AIX & AIX64 support (SamG)
|
||||||
|
Fix : mips 64-bits support (lew van)
|
||||||
|
Added : Examples directory, using code examples from Takayuki Matsuoka
|
||||||
|
Updated : Framing specification, to v1.4.1
|
||||||
|
Updated : xxHash, to r36
|
||||||
|
|
||||||
|
r121:
|
||||||
|
Added : Makefile : install for kFreeBSD and Hurd (Nobuhiro Iwamatsu)
|
||||||
|
Fix : Makefile : install for OS-X and BSD, thanks to Takayuki Matsuoka
|
||||||
|
|
||||||
|
r120:
|
||||||
|
Modified : Streaming API, using strong types
|
||||||
|
Added : LZ4_versionNumber(), thanks to Takayuki Matsuoka
|
||||||
|
Fix : OS-X : library install name, thanks to Clemens Lang
|
||||||
|
Updated : Makefile : synchronize library version number with lz4.h, thanks to Takayuki Matsuoka
|
||||||
|
Updated : Makefile : stricter compilation flags
|
||||||
|
Added : pkg-config, thanks to Zbigniew Jędrzejewski-Szmek (issue 135)
|
||||||
|
Makefile : lz4-test only test native binaries, as suggested by Michał Górny (issue 136)
|
||||||
|
Updated : xxHash to r35
|
||||||
|
|
||||||
|
r119:
|
||||||
|
Fix : Issue 134 : extended malicious address space overflow in 32-bits mode for some specific configurations
|
||||||
|
|
||||||
|
r118:
|
||||||
|
New : LZ4 Streaming API (Fast version), special thanks to Takayuki Matsuoka
|
||||||
|
New : datagen : parametrable synthetic data generator for tests
|
||||||
|
Improved : fuzzer, support more test cases, more parameters, ability to jump to specific test
|
||||||
|
fix : support ppc64le platform (issue 131)
|
||||||
|
fix : Issue 52 (malicious address space overflow in 32-bits mode when using large custom format)
|
||||||
|
fix : Makefile : minor issue 130 : header files permissions
|
||||||
|
|
||||||
|
r117:
|
||||||
|
Added : man pages for lz4c and lz4cat
|
||||||
|
Added : automated tests on Travis, thanks to Takayuki Matsuoka !
|
||||||
|
fix : block-dependency command line (issue 127)
|
||||||
|
fix : lz4fullbench (issue 128)
|
||||||
|
|
||||||
|
r116:
|
||||||
|
hotfix (issue 124 & 125)
|
||||||
|
|
||||||
|
r115:
|
||||||
|
Added : lz4cat utility, installed on POSX systems (issue 118)
|
||||||
|
OS-X compatible compilation of dynamic library (issue 115)
|
||||||
|
|
||||||
|
r114:
|
||||||
|
Makefile : library correctly compiled with -O3 switch (issue 114)
|
||||||
|
Makefile : library compilation compatible with clang
|
||||||
|
Makefile : library is versioned and linked (issue 119)
|
||||||
|
lz4.h : no more static inline prototypes (issue 116)
|
||||||
|
man : improved header/footer (issue 111)
|
||||||
|
Makefile : Use system default $(CC) & $(MAKE) variables (issue 112)
|
||||||
|
xxhash : updated to r34
|
||||||
|
|
||||||
|
r113:
|
||||||
|
Large decompression speed improvement for GCC 32-bits. Thanks to Valery Croizier !
|
||||||
|
LZ4HC : Compression Level is now a programmable parameter (CLI from 4 to 9)
|
||||||
|
Separated IO routines from command line (lz4io.c)
|
||||||
|
Version number into lz4.h (suggested by Francesc Alted)
|
||||||
|
|
||||||
|
r112:
|
||||||
|
quickfix
|
||||||
|
|
||||||
|
r111 :
|
||||||
|
Makefile : added capability to install libraries
|
||||||
|
Modified Directory tree, to better separate libraries from programs.
|
||||||
|
|
||||||
|
r110 :
|
||||||
|
lz4 & lz4hc : added capability to allocate state & stream state with custom allocator (issue 99)
|
||||||
|
fuzzer & fullbench : updated to test new functions
|
||||||
|
man : documented -l command (Legacy format, for Linux kernel compression) (issue 102)
|
||||||
|
cmake : improved version by Mika Attila, building programs and libraries (issue 100)
|
||||||
|
xxHash : updated to r33
|
||||||
|
Makefile : clean also delete local package .tar.gz
|
||||||
|
|
||||||
|
r109 :
|
||||||
|
lz4.c : corrected issue 98 (LZ4_compress_limitedOutput())
|
||||||
|
Makefile : can specify version number from makefile
|
||||||
|
|
||||||
|
r108 :
|
||||||
|
lz4.c : corrected compression efficiency issue 97 in 64-bits chained mode (-BD) for streams > 4 GB (thanks Roman Strashkin for reporting)
|
||||||
|
|
||||||
|
r107 :
|
||||||
|
Makefile : support DESTDIR for staged installs. Thanks Jorge Aparicio.
|
||||||
|
Makefile : make install installs both lz4 and lz4c (Jorge Aparicio)
|
||||||
|
Makefile : removed -Wno-implicit-declaration compilation switch
|
||||||
|
lz4cli.c : include <stduni.h> for isatty() (Luca Barbato)
|
||||||
|
lz4.h : introduced LZ4_MAX_INPUT_SIZE constant (Shay Green)
|
||||||
|
lz4.h : LZ4_compressBound() : unified macro and inline definitions (Shay Green)
|
||||||
|
lz4.h : LZ4_decompressSafe_partial() : clarify comments (Shay Green)
|
||||||
|
lz4.c : LZ4_compress() verify input size condition (Shay Green)
|
||||||
|
bench.c : corrected a bug in free memory size evaluation
|
||||||
|
cmake : install into bin/ directory (Richard Yao)
|
||||||
|
cmake : check for just C compiler (Elan Ruusamae)
|
||||||
|
|
||||||
|
r106 :
|
||||||
|
Makefile : make dist modify text files in the package to respect Unix EoL convention
|
||||||
|
lz4cli.c : corrected small display bug in HC mode
|
||||||
|
|
||||||
|
r105 :
|
||||||
|
Makefile : New install script and man page, contributed by Prasad Pandit
|
||||||
|
lz4cli.c : Minor modifications, for easier extensibility
|
||||||
|
COPYING : added license file
|
||||||
|
LZ4_Streaming_Format.odt : modified file name to remove white space characters
|
||||||
|
Makefile : .exe suffix now properly added only for Windows target
|
||||||
119
lz4/README.md
Normal file
119
lz4/README.md
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
LZ4 - Extremely fast compression
|
||||||
|
================================
|
||||||
|
|
||||||
|
LZ4 is lossless compression algorithm,
|
||||||
|
providing compression speed > 500 MB/s per core,
|
||||||
|
scalable with multi-cores CPU.
|
||||||
|
It features an extremely fast decoder,
|
||||||
|
with speed in multiple GB/s per core,
|
||||||
|
typically reaching RAM speed limits on multi-core systems.
|
||||||
|
|
||||||
|
Speed can be tuned dynamically, selecting an "acceleration" factor
|
||||||
|
which trades compression ratio for faster speed.
|
||||||
|
On the other end, a high compression derivative, LZ4_HC, is also provided,
|
||||||
|
trading CPU time for improved compression ratio.
|
||||||
|
All versions feature the same decompression speed.
|
||||||
|
|
||||||
|
LZ4 is also compatible with [dictionary compression](https://github.com/facebook/zstd#the-case-for-small-data-compression),
|
||||||
|
both at [API](https://github.com/lz4/lz4/blob/v1.8.3/lib/lz4frame.h#L481) and [CLI](https://github.com/lz4/lz4/blob/v1.8.3/programs/lz4.1.md#operation-modifiers) levels.
|
||||||
|
It can ingest any input file as dictionary, though only the final 64KB are used.
|
||||||
|
This capability can be combined with the [Zstandard Dictionary Builder](https://github.com/facebook/zstd/blob/v1.3.5/programs/zstd.1.md#dictionary-builder),
|
||||||
|
in order to drastically improve compression performance on small files.
|
||||||
|
|
||||||
|
LZ4 library is provided as open-source software using BSD 2-Clause license.
|
||||||
|
|
||||||
|
|
||||||
|
Benchmarks
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
The benchmark uses [lzbench], from @inikep
|
||||||
|
compiled with GCC v8.2.0 on Linux 64-bits (Ubuntu 4.18.0-17).
|
||||||
|
The reference system uses a Core i7-9700K CPU @ 4.9GHz (w/ turbo boost).
|
||||||
|
Benchmark evaluates the compression of reference [Silesia Corpus]
|
||||||
|
in single-thread mode.
|
||||||
|
|
||||||
|
[lzbench]: https://github.com/inikep/lzbench
|
||||||
|
[Silesia Corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
|
||||||
|
|
||||||
|
| Compressor | Factor | Compression | Decompression |
|
||||||
|
| ---------- | ----- | ----------- | ------------- |
|
||||||
|
| memcpy | 1.000 | 13700 MB/s | 13700 MB/s |
|
||||||
|
|**LZ4 default (v1.9.0)** |**2.101**| **780 MB/s**| **4970 MB/s** |
|
||||||
|
| LZO 2.09 | 2.108 | 670 MB/s | 860 MB/s |
|
||||||
|
| QuickLZ 1.5.0 | 2.238 | 575 MB/s | 780 MB/s |
|
||||||
|
| Snappy 1.1.4 | 2.091 | 565 MB/s | 1950 MB/s |
|
||||||
|
| [Zstandard] 1.4.0 -1 | 2.883 | 515 MB/s | 1380 MB/s |
|
||||||
|
| LZF v3.6 | 2.073 | 415 MB/s | 910 MB/s |
|
||||||
|
| [zlib] deflate 1.2.11 -1| 2.730 | 100 MB/s | 415 MB/s |
|
||||||
|
|**LZ4 HC -9 (v1.9.0)** |**2.721**| 41 MB/s | **4900 MB/s** |
|
||||||
|
| [zlib] deflate 1.2.11 -6| 3.099 | 36 MB/s | 445 MB/s |
|
||||||
|
|
||||||
|
[zlib]: http://www.zlib.net/
|
||||||
|
[Zstandard]: http://www.zstd.net/
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
make install # this command may require root permissions
|
||||||
|
```
|
||||||
|
|
||||||
|
LZ4's `Makefile` supports standard [Makefile conventions],
|
||||||
|
including [staged installs], [redirection], or [command redefinition].
|
||||||
|
It is compatible with parallel builds (`-j#`).
|
||||||
|
|
||||||
|
[Makefile conventions]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
|
||||||
|
[staged installs]: https://www.gnu.org/prep/standards/html_node/DESTDIR.html
|
||||||
|
[redirection]: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||||
|
[command redefinition]: https://www.gnu.org/prep/standards/html_node/Utilities-in-Makefiles.html
|
||||||
|
|
||||||
|
### Building LZ4 - Using vcpkg
|
||||||
|
|
||||||
|
You can download and install LZ4 using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||||
|
|
||||||
|
git clone https://github.com/Microsoft/vcpkg.git
|
||||||
|
cd vcpkg
|
||||||
|
./bootstrap-vcpkg.sh
|
||||||
|
./vcpkg integrate install
|
||||||
|
./vcpkg.exe install lz4
|
||||||
|
|
||||||
|
The LZ4 port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
The raw LZ4 block compression format is detailed within [lz4_Block_format].
|
||||||
|
|
||||||
|
Arbitrarily long files or data streams are compressed using multiple blocks,
|
||||||
|
for streaming requirements. These blocks are organized into a frame,
|
||||||
|
defined into [lz4_Frame_format].
|
||||||
|
Interoperable versions of LZ4 must also respect the frame format.
|
||||||
|
|
||||||
|
[lz4_Block_format]: doc/lz4_Block_format.md
|
||||||
|
[lz4_Frame_format]: doc/lz4_Frame_format.md
|
||||||
|
|
||||||
|
|
||||||
|
Other source versions
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Beyond the C reference source,
|
||||||
|
many contributors have created versions of lz4 in multiple languages
|
||||||
|
(Java, C#, Python, Perl, Ruby, etc.).
|
||||||
|
A list of known source ports is maintained on the [LZ4 Homepage].
|
||||||
|
|
||||||
|
[LZ4 Homepage]: http://www.lz4.org
|
||||||
|
|
||||||
|
### Packaging status
|
||||||
|
|
||||||
|
Most distributions are bundled with a package manager
|
||||||
|
which allows easy installation of both the `liblz4` library
|
||||||
|
and the `lz4` command line interface.
|
||||||
|
|
||||||
|
[](https://repology.org/project/lz4/versions)
|
||||||
|
|
||||||
|
|
||||||
|
### Special Thanks
|
||||||
|
|
||||||
|
- Takayuki Matsuoka, aka @t-mat, for exceptional first-class support throughout the lifetime of this project
|
||||||
17
lz4/SECURITY.md
Normal file
17
lz4/SECURITY.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
If you have discovered a security vulnerability in this project, please report it
|
||||||
|
privately. **Do not disclose it as a public issue.** This gives me time to work with you
|
||||||
|
to fix the issue before public exposure, reducing the chance that the exploit will be
|
||||||
|
used before a patch is released.
|
||||||
|
|
||||||
|
Please submit the report by filling out
|
||||||
|
[this form](https://github.com/lz4/lz4/security/advisories/new).
|
||||||
|
|
||||||
|
Please provide the following information in your report:
|
||||||
|
|
||||||
|
- A description of the vulnerability and its impact
|
||||||
|
- How to reproduce the issue
|
||||||
|
|
||||||
|
This project is maintained by a single maintainer on a reasonable-effort basis. As such,
|
||||||
|
I ask that you give me 90 days to work on a fix before public exposure.
|
||||||
87
lz4/appveyor.yml
Normal file
87
lz4/appveyor.yml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
version: 1.0.{build}
|
||||||
|
|
||||||
|
# Test matrix: MinGW compilers only (Visual Studio testing moved to GitHub Actions)
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- COMPILER: gcc
|
||||||
|
PLATFORM: mingw32
|
||||||
|
- COMPILER: gcc
|
||||||
|
PLATFORM: mingw64
|
||||||
|
- COMPILER: clang
|
||||||
|
PLATFORM: mingw64
|
||||||
|
|
||||||
|
install:
|
||||||
|
- echo Installing %COMPILER% %PLATFORM%
|
||||||
|
- mkdir bin
|
||||||
|
# Setup MinGW environment
|
||||||
|
- set "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin"
|
||||||
|
- set "PATH_MINGW64=c:\msys64\mingw64\bin;c:\msys64\usr\bin"
|
||||||
|
- copy C:\MinGW\bin\mingw32-make.exe C:\MinGW\bin\make.exe >nul 2>&1
|
||||||
|
- copy C:\MinGW\bin\gcc.exe C:\MinGW\bin\cc.exe >nul 2>&1
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- echo "*** Building %COMPILER% %PLATFORM% ***"
|
||||||
|
# Configure PATH for MinGW builds
|
||||||
|
- if [%PLATFORM%]==[mingw32] set PATH=%PATH_MINGW32%;%PATH%
|
||||||
|
- if [%PLATFORM%]==[mingw64] set PATH=%PATH_MINGW64%;%PATH%
|
||||||
|
|
||||||
|
# GCC Build
|
||||||
|
- if [%COMPILER%]==[gcc] (
|
||||||
|
echo "GCC build started" &&
|
||||||
|
gcc -v &&
|
||||||
|
make -v &&
|
||||||
|
make -j -C programs lz4 V=1 &&
|
||||||
|
make -j -C tests fullbench V=1 &&
|
||||||
|
make -j -C tests fuzzer V=1 &&
|
||||||
|
make -j -C lib lib V=1 LDFLAGS="-static-libgcc" &&
|
||||||
|
echo "Packaging GCC build..." &&
|
||||||
|
mkdir bin\dll bin\static bin\example bin\include &&
|
||||||
|
copy tests\fullbench.c bin\example\ &&
|
||||||
|
copy lib\xxhash.* bin\example\ &&
|
||||||
|
copy lib\lz4*.h bin\include\ &&
|
||||||
|
copy lib\liblz4.a bin\static\liblz4_static.lib &&
|
||||||
|
copy lib\liblz4.dll.a bin\dll\ >nul 2>&1 &&
|
||||||
|
(copy lib\liblz4.dll bin\dll\ 2>nul || copy lib\msys-lz4-1.dll bin\dll\liblz4.dll 2>nul || copy lib\cyglz4-1.dll bin\dll\liblz4.dll 2>nul || echo DLL copy warning) &&
|
||||||
|
copy lib\dll\example\* bin\example\ >nul 2>&1 &&
|
||||||
|
copy programs\lz4.exe bin\lz4.exe &&
|
||||||
|
copy tests\*.exe programs\
|
||||||
|
)
|
||||||
|
|
||||||
|
# Clang Build
|
||||||
|
- if [%COMPILER%]==[clang] (
|
||||||
|
echo "Clang build started" &&
|
||||||
|
clang -v &&
|
||||||
|
make -v &&
|
||||||
|
set "CFLAGS=--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" &&
|
||||||
|
make -j -C programs lz4 CC=clang V=1 &&
|
||||||
|
make -j -C tests fullbench CC=clang V=1 &&
|
||||||
|
make -j -C tests fuzzer CC=clang V=1 &&
|
||||||
|
make -j -C lib lib CC=clang V=1 &&
|
||||||
|
copy tests\*.exe programs\
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create release archives (GCC only)
|
||||||
|
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] 7z.exe a -bb1 bin\lz4_x64.zip NEWS .\bin\lz4.exe README.md .\bin\example .\bin\dll .\bin\static .\bin\include
|
||||||
|
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] appveyor PushArtifact bin\lz4_x64.zip
|
||||||
|
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] 7z.exe a -bb1 bin\lz4_x86.zip NEWS .\bin\lz4.exe README.md .\bin\example .\bin\dll .\bin\static .\bin\include
|
||||||
|
- if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] appveyor PushArtifact bin\lz4_x86.zip
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- echo "*** Testing %COMPILER% %PLATFORM% ***"
|
||||||
|
- cd programs
|
||||||
|
- lz4 -h
|
||||||
|
- lz4 -i1b lz4.exe
|
||||||
|
- lz4 -i1b5 lz4.exe
|
||||||
|
- lz4 -i1b10 lz4.exe
|
||||||
|
- lz4 -i1b15 lz4.exe
|
||||||
|
- echo "------- lz4 tested -------"
|
||||||
|
- fullbench.exe -i0 fullbench.exe
|
||||||
|
- echo "Launching fuzzer test..."
|
||||||
|
- fuzzer.exe -v -T20s
|
||||||
|
- cd ..
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
- path: bin\lz4_x64.zip
|
||||||
|
name: LZ4 Windows x64 Build
|
||||||
|
- path: bin\lz4_x86.zip
|
||||||
|
name: LZ4 Windows x86 Build
|
||||||
18
lz4/build/.gitignore
vendored
Normal file
18
lz4/build/.gitignore
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Visual C++
|
||||||
|
.vs/
|
||||||
|
*Copy
|
||||||
|
*.db
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
ver*/
|
||||||
|
VS2010/bin/
|
||||||
|
VS2017/bin/
|
||||||
|
VS*/bin/
|
||||||
|
ipch
|
||||||
|
|
||||||
|
# Fixup for lz4 project directories
|
||||||
|
!VS2010/lz4
|
||||||
|
!VS2017/lz4
|
||||||
|
!VS*/lz4
|
||||||
44
lz4/build/README.md
Normal file
44
lz4/build/README.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
Projects for various integrated development environments (IDE)
|
||||||
|
==============================================================
|
||||||
|
|
||||||
|
#### Included projects
|
||||||
|
|
||||||
|
The following projects are included with the lz4 distribution:
|
||||||
|
- `cmake` - CMake project
|
||||||
|
- `meson` - Meson project
|
||||||
|
- `visual` - scripts to generate Visual Studio solutions from `cmake` script
|
||||||
|
- `VS2022` - Visual Studio 2022 solution - will soon be deprecated, prefer `visual` generators
|
||||||
|
|
||||||
|
|
||||||
|
#### Projects available within VS2022\lz4.sln
|
||||||
|
|
||||||
|
The Visual Studio solution file `lz4.sln` contains many projects that will be compiled to the
|
||||||
|
`build\VS2010\bin\$(Platform)_$(Configuration)` directory. For example `lz4` set to `x64` and
|
||||||
|
`Release` will be compiled to `build\VS2010\bin\x64_Release\lz4.exe`. The solution file contains the
|
||||||
|
following projects:
|
||||||
|
|
||||||
|
- `lz4` : Command Line Utility, supporting gzip-like arguments
|
||||||
|
- `datagen` : Synthetic and parametrable data generator, for tests
|
||||||
|
- `frametest` : Test tool that checks lz4frame integrity on target platform
|
||||||
|
- `fullbench` : Precisely measure speed for each lz4 inner functions
|
||||||
|
- `fuzzer` : Test tool, to check lz4 integrity on target platform
|
||||||
|
- `liblz4` : A static LZ4 library compiled to `liblz4_static.lib`
|
||||||
|
- `liblz4-dll` : A dynamic LZ4 library (DLL) compiled to `liblz4.dll` with the import library `liblz4.lib`
|
||||||
|
- `fullbench-dll` : The fullbench program compiled with the import library; the executable requires LZ4 DLL
|
||||||
|
|
||||||
|
|
||||||
|
#### Using LZ4 DLL with Microsoft Visual C++ project
|
||||||
|
|
||||||
|
The header files `lib\lz4.h`, `lib\lz4hc.h`, `lib\lz4frame.h` and the import library
|
||||||
|
`build\VS2010\bin\$(Platform)_$(Configuration)\liblz4.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 `liblz4.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 LZ4 DLL which is available at
|
||||||
|
`build\VS2010\bin\$(Platform)_$(Configuration)\liblz4.dll`.
|
||||||
39
lz4/build/VS2022/_build.bat
Normal file
39
lz4/build/VS2022/_build.bat
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
set /a errorno=1
|
||||||
|
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
|
||||||
|
|
||||||
|
rem https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
|
||||||
|
|
||||||
|
set "sln=lz4.sln"
|
||||||
|
|
||||||
|
@rem set "Configuration=Debug"
|
||||||
|
@rem set "Platform=Win32"
|
||||||
|
|
||||||
|
set "BIN=.\bin\!Platform!_!Configuration!"
|
||||||
|
rmdir /S /Q "!BIN!" 2>nul
|
||||||
|
echo msbuild "%sln%" /p:Configuration=!Configuration! /p:Platform=!Platform!
|
||||||
|
msbuild "%sln%" ^
|
||||||
|
/nologo ^
|
||||||
|
/v:minimal ^
|
||||||
|
/m ^
|
||||||
|
/p:Configuration=!Configuration! ^
|
||||||
|
/p:Platform=!Platform! ^
|
||||||
|
/t:Clean,Build ^
|
||||||
|
|| goto :ERROR
|
||||||
|
|
||||||
|
if not exist "!BIN!\datagen.exe" ( echo FAIL: "!BIN!\datagen.exe" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\frametest.exe" ( echo FAIL: "!BIN!\frametest.exe" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\fullbench-dll.exe" ( echo FAIL: "!BIN!\fullbench-dll.exe" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\fullbench.exe" ( echo FAIL: "!BIN!\fullbench.exe" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\fuzzer.exe" ( echo FAIL: "!BIN!\fuzzer.exe" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\liblz4.dll" ( echo FAIL: "!BIN!\liblz4.dll" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\liblz4.lib" ( echo FAIL: "!BIN!\liblz4.lib" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\liblz4_static.lib" ( echo FAIL: "!BIN!\liblz4_static.lib" && goto :ERROR )
|
||||||
|
if not exist "!BIN!\lz4.exe" ( echo FAIL: "!BIN!\lz4.exe" && goto :ERROR )
|
||||||
|
|
||||||
|
set /a errorno=0
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
|
||||||
|
:END
|
||||||
|
exit /B %errorno%
|
||||||
35
lz4/build/VS2022/_setup.bat
Normal file
35
lz4/build/VS2022/_setup.bat
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
set /a errorno=1
|
||||||
|
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
|
||||||
|
|
||||||
|
rem https://github.com/Microsoft/vswhere
|
||||||
|
rem https://github.com/microsoft/vswhere/wiki/Find-VC#batch
|
||||||
|
|
||||||
|
set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||||
|
if not exist "%vswhere%" (
|
||||||
|
echo Failed to find "vswhere.exe". Please install the latest version of Visual Studio.
|
||||||
|
goto :ERROR
|
||||||
|
)
|
||||||
|
|
||||||
|
set "InstallDir="
|
||||||
|
for /f "usebackq tokens=*" %%i in (
|
||||||
|
`"%vswhere%" -latest ^
|
||||||
|
-products * ^
|
||||||
|
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^
|
||||||
|
-property installationPath`
|
||||||
|
) do (
|
||||||
|
set "InstallDir=%%i"
|
||||||
|
)
|
||||||
|
if "%InstallDir%" == "" (
|
||||||
|
echo Failed to find Visual C++. Please install the latest version of Visual C++.
|
||||||
|
goto :ERROR
|
||||||
|
)
|
||||||
|
|
||||||
|
call "%InstallDir%\VC\Auxiliary\Build\vcvars64.bat" || goto :ERROR
|
||||||
|
|
||||||
|
set /a errorno=0
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
|
||||||
|
:END
|
||||||
|
exit /B %errorno%
|
||||||
38
lz4/build/VS2022/_test.bat
Normal file
38
lz4/build/VS2022/_test.bat
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
set /a errorno=1
|
||||||
|
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
|
||||||
|
|
||||||
|
@rem set "Configuration=Debug"
|
||||||
|
@rem set "Platform=Win32"
|
||||||
|
|
||||||
|
set "BIN=.\bin\!Platform!_!Configuration!"
|
||||||
|
set "TEST_FILES=..\..\tests\COPYING"
|
||||||
|
|
||||||
|
echo !BIN!\lz4 -h
|
||||||
|
!BIN!\lz4 -h || goto :ERROR
|
||||||
|
|
||||||
|
echo !BIN!\lz4 -i1b
|
||||||
|
!BIN!\lz4 -i1b || goto :ERROR
|
||||||
|
|
||||||
|
echo !BIN!\lz4 -i1b5
|
||||||
|
!BIN!\lz4 -i1b5 || goto :ERROR
|
||||||
|
|
||||||
|
echo !BIN!\lz4 -i1b10
|
||||||
|
!BIN!\lz4 -i1b10 || goto :ERROR
|
||||||
|
|
||||||
|
echo !BIN!\lz4 -i1b15
|
||||||
|
!BIN!\lz4 -i1b15 || goto :ERROR
|
||||||
|
|
||||||
|
echo fullbench
|
||||||
|
!BIN!\fullbench.exe --no-prompt -i1 %TEST_FILES% || goto :ERROR
|
||||||
|
|
||||||
|
echo fuzzer
|
||||||
|
!BIN!\fuzzer.exe -v -T30s || goto :ERROR
|
||||||
|
|
||||||
|
|
||||||
|
set /a errorno=0
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
|
||||||
|
:END
|
||||||
|
exit /B %errorno%
|
||||||
26
lz4/build/VS2022/build-and-test-win32-debug.bat
Normal file
26
lz4/build/VS2022/build-and-test-win32-debug.bat
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@setlocal enabledelayedexpansion
|
||||||
|
@echo off
|
||||||
|
set /a errorno=1
|
||||||
|
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
|
||||||
|
|
||||||
|
call _setup.bat || goto :ERROR
|
||||||
|
|
||||||
|
set "Configuration=Debug"
|
||||||
|
set "Platform=Win32"
|
||||||
|
|
||||||
|
call _build.bat || goto :ERROR
|
||||||
|
call _test.bat || goto :ERROR
|
||||||
|
|
||||||
|
|
||||||
|
echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
|
||||||
|
set /a errorno=0
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
echo Abort by error.
|
||||||
|
echo Build Status -%esc%[91m ERROR %esc%[0m
|
||||||
|
|
||||||
|
|
||||||
|
:END
|
||||||
|
exit /B %errorno%
|
||||||
26
lz4/build/VS2022/build-and-test-win32-release.bat
Normal file
26
lz4/build/VS2022/build-and-test-win32-release.bat
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@setlocal enabledelayedexpansion
|
||||||
|
@echo off
|
||||||
|
set /a errorno=1
|
||||||
|
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
|
||||||
|
|
||||||
|
call _setup.bat || goto :ERROR
|
||||||
|
|
||||||
|
set "Configuration=Release"
|
||||||
|
set "Platform=Win32"
|
||||||
|
|
||||||
|
call _build.bat || goto :ERROR
|
||||||
|
call _test.bat || goto :ERROR
|
||||||
|
|
||||||
|
|
||||||
|
echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
|
||||||
|
set /a errorno=0
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
echo Abort by error.
|
||||||
|
echo Build Status -%esc%[91m ERROR %esc%[0m
|
||||||
|
|
||||||
|
|
||||||
|
:END
|
||||||
|
exit /B %errorno%
|
||||||
26
lz4/build/VS2022/build-and-test-x64-debug.bat
Normal file
26
lz4/build/VS2022/build-and-test-x64-debug.bat
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@setlocal enabledelayedexpansion
|
||||||
|
@echo off
|
||||||
|
set /a errorno=1
|
||||||
|
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
|
||||||
|
|
||||||
|
call _setup.bat || goto :ERROR
|
||||||
|
|
||||||
|
set "Configuration=Debug"
|
||||||
|
set "Platform=x64"
|
||||||
|
|
||||||
|
call _build.bat || goto :ERROR
|
||||||
|
call _test.bat || goto :ERROR
|
||||||
|
|
||||||
|
|
||||||
|
echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
|
||||||
|
set /a errorno=0
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
echo Abort by error.
|
||||||
|
echo Build Status -%esc%[91m ERROR %esc%[0m
|
||||||
|
|
||||||
|
|
||||||
|
:END
|
||||||
|
exit /B %errorno%
|
||||||
26
lz4/build/VS2022/build-and-test-x64-release.bat
Normal file
26
lz4/build/VS2022/build-and-test-x64-release.bat
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@setlocal enabledelayedexpansion
|
||||||
|
@echo off
|
||||||
|
set /a errorno=1
|
||||||
|
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
|
||||||
|
|
||||||
|
call _setup.bat || goto :ERROR
|
||||||
|
|
||||||
|
set "Configuration=Release"
|
||||||
|
set "Platform=x64"
|
||||||
|
|
||||||
|
call _build.bat || goto :ERROR
|
||||||
|
call _test.bat || goto :ERROR
|
||||||
|
|
||||||
|
|
||||||
|
echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
|
||||||
|
set /a errorno=0
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
echo Abort by error.
|
||||||
|
echo Build Status -%esc%[91m ERROR %esc%[0m
|
||||||
|
|
||||||
|
|
||||||
|
:END
|
||||||
|
exit /B %errorno%
|
||||||
177
lz4/build/VS2022/datagen/datagen.vcxproj
Normal file
177
lz4/build/VS2022/datagen/datagen.vcxproj
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{D745AE2F-596A-403A-9B91-81A8C6779243}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>datagen</RootNamespace>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\programs\lorem.c" />
|
||||||
|
<ClCompile Include="..\..\..\tests\datagen.c" />
|
||||||
|
<ClCompile Include="..\..\..\tests\datagencli.c" />
|
||||||
|
<ClCompile Include="..\..\..\tests\loremOut.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\programs\lorem.h" />
|
||||||
|
<ClInclude Include="..\..\..\tests\datagen.h" />
|
||||||
|
<ClInclude Include="..\..\..\tests\loremOut.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
182
lz4/build/VS2022/frametest/frametest.vcxproj
Normal file
182
lz4/build/VS2022/frametest/frametest.vcxproj
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>frametest</RootNamespace>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4file.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
||||||
|
<ClCompile Include="..\..\..\tests\frametest.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4file.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
184
lz4/build/VS2022/fullbench-dll/fullbench-dll.vcxproj
Normal file
184
lz4/build/VS2022/fullbench-dll/fullbench-dll.vcxproj
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{13992FD2-077E-4954-B065-A428198201A9}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>fullbench-dll</RootNamespace>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
||||||
|
<ClCompile Include="..\..\..\tests\fullbench.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
180
lz4/build/VS2022/fullbench/fullbench.vcxproj
Normal file
180
lz4/build/VS2022/fullbench/fullbench.vcxproj
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>fullbench</RootNamespace>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
||||||
|
<ClCompile Include="..\..\..\tests\fullbench.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
177
lz4/build/VS2022/fuzzer/fuzzer.vcxproj
Normal file
177
lz4/build/VS2022/fuzzer/fuzzer.vcxproj
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{18B9F1A7-9C66-4352-898B-30804DADE0FD}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>fuzzer</RootNamespace>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
||||||
|
<ClCompile Include="..\..\..\tests\fuzzer.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
51
lz4/build/VS2022/liblz4-dll/liblz4-dll.rc
Normal file
51
lz4/build/VS2022/liblz4-dll/liblz4-dll.rc
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "lz4.h" /* LZ4_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 LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0
|
||||||
|
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_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"
|
||||||
|
VALUE "FileDescription", "Extremely fast compression"
|
||||||
|
VALUE "FileVersion", LZ4_VERSION_STRING
|
||||||
|
VALUE "InternalName", "lz4.dll"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet"
|
||||||
|
VALUE "OriginalFilename", "lz4.dll"
|
||||||
|
VALUE "ProductName", "LZ4"
|
||||||
|
VALUE "ProductVersion", LZ4_VERSION_STRING
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif
|
||||||
183
lz4/build/VS2022/liblz4-dll/liblz4-dll.vcxproj
Normal file
183
lz4/build/VS2022/liblz4-dll/liblz4-dll.vcxproj
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{9800039D-4AAA-43A4-BB78-FEF6F4836927}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>liblz4-dll</RootNamespace>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
<ProjectName>liblz4-dll</ProjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<TargetName>liblz4</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<TargetName>liblz4</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<TargetName>liblz4</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<TargetName>liblz4</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="liblz4-dll.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
179
lz4/build/VS2022/liblz4/liblz4.vcxproj
Normal file
179
lz4/build/VS2022/liblz4/liblz4.vcxproj
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>liblz4</RootNamespace>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization Condition="'$(EnableWholeProgramOptimization)'=='true'">true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<TargetName>liblz4_static</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<TargetName>liblz4_static</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<TargetName>liblz4_static</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<TargetName>liblz4_static</TargetName>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>false</EnablePREfast>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWarningAsError>false</TreatWarningAsError>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<AdditionalOptions>/analyze:stacksize295252 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary Condition="'$(UseStaticCRT)'=='true'">MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
106
lz4/build/VS2022/lz4.sln
Normal file
106
lz4/build/VS2022/lz4.sln
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.6.33712.159
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4-dll", "liblz4-dll\liblz4-dll.vcxproj", "{9800039D-4AAA-43A4-BB78-FEF6F4836927}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "liblz4\liblz4.vcxproj", "{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fuzzer", "fuzzer\fuzzer.vcxproj", "{18B9F1A7-9C66-4352-898B-30804DADE0FD}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench", "fullbench\fullbench.vcxproj", "{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frametest", "frametest\frametest.vcxproj", "{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datagen", "datagen\datagen.vcxproj", "{D745AE2F-596A-403A-9B91-81A8C6779243}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll\fullbench-dll.vcxproj", "{13992FD2-077E-4954-B065-A428198201A9}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927} = {9800039D-4AAA-43A4-BB78-FEF6F4836927}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lz4", "lz4\lz4.vcxproj", "{60A3115E-B988-41EE-8815-F4D4F253D866}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476} = {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}
|
||||||
|
EndProjectSection
|
||||||
|
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
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.Build.0 = Release|x64
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.Build.0 = Release|x64
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.Build.0 = Release|x64
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.Build.0 = Release|x64
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.Build.0 = Release|x64
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.Build.0 = Release|x64
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{13992FD2-077E-4954-B065-A428198201A9}.Release|x64.Build.0 = Release|x64
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.Build.0 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {BBC259B2-BABF-47CD-8A6A-7B8318A803AC}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
51
lz4/build/VS2022/lz4/lz4.rc
Normal file
51
lz4/build/VS2022/lz4/lz4.rc
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "lz4.h" /* LZ4_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 LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0
|
||||||
|
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_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"
|
||||||
|
VALUE "FileDescription", "Extremely fast compression"
|
||||||
|
VALUE "FileVersion", LZ4_VERSION_STRING
|
||||||
|
VALUE "InternalName", "lz4.exe"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet"
|
||||||
|
VALUE "OriginalFilename", "lz4.exe"
|
||||||
|
VALUE "ProductName", "LZ4"
|
||||||
|
VALUE "ProductVersion", LZ4_VERSION_STRING
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif
|
||||||
189
lz4/build/VS2022/lz4/lz4.vcxproj
Normal file
189
lz4/build/VS2022/lz4/lz4.vcxproj
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
|
<ProjectGuid>{60A3115E-B988-41EE-8815-F4D4F253D866}</ProjectGuid>
|
||||||
|
<RootNamespace>lz4</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
<IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>false</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>false</EnableCOMDATFolding>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4frame.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\lz4hc.c" />
|
||||||
|
<ClCompile Include="..\..\..\lib\xxhash.c" />
|
||||||
|
<ClCompile Include="..\..\..\programs\bench.c" />
|
||||||
|
<ClCompile Include="..\..\..\programs\lorem.c" />
|
||||||
|
<ClCompile Include="..\..\..\programs\lz4cli.c" />
|
||||||
|
<ClCompile Include="..\..\..\programs\lz4io.c" />
|
||||||
|
<ClCompile Include="..\..\..\programs\threadpool.c" />
|
||||||
|
<ClCompile Include="..\..\..\programs\timefn.c" />
|
||||||
|
<ClCompile Include="..\..\..\programs\util.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4frame_static.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\lz4hc.h" />
|
||||||
|
<ClInclude Include="..\..\..\lib\xxhash.h" />
|
||||||
|
<ClInclude Include="..\..\..\programs\bench.h" />
|
||||||
|
<ClInclude Include="..\..\..\programs\lorem.h" />
|
||||||
|
<ClInclude Include="..\..\..\programs\lz4io.h" />
|
||||||
|
<ClInclude Include="..\..\..\programs\util.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="lz4.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
10
lz4/build/cmake/.gitignore
vendored
Normal file
10
lz4/build/cmake/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# cmake build artefact
|
||||||
|
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
*.cmake
|
||||||
|
Makefile
|
||||||
|
liblz4.pc
|
||||||
|
lz4c
|
||||||
|
install_manifest.txt
|
||||||
|
build
|
||||||
362
lz4/build/cmake/CMakeLists.txt
Normal file
362
lz4/build/cmake/CMakeLists.txt
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
# CMake support for LZ4
|
||||||
|
#
|
||||||
|
# To the extent possible under law, the author(s) have dedicated all
|
||||||
|
# copyright and related and neighboring rights to this software to
|
||||||
|
# the public domain worldwide. This software is distributed without
|
||||||
|
# any warranty.
|
||||||
|
#
|
||||||
|
# For details, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
|
||||||
|
|
||||||
|
# Use range version specification for policy control while maintaining
|
||||||
|
# compatibility with older CMake versions
|
||||||
|
cmake_minimum_required(VERSION 3.5...4.0.2)
|
||||||
|
|
||||||
|
set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# VERSION EXTRACTION - Parse version information from header file
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
function(parse_lz4_version VERSION_TYPE)
|
||||||
|
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" version_line REGEX "^#define LZ4_VERSION_${VERSION_TYPE} +([0-9]+).*$")
|
||||||
|
string(REGEX REPLACE "^#define LZ4_VERSION_${VERSION_TYPE} +([0-9]+).*$" "\\1" version_number "${version_line}")
|
||||||
|
set(LZ4_VERSION_${VERSION_TYPE} ${version_number} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
foreach(version_type IN ITEMS MAJOR MINOR RELEASE)
|
||||||
|
parse_lz4_version(${version_type})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(LZ4_VERSION_STRING "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}")
|
||||||
|
mark_as_advanced(LZ4_VERSION_STRING LZ4_VERSION_MAJOR LZ4_VERSION_MINOR LZ4_VERSION_RELEASE)
|
||||||
|
|
||||||
|
message(STATUS "Creating build script for LZ4 version: ${LZ4_VERSION_STRING}")
|
||||||
|
|
||||||
|
project(LZ4 VERSION ${LZ4_VERSION_STRING} LANGUAGES C)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# DEFAULT BUILD TYPE - Set Release as default when no build type is specified
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# 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()
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# BUILD OPTIONS - Configure build targets and features
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
option(LZ4_BUILD_CLI "Build lz4 program" ON)
|
||||||
|
option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c program with legacy argument support" OFF)
|
||||||
|
|
||||||
|
|
||||||
|
# Determine if LZ4 is being built as part of another project.
|
||||||
|
# If LZ4 is bundled in another project, we don't want to install anything.
|
||||||
|
# Default behavior can be overridden by setting the LZ4_BUNDLED_MODE variable.
|
||||||
|
if(NOT DEFINED LZ4_BUNDLED_MODE)
|
||||||
|
get_directory_property(LZ4_IS_SUBPROJECT PARENT_DIRECTORY)
|
||||||
|
if(LZ4_IS_SUBPROJECT)
|
||||||
|
set(LZ4_BUNDLED_MODE ON)
|
||||||
|
else()
|
||||||
|
set(LZ4_BUNDLED_MODE OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
mark_as_advanced(LZ4_BUNDLED_MODE)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# PACKAGING - CPack configuration
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
if(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED)
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library")
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${LZ4_TOP_SOURCE_DIR}/README.md")
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${LZ4_TOP_SOURCE_DIR}/LICENSE")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${LZ4_VERSION_MAJOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${LZ4_VERSION_MINOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${LZ4_VERSION_RELEASE})
|
||||||
|
include(CPack)
|
||||||
|
endif(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# LIBRARY TYPE CONFIGURATION - Static vs Shared libraries
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Allow people to choose whether to build shared or static libraries
|
||||||
|
# via the BUILD_SHARED_LIBS option unless we are in bundled mode, in
|
||||||
|
# which case we always use static libraries.
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
CMAKE_DEPENDENT_OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON "NOT LZ4_BUNDLED_MODE" OFF)
|
||||||
|
CMAKE_DEPENDENT_OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF "BUILD_SHARED_LIBS" ON)
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
|
||||||
|
message(FATAL_ERROR "Both BUILD_SHARED_LIBS and BUILD_STATIC_LIBS have been disabled")
|
||||||
|
endif(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# SOURCE FILES & DIRECTORIES - Path setup and source file collection
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
set(LZ4_LIB_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/lib")
|
||||||
|
set(LZ4_PROG_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/programs")
|
||||||
|
|
||||||
|
include_directories("${LZ4_LIB_SOURCE_DIR}")
|
||||||
|
|
||||||
|
# CLI sources
|
||||||
|
file(GLOB LZ4_SOURCES
|
||||||
|
"${LZ4_LIB_SOURCE_DIR}/*.c")
|
||||||
|
file(GLOB LZ4_CLI_SOURCES
|
||||||
|
"${LZ4_PROG_SOURCE_DIR}/*.c")
|
||||||
|
list(APPEND LZ4_CLI_SOURCES ${LZ4_SOURCES}) # LZ4_CLI always use liblz4 sources directly.
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# POSITION INDEPENDENT CODE - PIC settings for static libraries
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Whether to use position independent code for the static library. If
|
||||||
|
# we're building a shared library this is ignored and PIC is always
|
||||||
|
# used.
|
||||||
|
if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE OR CMAKE_POSITION_INDEPENDENT_CODE)
|
||||||
|
set(LZ4_POSITION_INDEPENDENT_LIB_DEFAULT ON)
|
||||||
|
else()
|
||||||
|
set(LZ4_POSITION_INDEPENDENT_LIB_DEFAULT OFF)
|
||||||
|
endif(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE OR CMAKE_POSITION_INDEPENDENT_CODE)
|
||||||
|
|
||||||
|
option(LZ4_POSITION_INDEPENDENT_LIB "Use position independent code for static library (if applicable)" ${LZ4_POSITION_INDEPENDENT_LIB_DEFAULT})
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# TARGETS - Library and executable targets
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# liblz4
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
set(LZ4_LIBRARIES_BUILT)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
add_library(lz4_shared SHARED ${LZ4_SOURCES})
|
||||||
|
target_include_directories(lz4_shared
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${LZ4_LIB_SOURCE_DIR}>
|
||||||
|
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
|
set_target_properties(lz4_shared PROPERTIES
|
||||||
|
OUTPUT_NAME lz4
|
||||||
|
SOVERSION "${LZ4_VERSION_MAJOR}"
|
||||||
|
VERSION "${LZ4_VERSION_STRING}")
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_definitions(lz4_shared PRIVATE
|
||||||
|
LZ4_DLL_EXPORT=1)
|
||||||
|
endif(MSVC)
|
||||||
|
list(APPEND LZ4_LIBRARIES_BUILT lz4_shared)
|
||||||
|
endif()
|
||||||
|
if(BUILD_STATIC_LIBS)
|
||||||
|
set(STATIC_LIB_NAME lz4)
|
||||||
|
if(MSVC AND BUILD_SHARED_LIBS)
|
||||||
|
set(STATIC_LIB_NAME lz4_static)
|
||||||
|
endif(MSVC AND BUILD_SHARED_LIBS)
|
||||||
|
add_library(lz4_static STATIC ${LZ4_SOURCES})
|
||||||
|
target_include_directories(lz4_static
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${LZ4_LIB_SOURCE_DIR}>
|
||||||
|
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
|
set_target_properties(lz4_static PROPERTIES
|
||||||
|
OUTPUT_NAME ${STATIC_LIB_NAME}
|
||||||
|
POSITION_INDEPENDENT_CODE ${LZ4_POSITION_INDEPENDENT_LIB})
|
||||||
|
list(APPEND LZ4_LIBRARIES_BUILT lz4_static)
|
||||||
|
endif()
|
||||||
|
# Add unified target.
|
||||||
|
add_library(lz4 INTERFACE)
|
||||||
|
list(APPEND LZ4_LIBRARIES_BUILT lz4)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_link_libraries(lz4 INTERFACE lz4_shared)
|
||||||
|
else()
|
||||||
|
target_link_libraries(lz4 INTERFACE lz4_static)
|
||||||
|
endif(BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# DEBUG CONFIGURATION - Configurable LZ4_DEBUG level
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# LZ4_DEBUG levels:
|
||||||
|
# 0 - Disable everything (default for Release)
|
||||||
|
# 1 - Enable assert() statements
|
||||||
|
# 2-8 - Enable debug traces with increasing verbosity
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(LZ4_DEBUG_LEVEL_DEFAULT 1)
|
||||||
|
else()
|
||||||
|
set(LZ4_DEBUG_LEVEL_DEFAULT 0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LZ4_DEBUG_LEVEL ${LZ4_DEBUG_LEVEL_DEFAULT} CACHE STRING
|
||||||
|
"LZ4 debug level: 0=disabled, 1=assert(), 2-8=debug traces with increasing verbosity")
|
||||||
|
set_property(CACHE LZ4_DEBUG_LEVEL PROPERTY STRINGS "0" "1" "2" "3" "4" "5" "6" "7" "8")
|
||||||
|
|
||||||
|
# Apply LZ4_DEBUG configuration if level > 0
|
||||||
|
if(LZ4_DEBUG_LEVEL GREATER 0)
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(/DLZ4_DEBUG=${LZ4_DEBUG_LEVEL})
|
||||||
|
else()
|
||||||
|
add_definitions(-DLZ4_DEBUG=${LZ4_DEBUG_LEVEL})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# NAMESPACE CONFIGURATION - xxHash namespace settings
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# xxhash namespace
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(lz4_shared PRIVATE
|
||||||
|
XXH_NAMESPACE=LZ4_)
|
||||||
|
endif(BUILD_SHARED_LIBS)
|
||||||
|
if(BUILD_STATIC_LIBS)
|
||||||
|
target_compile_definitions(lz4_static PRIVATE
|
||||||
|
XXH_NAMESPACE=LZ4_)
|
||||||
|
endif(BUILD_STATIC_LIBS)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# CLI EXECUTABLES - Configuring command-line programs
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# lz4
|
||||||
|
if(LZ4_BUILD_CLI)
|
||||||
|
set(LZ4_PROGRAMS_BUILT lz4cli)
|
||||||
|
add_executable(lz4cli ${LZ4_CLI_SOURCES})
|
||||||
|
set_target_properties(lz4cli PROPERTIES OUTPUT_NAME lz4)
|
||||||
|
endif(LZ4_BUILD_CLI)
|
||||||
|
|
||||||
|
# lz4c
|
||||||
|
if(LZ4_BUILD_LEGACY_LZ4C)
|
||||||
|
list(APPEND LZ4_PROGRAMS_BUILT lz4c)
|
||||||
|
add_executable(lz4c ${LZ4_CLI_SOURCES})
|
||||||
|
set_target_properties(lz4c PROPERTIES COMPILE_DEFINITIONS "ENABLE_LZ4C_LEGACY_OPTIONS")
|
||||||
|
endif(LZ4_BUILD_LEGACY_LZ4C)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# COMPILER FLAGS - Configure warning flags and compiler-specific options
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Extra warning flags
|
||||||
|
if(MSVC)
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W4")
|
||||||
|
else()
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
foreach(flag
|
||||||
|
# GCC-style
|
||||||
|
-pedantic-errors
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wundef
|
||||||
|
-Wcast-qual
|
||||||
|
-Wcast-align
|
||||||
|
-Wshadow
|
||||||
|
-Wswitch-enum
|
||||||
|
-Wdeclaration-after-statement
|
||||||
|
-Wstrict-prototypes
|
||||||
|
-Wpointer-arith)
|
||||||
|
|
||||||
|
# Because https://gcc.gnu.org/wiki/FAQ#wnowarning
|
||||||
|
string(REGEX REPLACE "\\-Wno\\-(.+)" "-W\\1" flag_to_test "${flag}")
|
||||||
|
string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" test_name "CFLAG_${flag_to_test}")
|
||||||
|
|
||||||
|
check_c_compiler_flag("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${test_name})
|
||||||
|
|
||||||
|
if(${test_name})
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "${flag} ${CMAKE_C_FLAGS_DEBUG}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
unset(test_name)
|
||||||
|
unset(flag_to_test)
|
||||||
|
endforeach(flag)
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# INSTALLATION - Install targets, headers, and documentation
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
if(NOT LZ4_BUNDLED_MODE)
|
||||||
|
install(TARGETS ${LZ4_PROGRAMS_BUILT}
|
||||||
|
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
install(TARGETS ${LZ4_LIBRARIES_BUILT}
|
||||||
|
EXPORT lz4Targets
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
install(FILES
|
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4.h"
|
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4hc.h"
|
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4frame.h"
|
||||||
|
"${LZ4_LIB_SOURCE_DIR}/lz4file.h"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
install(FILES "${LZ4_PROG_SOURCE_DIR}/lz4.1"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblz4.pc"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# CMAKE PACKAGE CONFIG - Configure CMake package for find_package support
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
write_basic_package_version_file(
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/lz4ConfigVersion.cmake"
|
||||||
|
VERSION ${LZ4_VERSION_STRING}
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
|
set(LZ4_PKG_INSTALLDIR "${CMAKE_INSTALL_LIBDIR}/cmake/lz4")
|
||||||
|
configure_package_config_file(
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/lz4Config.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/lz4Config.cmake"
|
||||||
|
INSTALL_DESTINATION ${LZ4_PKG_INSTALLDIR})
|
||||||
|
export(EXPORT lz4Targets
|
||||||
|
FILE ${CMAKE_CURRENT_BINARY_DIR}/lz4Targets.cmake
|
||||||
|
NAMESPACE LZ4::)
|
||||||
|
|
||||||
|
install(EXPORT lz4Targets
|
||||||
|
FILE lz4Targets.cmake
|
||||||
|
NAMESPACE LZ4::
|
||||||
|
DESTINATION ${LZ4_PKG_INSTALLDIR})
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/lz4Config.cmake
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/lz4ConfigVersion.cmake
|
||||||
|
DESTINATION ${LZ4_PKG_INSTALLDIR})
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# SYMLINKS - Create and install Unix symlinks and manpage aliases
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Install lz4cat and unlz4 symlinks on Unix systems
|
||||||
|
if(UNIX AND LZ4_BUILD_CLI)
|
||||||
|
foreach(cli_tool IN ITEMS lz4cat unlz4)
|
||||||
|
# Create a custom target for the symlink creation
|
||||||
|
add_custom_target("create_${cli_tool}_symlink" ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||||
|
$<TARGET_FILE_NAME:lz4cli> ${cli_tool}
|
||||||
|
DEPENDS lz4cli
|
||||||
|
COMMENT "Creating symlink for ${cli_tool}"
|
||||||
|
VERBATIM)
|
||||||
|
|
||||||
|
# Install the symlink into the binary installation directory
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${cli_tool}"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
RENAME ${cli_tool})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# create manpage aliases
|
||||||
|
foreach(f lz4cat unlz4)
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" ".so man1/lz4.1\n")
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${f}.1"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
|
||||||
|
endforeach()
|
||||||
|
endif(UNIX AND LZ4_BUILD_CLI)
|
||||||
|
endif(NOT LZ4_BUNDLED_MODE)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# PKG-CONFIG - Generate and install pkg-config file
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# pkg-config
|
||||||
|
set(PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
if("${CMAKE_INSTALL_FULL_LIBDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
set(LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
else()
|
||||||
|
set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||||
|
endif("${CMAKE_INSTALL_FULL_LIBDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
if("${CMAKE_INSTALL_FULL_INCLUDEDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
set(INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
else()
|
||||||
|
set(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
|
||||||
|
endif("${CMAKE_INSTALL_FULL_INCLUDEDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
|
||||||
|
# for liblz4.pc substitution
|
||||||
|
set(VERSION ${LZ4_VERSION_STRING})
|
||||||
|
configure_file(${LZ4_LIB_SOURCE_DIR}/liblz4.pc.in liblz4.pc @ONLY)
|
||||||
10
lz4/build/cmake/lz4Config.cmake.in
Normal file
10
lz4/build/cmake/lz4Config.cmake.in
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
@PACKAGE_INIT@
|
||||||
|
include( "${CMAKE_CURRENT_LIST_DIR}/lz4Targets.cmake" )
|
||||||
|
if(NOT TARGET lz4::lz4)
|
||||||
|
add_library(lz4::lz4 INTERFACE IMPORTED)
|
||||||
|
if("@BUILD_SHARED_LIBS@")
|
||||||
|
set_target_properties(lz4::lz4 PROPERTIES INTERFACE_LINK_LIBRARIES LZ4::lz4_shared)
|
||||||
|
else()
|
||||||
|
set_target_properties(lz4::lz4 PROPERTIES INTERFACE_LINK_LIBRARIES LZ4::lz4_static)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
69
lz4/build/make/README.md
Normal file
69
lz4/build/make/README.md
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# multiconf.make
|
||||||
|
|
||||||
|
**multiconf.make** is a self-contained Makefile include that lets you build the **same targets under many different flag sets**—debug vs release, ASan vs UBSan, GCC vs Clang, etc.—without the usual “object-file soup.”
|
||||||
|
It hashes every combination of `CC/CXX`, `CFLAGS/CXXFLAGS`, `CPPFLAGS`, `LDFLAGS` and `LDLIBS` into a **dedicated cache directory**, so objects compiled with one configuration are never reused by another. Swap flags, rebuild, swap back—previous objects are still there and never collide.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key Benefits
|
||||||
|
|
||||||
|
| Why it matters | What multiconf.make does |
|
||||||
|
| --- | --- |
|
||||||
|
| **Isolated configs** | Stores objects into `cachedObjs/<hash>/`, one directory per unique flag set. |
|
||||||
|
| **Fast switching** | Reusing an old config is instant—link only, no recompilation. |
|
||||||
|
| **Header deps** | Edits to headers trigger only needed rebuilds. |
|
||||||
|
| **One-liner targets** | Macros (`c_program`, `cxx_program`, …) hide all rule boilerplate. |
|
||||||
|
| **Parallel-ready** | Safe with `make -j`, no duplicate compiles of shared sources. |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### 1 · List your sources
|
||||||
|
|
||||||
|
```make
|
||||||
|
C_SRCDIRS := src src/cdeps # all .c are in these directories
|
||||||
|
CXX_SRCDIRS := src src/cxxdeps # all .cpp are in these directories
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2 · Add and include
|
||||||
|
|
||||||
|
```make
|
||||||
|
# root/Makefile
|
||||||
|
include multiconf.make
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3 · Declare targets
|
||||||
|
|
||||||
|
```make
|
||||||
|
app:
|
||||||
|
$(eval $(call c_program,app,app.o obj1.o obj2.o))
|
||||||
|
test:
|
||||||
|
$(eval $(call cxx_program,test, test.o objcxx1.o objcxx2.o))
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4 · Build any config you like
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Release with GCC
|
||||||
|
make CFLAGS="-O3"
|
||||||
|
|
||||||
|
# Debug with Clang + AddressSanitizer (new cache dir)
|
||||||
|
make CC=clang CFLAGS="-g -O0 -fsanitize=address"
|
||||||
|
|
||||||
|
# Switch back to GCC release (objects still valid, relink only)
|
||||||
|
make CFLAGS="-O3"
|
||||||
|
```
|
||||||
|
|
||||||
|
Objects for each command live in different sub-folders; nothing overlaps.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Additional capabilities
|
||||||
|
|
||||||
|
| Command | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| `make clean_cache` | Wipe **all** cached objects & deps (full rebuild next time) |
|
||||||
|
| `V=1` | Show full compile/link commands |
|
||||||
|
|
||||||
|
---
|
||||||
120
lz4/build/make/lz4defs.make
Normal file
120
lz4/build/make/lz4defs.make
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
# ################################################################
|
||||||
|
# LZ4 - Makefile common definitions
|
||||||
|
# Copyright (C) Yann Collet 2020
|
||||||
|
# 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 :
|
||||||
|
# - LZ4 source repository : https://github.com/lz4/lz4
|
||||||
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
# ################################################################
|
||||||
|
|
||||||
|
UNAME ?= uname
|
||||||
|
|
||||||
|
TARGET_OS ?= $(shell $(UNAME))
|
||||||
|
ifeq ($(TARGET_OS),)
|
||||||
|
TARGET_OS ?= $(OS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Default to parallel builds unless a -j flag is already provided.
|
||||||
|
ifeq (,$(filter -j%,$(MAKEFLAGS)))
|
||||||
|
NPROC ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
|
||||||
|
MAKEFLAGS += -j$(NPROC)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter Windows%,$(TARGET_OS)))
|
||||||
|
LIBLZ4_NAME = liblz4-$(LIBVER_MAJOR)
|
||||||
|
LIBLZ4_EXP = liblz4.lib
|
||||||
|
WINBASED = yes
|
||||||
|
else
|
||||||
|
LIBLZ4_EXP = liblz4.dll.a
|
||||||
|
ifneq (,$(filter MINGW%,$(TARGET_OS)))
|
||||||
|
LIBLZ4_NAME = liblz4
|
||||||
|
WINBASED = yes
|
||||||
|
else
|
||||||
|
ifneq (,$(filter MSYS%,$(TARGET_OS)))
|
||||||
|
LIBLZ4_NAME = msys-lz4-$(LIBVER_MAJOR)
|
||||||
|
WINBASED = yes
|
||||||
|
else
|
||||||
|
ifneq (,$(filter CYGWIN%,$(TARGET_OS)))
|
||||||
|
LIBLZ4_NAME = cyglz4-$(LIBVER_MAJOR)
|
||||||
|
WINBASED = yes
|
||||||
|
else
|
||||||
|
LIBLZ4_NAME = liblz4
|
||||||
|
WINBASED = no
|
||||||
|
EXT =
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WINBASED),yes)
|
||||||
|
EXT = .exe
|
||||||
|
WINDRES ?= windres
|
||||||
|
LDFLAGS += -Wl,--force-exe-suffix
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIBLZ4 = $(LIBLZ4_NAME).$(SHARED_EXT_VER)
|
||||||
|
|
||||||
|
#determine if dev/nul based on host environment
|
||||||
|
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
|
||||||
|
VOID := /dev/null
|
||||||
|
else
|
||||||
|
ifneq (,$(filter Windows%,$(OS)))
|
||||||
|
VOID := nul
|
||||||
|
else
|
||||||
|
VOID := /dev/null
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS% AIX,$(shell $(UNAME))))
|
||||||
|
POSIX_ENV = Yes
|
||||||
|
else
|
||||||
|
POSIX_ENV = No
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Avoid symlinks when targeting Windows or building on a Windows host
|
||||||
|
ifeq ($(WINBASED),yes)
|
||||||
|
LN_SF = cp -p
|
||||||
|
else
|
||||||
|
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
|
||||||
|
LN_SF = cp -p
|
||||||
|
else
|
||||||
|
ifneq (,$(filter Windows%,$(OS)))
|
||||||
|
LN_SF = cp -p
|
||||||
|
else
|
||||||
|
LN_SF = ln -sf
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter $(shell $(UNAME)),SunOS))
|
||||||
|
INSTALL ?= ginstall
|
||||||
|
else
|
||||||
|
INSTALL ?= install
|
||||||
|
endif
|
||||||
|
|
||||||
|
INSTALL_PROGRAM ?= $(INSTALL) -m 755
|
||||||
|
INSTALL_DATA ?= $(INSTALL) -m 644
|
||||||
|
MAKE_DIR ?= $(INSTALL) -d -m 755
|
||||||
258
lz4/build/make/multiconf.make
Normal file
258
lz4/build/make/multiconf.make
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
# ##########################################################################
|
||||||
|
# multiconf.make
|
||||||
|
# Copyright (C) Yann Collet
|
||||||
|
#
|
||||||
|
# GPL v2 License
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
# ##########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# Provides c_program(_shared_o) and cxx_program(_shared_o) target generation macros
|
||||||
|
# Provides static_library and c_dynamic_library target generation macros
|
||||||
|
# Support recompilation of only impacted units when an associated *.h is updated.
|
||||||
|
# Provides V=1 / VERBOSE=1 support. V=2 is used for debugging purposes.
|
||||||
|
# Complement target clean: delete objects and binaries created by this script
|
||||||
|
|
||||||
|
# Requires:
|
||||||
|
# - C_SRCDIRS, CXX_SRCDIRS, ASM_SRCDIRS defined
|
||||||
|
# OR
|
||||||
|
# C_SRCS, CXX_SRCS and ASM_SRCS variables defined
|
||||||
|
# *and* vpath set to find all source files
|
||||||
|
# OR
|
||||||
|
# C_OBJS, CXX_OBJS and ASM_OBJS variables defined
|
||||||
|
# *and* vpath set to find all source files
|
||||||
|
# - directory `cachedObjs/` available to cache object files.
|
||||||
|
# alternatively: set CACHE_ROOT to some different value.
|
||||||
|
# Optional:
|
||||||
|
# - HASH can be set to a different custom hash program.
|
||||||
|
|
||||||
|
# *_program*: generates a recipe for a target that will be built in a cache directory.
|
||||||
|
# The cache directory is automatically derived from CACHE_ROOT and list of flags and compilers.
|
||||||
|
# *_shared_o* variants are optional optimization variants, that share the same objects across multiple targets.
|
||||||
|
# However, as a consequence, all these objects must have exactly the same list of flags,
|
||||||
|
# which in practice means that there must be no target-level modification (like: target: CFLAGS += someFlag).
|
||||||
|
# If unsure, only use the standard variants, c_program and cxx_program.
|
||||||
|
|
||||||
|
# All *_program* macro functions take up to 4 argument:
|
||||||
|
# - The name of the target
|
||||||
|
# - The list of object files to build in the cache directory
|
||||||
|
# - An optional list of dependencies for linking, that will not be built
|
||||||
|
# - An optional complementary recipe code, that will run after compilation and link
|
||||||
|
|
||||||
|
|
||||||
|
# Silent mode is default; use V = 1 or VERBOSE = 1 to see compilation lines
|
||||||
|
VERBOSE ?= $(V)
|
||||||
|
$(VERBOSE).SILENT:
|
||||||
|
|
||||||
|
# Directory where object files will be built
|
||||||
|
CACHE_ROOT ?= cachedObjs
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Dependency management
|
||||||
|
DEPFLAGS = -MT $@ -MMD -MP -MF
|
||||||
|
|
||||||
|
# Include dependency files
|
||||||
|
include $(wildcard $(CACHE_ROOT)/**/*.d)
|
||||||
|
include $(wildcard $(CACHE_ROOT)/generic/*/*.d)
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Automatic determination of build artifacts cache directory, keyed on build
|
||||||
|
# flags, so that we can do incremental, parallel builds of different binaries
|
||||||
|
# with different build flags without collisions.
|
||||||
|
|
||||||
|
UNAME ?= $(shell uname)
|
||||||
|
ifeq ($(UNAME), Darwin)
|
||||||
|
HASH ?= md5
|
||||||
|
else ifeq ($(UNAME), FreeBSD)
|
||||||
|
HASH ?= gmd5sum
|
||||||
|
else ifeq ($(UNAME), OpenBSD)
|
||||||
|
HASH ?= md5
|
||||||
|
endif
|
||||||
|
HASH ?= md5sum
|
||||||
|
|
||||||
|
HAVE_HASH := $(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0)
|
||||||
|
ifeq ($(HAVE_HASH),0)
|
||||||
|
$(info warning : could not find HASH ($(HASH)), required to differentiate builds using different flags)
|
||||||
|
HASH_FUNC = generic/$(1)
|
||||||
|
else
|
||||||
|
HASH_FUNC = $(firstword $(shell echo $(2) | $(HASH) ))
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
MKDIR ?= mkdir
|
||||||
|
LN ?= ln
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------------------------
|
||||||
|
# The following macros are used to create object files in the cache directory.
|
||||||
|
# The object files are named after the source file, but with a different path.
|
||||||
|
|
||||||
|
# Create build directories on-demand.
|
||||||
|
#
|
||||||
|
# For some reason, make treats the directory as an intermediate file and tries
|
||||||
|
# to delete it. So we work around that by marking it "precious". Solution found
|
||||||
|
# here:
|
||||||
|
# http://ismail.badawi.io/blog/2017/03/28/automatic-directory-creation-in-make/
|
||||||
|
.PRECIOUS: $(CACHE_ROOT)/%/.
|
||||||
|
$(CACHE_ROOT)/%/. :
|
||||||
|
$(MKDIR) -p $@
|
||||||
|
|
||||||
|
|
||||||
|
define addTargetAsmObject # targetName, addlDeps
|
||||||
|
$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2))))
|
||||||
|
|
||||||
|
.PRECIOUS: $$(CACHE_ROOT)/%/$(1)
|
||||||
|
$$(CACHE_ROOT)/%/$(1) : $(1:.o=.S) $(2) | $$(CACHE_ROOT)/%/.
|
||||||
|
@echo AS $$@
|
||||||
|
$$(CC) $$(CPPFLAGS) $$(CXXFLAGS) $$(DEPFLAGS) $$(CACHE_ROOT)/$$*/$(1:.o=.d) -c $$< -o $$@
|
||||||
|
|
||||||
|
endef # addTargetAsmObject
|
||||||
|
|
||||||
|
define addTargetCObject # targetName, addlDeps
|
||||||
|
$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2)))) #debug print
|
||||||
|
|
||||||
|
.PRECIOUS: $$(CACHE_ROOT)/%/$(1)
|
||||||
|
$$(CACHE_ROOT)/%/$(1) : $(1:.o=.c) $(2) | $$(CACHE_ROOT)/%/.
|
||||||
|
@echo CC $$@
|
||||||
|
$$(CC) $$(CPPFLAGS) $$(CFLAGS) $$(DEPFLAGS) $$(CACHE_ROOT)/$$*/$(1:.o=.d) -c $$< -o $$@
|
||||||
|
|
||||||
|
endef # addTargetCObject
|
||||||
|
|
||||||
|
define addTargetCxxObject # targetName, suffix, addlDeps
|
||||||
|
$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3))))
|
||||||
|
|
||||||
|
.PRECIOUS: $$(CACHE_ROOT)/%/$(1)
|
||||||
|
$$(CACHE_ROOT)/%/$(1) : $(1:.o=.$(2)) $(3) | $$(CACHE_ROOT)/%/.
|
||||||
|
@echo CXX $$@
|
||||||
|
$$(CXX) $$(CPPFLAGS) $$(CXXFLAGS) $$(DEPFLAGS) $$(CACHE_ROOT)/$$*/$(1:.o=.d) -c $$< -o $$@
|
||||||
|
|
||||||
|
endef # addTargetCxxObject
|
||||||
|
|
||||||
|
# Create targets for individual object files
|
||||||
|
C_SRCDIRS += .
|
||||||
|
vpath %.c $(C_SRCDIRS)
|
||||||
|
CXX_SRCDIRS += .
|
||||||
|
vpath %.cpp $(CXX_SRCDIRS)
|
||||||
|
vpath %.cc $(CXX_SRCDIRS)
|
||||||
|
ASM_SRCDIRS += .
|
||||||
|
vpath %.S $(ASM_SRCDIRS)
|
||||||
|
|
||||||
|
# If C_SRCDIRS, CXX_SRCDIRS and ASM_SRCDIRS are not defined, use C_SRCS, CXX_SRCS and ASM_SRCS
|
||||||
|
C_SRCS ?= $(notdir $(foreach dir,$(C_SRCDIRS),$(wildcard $(dir)/*.c)))
|
||||||
|
CPP_SRCS ?= $(notdir $(foreach dir,$(CXX_SRCDIRS),$(wildcard $(dir)/*.cpp)))
|
||||||
|
CC_SRCS ?= $(notdir $(foreach dir,$(CXX_SRCDIRS),$(wildcard $(dir)/*.cc)))
|
||||||
|
CXX_SRCS ?= $(CPP_SRCS) $(CC_SRCS)
|
||||||
|
ASM_SRCS ?= $(notdir $(foreach dir,$(ASM_SRCDIRS),$(wildcard $(dir)/*.S)))
|
||||||
|
|
||||||
|
# If C_SRCS, CXX_SRCS and ASM_SRCS are not defined, use C_OBJS, CXX_OBJS and ASM_OBJS
|
||||||
|
C_OBJS ?= $(patsubst %.c,%.o,$(C_SRCS))
|
||||||
|
CPP_OBJS ?= $(patsubst %.cpp,%.o,$(CPP_SRCS))
|
||||||
|
CC_OBJS ?= $(patsubst %.cc,%.o,$(CC_SRCS))
|
||||||
|
CXX_OBJS ?= $(CPP_OBJS) $(CC_OBJS) # Note: not used
|
||||||
|
ASM_OBJS ?= $(patsubst %.S,%.o,$(ASM_SRCS))
|
||||||
|
|
||||||
|
$(foreach OBJ,$(C_OBJS),$(eval $(call addTargetCObject,$(OBJ))))
|
||||||
|
$(foreach OBJ,$(CPP_OBJS),$(eval $(call addTargetCxxObject,$(OBJ),cpp)))
|
||||||
|
$(foreach OBJ,$(CC_OBJS),$(eval $(call addTargetCxxObject,$(OBJ),cc)))
|
||||||
|
$(foreach OBJ,$(ASM_OBJS),$(eval $(call addTargetAsmObject,$(OBJ))))
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------------------------
|
||||||
|
# The following macros are used to create targets in the user Makefile.
|
||||||
|
# Binaries are built in the cache directory, and then symlinked to the current directory.
|
||||||
|
# The cache directory is automatically derived from CACHE_ROOT and list of flags and compilers.
|
||||||
|
|
||||||
|
define static_library # targetName, targetDeps, addlDeps, addRecipe, hashComplement
|
||||||
|
|
||||||
|
$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3),$(4),$(5))))
|
||||||
|
MCM_ALL_BINS += $(1)
|
||||||
|
|
||||||
|
$$(CACHE_ROOT)/%/$(1) : $$(addprefix $$(CACHE_ROOT)/%/,$(2)) $(3)
|
||||||
|
@echo AR $$@
|
||||||
|
$$(AR) $$(ARFLAGS) $$@ $$^
|
||||||
|
$(4)
|
||||||
|
|
||||||
|
.PHONY: $(1)
|
||||||
|
$(1) : ARFLAGS = rcs
|
||||||
|
$(1) : $$(CACHE_ROOT)/$$(call HASH_FUNC,$(1),$(2) $$(CPPFLAGS) $$(CC) $$(CFLAGS) $$(CXX) $$(CXXFLAGS) $$(AR) $$(ARFLAGS) $(5))/$(1)
|
||||||
|
$$(LN) -sf $$< $$@
|
||||||
|
|
||||||
|
endef # static_library
|
||||||
|
|
||||||
|
|
||||||
|
define c_dynamic_library # targetName, targetDeps, addlDeps, addRecipe, hashComplement
|
||||||
|
|
||||||
|
$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3),$(4),$(5))))
|
||||||
|
MCM_ALL_BINS += $(1)
|
||||||
|
|
||||||
|
$$(CACHE_ROOT)/%/$(1) : $$(addprefix $$(CACHE_ROOT)/%/,$(2)) $(3)
|
||||||
|
@echo LD $$@
|
||||||
|
$$(CC) $$(CPPFLAGS) $$(CFLAGS) $$(LDFLAGS) -shared -o $$@ $$^ $$(LDLIBS)
|
||||||
|
$(4)
|
||||||
|
|
||||||
|
.PHONY: $(1)
|
||||||
|
$(1) : CFLAGS += -fPIC
|
||||||
|
$(1) : $$(CACHE_ROOT)/$$(call HASH_FUNC,$(1),$(2) $$(CPPFLAGS) $$(CC) $$(CFLAGS) $$(LDFLAGS) $$(LDLIBS) $(5))/$(1)
|
||||||
|
$$(LN) -sf $$< $$@
|
||||||
|
|
||||||
|
endef # c_dynamic_library
|
||||||
|
|
||||||
|
|
||||||
|
define program_base # targetName, targetDeps, addlDeps, addRecipe, hashComplement, compiler, flags
|
||||||
|
|
||||||
|
$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3),$(4),$(5),$(6),$(7))))
|
||||||
|
MCM_ALL_BINS += $(1)
|
||||||
|
|
||||||
|
$$(CACHE_ROOT)/%/$(1) : $$(addprefix $$(CACHE_ROOT)/%/,$(2)) $(3)
|
||||||
|
@echo LD $$@
|
||||||
|
$$($(6)) $$(CPPFLAGS) $$($(7)) $$^ -o $$@ $$(LDFLAGS) $$(LDLIBS)
|
||||||
|
$(4)
|
||||||
|
|
||||||
|
.PHONY: $(1)
|
||||||
|
$(1) : $$(CACHE_ROOT)/$$(call HASH_FUNC,$(1),$$($(6)) $$(CPPFLAGS) $$($(7)) $$(LDFLAGS) $$(LDLIBS) $(5))/$(1)
|
||||||
|
$$(LN) -sf $$< $$@$(EXT)
|
||||||
|
|
||||||
|
endef # program_base
|
||||||
|
# Note: $(EXT) must be set to .exe for Windows
|
||||||
|
|
||||||
|
define c_program # targetName, targetDeps, addlDeps, addRecipe
|
||||||
|
$$(eval $$(call program_base,$(1),$(2),$(3),$(4),$(1)$(2),CC,CFLAGS))
|
||||||
|
endef # c_program
|
||||||
|
|
||||||
|
define c_program_shared_o # targetName, targetDeps, addlDeps, addRecipe
|
||||||
|
$$(eval $$(call program_base,$(1),$(2),$(3),$(4),,CC,CFLAGS))
|
||||||
|
endef # c_program_shared_o
|
||||||
|
|
||||||
|
define cxx_program # targetName, targetDeps, addlDeps, addRecipe
|
||||||
|
$$(eval $$(call program_base,$(1),$(2),$(3),$(4),$(1)$(2),CXX,CXXFLAGS))
|
||||||
|
endef # cxx_program
|
||||||
|
|
||||||
|
define cxx_program_shared_o # targetName, targetDeps, addlDeps, addRecipe
|
||||||
|
$$(eval $$(call program_base,$(1),$(2),$(3),$(4),,CXX,CXXFLAGS))
|
||||||
|
endef # cxx_program_shared_o
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Cleaning: delete all objects and binaries created with this script
|
||||||
|
.PHONY: clean_cache
|
||||||
|
clean_cache:
|
||||||
|
$(RM) -rf $(CACHE_ROOT)
|
||||||
|
$(RM) $(MCM_ALL_BINS)
|
||||||
|
|
||||||
|
# automatically attach to standard clean target
|
||||||
|
.PHONY: clean
|
||||||
|
clean: clean_cache
|
||||||
39
lz4/build/meson/GetLz4LibraryVersion.py
Normal file
39
lz4/build/meson/GetLz4LibraryVersion.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# 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*#\s*define\s+LZ4_VERSION_MAJOR\s+([0-9]+).*$
|
||||||
|
\s*#\s*define\s+LZ4_VERSION_MINOR\s+([0-9]+).*$
|
||||||
|
\s*#\s*define\s+LZ4_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 lz4 version from lib/lz4.h')
|
||||||
|
parser.add_argument('file', help='path to lib/lz4.h')
|
||||||
|
args = parser.parse_args()
|
||||||
|
version_tuple = find_version_tuple(args.file)
|
||||||
|
print('.'.join(version_tuple))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
34
lz4/build/meson/README.md
Normal file
34
lz4/build/meson/README.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
Meson build system for lz4
|
||||||
|
==========================
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## How to build
|
||||||
|
|
||||||
|
`cd` to this meson directory (`build/meson`)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
meson setup --buildtype=release -Ddefault_library=shared -Dprograms=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).
|
||||||
30
lz4/build/meson/meson.build
Normal file
30
lz4/build/meson/meson.build
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# 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 is a dummy meson file.
|
||||||
|
# The intention is that it can be easily moved to the root of the project
|
||||||
|
# (together with meson_options.txt) and packaged for wrapdb.
|
||||||
|
|
||||||
|
project(
|
||||||
|
'lz4',
|
||||||
|
'c',
|
||||||
|
license: 'BSD-2-Clause-Patent AND GPL-2.0-or-later',
|
||||||
|
default_options: [
|
||||||
|
'buildtype=release',
|
||||||
|
'warning_level=3'
|
||||||
|
],
|
||||||
|
version: run_command(
|
||||||
|
find_program('GetLz4LibraryVersion.py'),
|
||||||
|
'../../lib/lz4.h',
|
||||||
|
check: true
|
||||||
|
).stdout().strip(),
|
||||||
|
meson_version: '>=0.58.0'
|
||||||
|
)
|
||||||
|
|
||||||
|
subdir('meson')
|
||||||
42
lz4/build/meson/meson/contrib/gen_manual/meson.build
Normal file
42
lz4/build/meson/meson/contrib/gen_manual/meson.build
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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).
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
lz4_source_root = '../../../../..'
|
||||||
|
|
||||||
|
add_languages('cpp', native: true)
|
||||||
|
|
||||||
|
sources = files(
|
||||||
|
lz4_source_root / 'contrib/gen_manual/gen_manual.cpp'
|
||||||
|
)
|
||||||
|
|
||||||
|
gen_manual = executable(
|
||||||
|
'gen_manual',
|
||||||
|
sources,
|
||||||
|
native: true,
|
||||||
|
install: false
|
||||||
|
)
|
||||||
|
|
||||||
|
manual_pages = ['lz4', 'lz4frame']
|
||||||
|
|
||||||
|
foreach mp : manual_pages
|
||||||
|
custom_target(
|
||||||
|
'@0@_manual.html'.format(mp),
|
||||||
|
build_by_default: true,
|
||||||
|
input: lz4_source_root / 'lib/@0@.h'.format(mp),
|
||||||
|
output: '@0@_manual.html'.format(mp),
|
||||||
|
command: [
|
||||||
|
gen_manual,
|
||||||
|
meson.project_version(),
|
||||||
|
'@INPUT@',
|
||||||
|
'@OUTPUT@',
|
||||||
|
],
|
||||||
|
install: false
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
11
lz4/build/meson/meson/contrib/meson.build
Normal file
11
lz4/build/meson/meson/contrib/meson.build
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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('gen_manual')
|
||||||
32
lz4/build/meson/meson/examples/meson.build
Normal file
32
lz4/build/meson/meson/examples/meson.build
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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).
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
lz4_source_root = '../../../..'
|
||||||
|
|
||||||
|
examples = {
|
||||||
|
'print_version': 'print_version.c',
|
||||||
|
'blockStreaming_doubleBuffer': 'blockStreaming_doubleBuffer.c',
|
||||||
|
'dictionaryRandomAccess': 'dictionaryRandomAccess.c',
|
||||||
|
'blockStreaming_ringBuffer': 'blockStreaming_ringBuffer.c',
|
||||||
|
'streamingHC_ringBuffer': 'streamingHC_ringBuffer.c',
|
||||||
|
'blockStreaming_lineByLine': 'blockStreaming_lineByLine.c',
|
||||||
|
'frameCompress': 'frameCompress.c',
|
||||||
|
'bench_functions': 'bench_functions.c',
|
||||||
|
'simple_buffer': 'simple_buffer.c',
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach e, src : examples
|
||||||
|
executable(
|
||||||
|
e,
|
||||||
|
lz4_source_root / 'examples' / src,
|
||||||
|
dependencies: [liblz4_internal_dep],
|
||||||
|
install: false
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
87
lz4/build/meson/meson/lib/meson.build
Normal file
87
lz4/build/meson/meson/lib/meson.build
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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).
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
lz4_source_root = '../../../..'
|
||||||
|
|
||||||
|
sources = files(
|
||||||
|
lz4_source_root / 'lib/lz4.c',
|
||||||
|
lz4_source_root / 'lib/lz4frame.c',
|
||||||
|
lz4_source_root / 'lib/lz4hc.c',
|
||||||
|
lz4_source_root / 'lib/xxhash.c'
|
||||||
|
)
|
||||||
|
|
||||||
|
if get_option('unstable')
|
||||||
|
sources += files(lz4_source_root / 'lib/lz4file.c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
c_args = []
|
||||||
|
|
||||||
|
if host_machine.system() == 'windows' and get_option('default_library') != 'static'
|
||||||
|
c_args += '-DLZ4_DLL_EXPORT=1'
|
||||||
|
endif
|
||||||
|
|
||||||
|
liblz4 = library(
|
||||||
|
'lz4',
|
||||||
|
sources,
|
||||||
|
c_args: c_args,
|
||||||
|
install: true,
|
||||||
|
version: meson.project_version(),
|
||||||
|
gnu_symbol_visibility: 'hidden'
|
||||||
|
)
|
||||||
|
|
||||||
|
liblz4_dep = declare_dependency(
|
||||||
|
link_with: liblz4,
|
||||||
|
compile_args: compile_args,
|
||||||
|
include_directories: include_directories(lz4_source_root / 'lib')
|
||||||
|
)
|
||||||
|
|
||||||
|
meson.override_dependency('liblz4', liblz4_dep)
|
||||||
|
|
||||||
|
if get_option('tests') or get_option('programs') or get_option('examples') or get_option('ossfuzz')
|
||||||
|
if get_option('default_library') == 'shared'
|
||||||
|
liblz4_internal = static_library(
|
||||||
|
'lz4-internal',
|
||||||
|
objects: liblz4.extract_all_objects(recursive: true),
|
||||||
|
gnu_symbol_visibility: 'hidden'
|
||||||
|
)
|
||||||
|
elif get_option('default_library') == 'static'
|
||||||
|
liblz4_internal = liblz4
|
||||||
|
elif get_option('default_library') == 'both'
|
||||||
|
liblz4_internal = liblz4.get_static_lib()
|
||||||
|
endif
|
||||||
|
|
||||||
|
liblz4_internal_dep = declare_dependency(
|
||||||
|
link_with: liblz4_internal,
|
||||||
|
compile_args: compile_args,
|
||||||
|
include_directories: include_directories(lz4_source_root / 'lib')
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
pkgconfig.generate(
|
||||||
|
liblz4,
|
||||||
|
name: 'lz4',
|
||||||
|
filebase: 'liblz4',
|
||||||
|
description: 'extremely fast lossless compression algorithm library',
|
||||||
|
version: meson.project_version(),
|
||||||
|
url: 'http://www.lz4.org/'
|
||||||
|
)
|
||||||
|
|
||||||
|
install_headers(
|
||||||
|
lz4_source_root / 'lib/lz4.h',
|
||||||
|
lz4_source_root / 'lib/lz4hc.h',
|
||||||
|
lz4_source_root / 'lib/lz4frame.h'
|
||||||
|
)
|
||||||
|
|
||||||
|
if get_option('default_library') != 'shared'
|
||||||
|
install_headers(lz4_source_root / 'lib/lz4frame_static.h')
|
||||||
|
if get_option('unstable')
|
||||||
|
install_headers(lz4_source_root / 'lib/lz4file.h')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
135
lz4/build/meson/meson/meson.build
Normal file
135
lz4/build/meson/meson/meson.build
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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).
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
|
fs = import('fs')
|
||||||
|
pkgconfig = import('pkgconfig')
|
||||||
|
|
||||||
|
lz4_source_root = '../../..'
|
||||||
|
|
||||||
|
add_project_arguments('-DXXH_NAMESPACE=LZ4_', language: 'c')
|
||||||
|
|
||||||
|
if get_option('debug')
|
||||||
|
add_project_arguments(cc.get_supported_arguments(
|
||||||
|
'-Wcast-qual',
|
||||||
|
'-Wcast-align',
|
||||||
|
'-Wshadow',
|
||||||
|
'-Wswitch-enum',
|
||||||
|
'-Wdeclaration-after-statement',
|
||||||
|
'-Wstrict-prototypes',
|
||||||
|
'-Wundef',
|
||||||
|
'-Wpointer-arith',
|
||||||
|
'-Wstrict-aliasing=1',
|
||||||
|
'-DLZ4_DEBUG=@0@'.format(get_option('debug-level'))
|
||||||
|
),
|
||||||
|
language: 'c'
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
compile_args = []
|
||||||
|
|
||||||
|
if not get_option('align-test')
|
||||||
|
add_project_arguments('-DLZ4_ALIGN_TEST=0', language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('disable-memory-allocation')
|
||||||
|
if get_option('default_library') != 'static'
|
||||||
|
error('Memory allocation can only be disabled in static builds')
|
||||||
|
endif
|
||||||
|
|
||||||
|
add_project_arguments('-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION')
|
||||||
|
compile_args += '-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION'
|
||||||
|
endif
|
||||||
|
|
||||||
|
add_project_arguments(
|
||||||
|
'-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max')),
|
||||||
|
language: 'c'
|
||||||
|
)
|
||||||
|
compile_args += '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max'))
|
||||||
|
|
||||||
|
if not get_option('fast-dec-loop').auto()
|
||||||
|
add_project_arguments(
|
||||||
|
'-DLZ4_FAST_DEC_LOOP=@0@'.format(
|
||||||
|
get_option('fast-dec-loop').enabled() ? 1 : 0
|
||||||
|
),
|
||||||
|
language: 'c'
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('force-sw-bitcount')
|
||||||
|
add_project_arguments('-DLZ4_FORCE_SW_BITCOUNT', language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('freestanding')
|
||||||
|
add_project_arguments('-DLZ4_FREESTANDING=1', language: 'c')
|
||||||
|
compile_args += '-DLZ4_FREESTANDING=1'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('memory-usage') > 0
|
||||||
|
add_project_arguments(
|
||||||
|
'-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')),
|
||||||
|
language: 'c'
|
||||||
|
)
|
||||||
|
compile_args += '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage'))
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('endianness-independent-output')
|
||||||
|
if get_option('default_library') != 'static'
|
||||||
|
error('Endianness-independent output can only be enabled in static builds')
|
||||||
|
endif
|
||||||
|
|
||||||
|
add_project_arguments('-DLZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT')
|
||||||
|
compile_args += '-DLZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('unstable')
|
||||||
|
add_project_arguments('-DLZ4_STATIC_LINKING_ONLY', language: 'c')
|
||||||
|
compile_args += '-DLZ4_STATIC_LINKING_ONLY'
|
||||||
|
if get_option('default_library') != 'static'
|
||||||
|
add_project_arguments('-DLZ4_PUBLISH_STATIC_FUNCTIONS', language: 'c')
|
||||||
|
compile_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS'
|
||||||
|
|
||||||
|
add_project_arguments('-DLZ4F_PUBLISH_STATIC_FUNCTIONS', language: 'c')
|
||||||
|
compile_args += '-DLZ4F_PUBLISH_STATIC_FUNCTIONS'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('user-memory-functions')
|
||||||
|
add_project_arguments('-DLZ4_USER_MEMORY_FUNCTIONS', language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
run_env = environment()
|
||||||
|
|
||||||
|
subdir('lib')
|
||||||
|
|
||||||
|
if get_option('programs')
|
||||||
|
subdir('programs')
|
||||||
|
else
|
||||||
|
lz4 = disabler()
|
||||||
|
lz4cat = disabler()
|
||||||
|
unlz4 = disabler()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('tests')
|
||||||
|
subdir('tests')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('contrib')
|
||||||
|
subdir('contrib')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('examples')
|
||||||
|
subdir('examples')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('ossfuzz')
|
||||||
|
subdir('ossfuzz')
|
||||||
|
endif
|
||||||
37
lz4/build/meson/meson/ossfuzz/meson.build
Normal file
37
lz4/build/meson/meson/ossfuzz/meson.build
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
lz4_source_root = '../../../..'
|
||||||
|
|
||||||
|
fuzzers = [
|
||||||
|
'compress_frame_fuzzer',
|
||||||
|
'compress_fuzzer',
|
||||||
|
'compress_hc_fuzzer',
|
||||||
|
'decompress_frame_fuzzer',
|
||||||
|
'decompress_fuzzer',
|
||||||
|
'round_trip_frame_uncompressed_fuzzer',
|
||||||
|
'round_trip_fuzzer',
|
||||||
|
'round_trip_hc_fuzzer',
|
||||||
|
'round_trip_stream_fuzzer'
|
||||||
|
]
|
||||||
|
|
||||||
|
c_args = cc.get_supported_arguments(
|
||||||
|
'-Wno-unused-function',
|
||||||
|
'-Wno-sign-compare',
|
||||||
|
'-Wno-declaration-after-statement'
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach f : fuzzers
|
||||||
|
lib = static_library(
|
||||||
|
f,
|
||||||
|
lz4_source_root / 'ossfuzz/@0@.c'.format(f),
|
||||||
|
lz4_source_root / 'ossfuzz/lz4_helpers.c',
|
||||||
|
lz4_source_root / 'ossfuzz/fuzz_data_producer.c',
|
||||||
|
c_args: c_args,
|
||||||
|
dependencies: [liblz4_internal_dep]
|
||||||
|
)
|
||||||
|
|
||||||
|
executable(
|
||||||
|
f,
|
||||||
|
lz4_source_root / 'ossfuzz/standaloneengine.c',
|
||||||
|
link_with: lib,
|
||||||
|
dependencies: [liblz4_internal_dep]
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
91
lz4/build/meson/meson/programs/meson.build
Normal file
91
lz4/build/meson/meson/programs/meson.build
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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).
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
lz4_source_root = '../../../..'
|
||||||
|
|
||||||
|
# note:
|
||||||
|
# it would be preferable to use some kind of glob or wildcard expansion here...
|
||||||
|
sources = files(
|
||||||
|
lz4_source_root / 'programs/bench.c',
|
||||||
|
lz4_source_root / 'programs/lorem.c',
|
||||||
|
lz4_source_root / 'programs/lz4cli.c',
|
||||||
|
lz4_source_root / 'programs/lz4io.c',
|
||||||
|
lz4_source_root / 'programs/util.c',
|
||||||
|
lz4_source_root / 'programs/threadpool.c',
|
||||||
|
lz4_source_root / 'programs/timefn.c',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Initialize an empty list for extra dependencies
|
||||||
|
extra_deps = []
|
||||||
|
|
||||||
|
if get_option('enable_multithread')
|
||||||
|
pthread_dep = dependency('threads', required : true)
|
||||||
|
extra_deps += [pthread_dep]
|
||||||
|
multithread_args = ['-DLZ4IO_MULTITHREAD']
|
||||||
|
else
|
||||||
|
multithread_args = []
|
||||||
|
endif
|
||||||
|
|
||||||
|
lz4 = executable(
|
||||||
|
'lz4',
|
||||||
|
sources,
|
||||||
|
include_directories: include_directories(lz4_source_root / 'programs'),
|
||||||
|
dependencies: [liblz4_internal_dep] + extra_deps,
|
||||||
|
c_args: multithread_args,
|
||||||
|
export_dynamic: get_option('debug') and host_machine.system() == 'windows',
|
||||||
|
install: true
|
||||||
|
)
|
||||||
|
|
||||||
|
lz4cat = custom_target(
|
||||||
|
'lz4cat',
|
||||||
|
input: lz4,
|
||||||
|
output: 'lz4cat',
|
||||||
|
command: [
|
||||||
|
'ln',
|
||||||
|
'-s',
|
||||||
|
'-f',
|
||||||
|
fs.name(lz4.full_path()),
|
||||||
|
'@OUTPUT@'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
unlz4 = custom_target(
|
||||||
|
'unlz4',
|
||||||
|
input: lz4,
|
||||||
|
output: 'unlz4',
|
||||||
|
command: [
|
||||||
|
'ln',
|
||||||
|
'-s',
|
||||||
|
'-f',
|
||||||
|
fs.name(lz4.full_path()),
|
||||||
|
'@OUTPUT@'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
meson.override_find_program('lz4', lz4)
|
||||||
|
|
||||||
|
run_env.prepend('PATH', meson.current_build_dir())
|
||||||
|
|
||||||
|
install_man(lz4_source_root / 'programs/lz4.1')
|
||||||
|
|
||||||
|
if meson.version().version_compare('>=0.61.0')
|
||||||
|
foreach alias : ['lz4c', 'lz4cat', 'unlz4']
|
||||||
|
install_symlink(
|
||||||
|
alias,
|
||||||
|
install_dir: get_option('bindir'),
|
||||||
|
pointing_to: 'lz4'
|
||||||
|
)
|
||||||
|
install_symlink(
|
||||||
|
'@0@.1'.format(alias),
|
||||||
|
install_dir: get_option('mandir') / 'man1',
|
||||||
|
pointing_to: 'lz4.1'
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
165
lz4/build/meson/meson/tests/meson.build
Normal file
165
lz4/build/meson/meson/tests/meson.build
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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).
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
lz4_source_root = '../../../..'
|
||||||
|
|
||||||
|
fuzzer_time = 90
|
||||||
|
test_exes = {
|
||||||
|
'abiTest': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/abiTest.c'),
|
||||||
|
'test': false,
|
||||||
|
},
|
||||||
|
'checkFrame': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/checkFrame.c'),
|
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'),
|
||||||
|
},
|
||||||
|
'checkTag': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/checkTag.c'),
|
||||||
|
'test': false,
|
||||||
|
},
|
||||||
|
'datagen': {
|
||||||
|
'sources': files(
|
||||||
|
lz4_source_root / 'programs/lorem.c',
|
||||||
|
lz4_source_root / 'tests/datagencli.c',
|
||||||
|
lz4_source_root / 'tests/datagen.c',
|
||||||
|
lz4_source_root / 'tests/loremOut.c',
|
||||||
|
),
|
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'),
|
||||||
|
},
|
||||||
|
'decompress-partial-usingDict.c': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/decompress-partial-usingDict.c'),
|
||||||
|
},
|
||||||
|
'decompress-partial.c': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/decompress-partial.c'),
|
||||||
|
},
|
||||||
|
'frametest': {
|
||||||
|
'sources': files(
|
||||||
|
lz4_source_root / 'tests/frametest.c',
|
||||||
|
lz4_source_root / 'lib/lz4file.c',
|
||||||
|
),
|
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'),
|
||||||
|
'args': ['-v', '-T@0@s'.format(fuzzer_time)],
|
||||||
|
'test': false,
|
||||||
|
},
|
||||||
|
'freestanding': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/freestanding.c'),
|
||||||
|
'c_args': ['-ffreestanding', '-fno-stack-protector', '-Wno-unused-parameter', '-Wno-declaration-after-statement', '-DLZ4_DEBUG=0'],
|
||||||
|
'link_args': ['-nostdlib'],
|
||||||
|
'build': cc.get_id() in ['gcc', 'clang'] and
|
||||||
|
host_machine.system() == 'linux' and host_machine.cpu_family() == 'x86_64',
|
||||||
|
'override_options': ['optimization=1'],
|
||||||
|
},
|
||||||
|
'fullbench': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/fullbench.c'),
|
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'),
|
||||||
|
'args': ['--no-prompt', '-i1', files(lz4_source_root / 'tests/COPYING')],
|
||||||
|
'test': false,
|
||||||
|
},
|
||||||
|
'fuzzer': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/fuzzer.c'),
|
||||||
|
'include_directories': include_directories(lz4_source_root / 'programs'),
|
||||||
|
'args': ['-T@0@s'.format(fuzzer_time)],
|
||||||
|
'test': false,
|
||||||
|
},
|
||||||
|
'roundTripTest': {
|
||||||
|
'sources': files(lz4_source_root / 'tests/roundTripTest.c'),
|
||||||
|
'test': false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
targets = {}
|
||||||
|
|
||||||
|
foreach e, attrs : test_exes
|
||||||
|
if not attrs.get('build', true)
|
||||||
|
targets += {e: disabler()}
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
t = executable(
|
||||||
|
e,
|
||||||
|
attrs.get('sources'),
|
||||||
|
c_args: attrs.get('c_args', []),
|
||||||
|
link_args: attrs.get('link_args', []),
|
||||||
|
objects: attrs.get('objects', []),
|
||||||
|
dependencies: [liblz4_internal_dep],
|
||||||
|
include_directories: attrs.get('include_directories', []),
|
||||||
|
install: false,
|
||||||
|
override_options: attrs.get('override_options', [])
|
||||||
|
)
|
||||||
|
|
||||||
|
targets += {e: t}
|
||||||
|
|
||||||
|
if not attrs.get('test', true)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
test(
|
||||||
|
e,
|
||||||
|
t,
|
||||||
|
args: attrs.get('params', []),
|
||||||
|
timeout: 120
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
fs = import('fs')
|
||||||
|
|
||||||
|
run_env.prepend('PATH', meson.current_build_dir())
|
||||||
|
|
||||||
|
test_scripts = {
|
||||||
|
'lz4-basic': {
|
||||||
|
'depends': [lz4, lz4cat, unlz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-dict': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-contentSize': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-fast-hugefile': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-frame-concatenation': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-multiple': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-multiple-legacy': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-opt-parser': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-skippable': {
|
||||||
|
'depends': [lz4],
|
||||||
|
},
|
||||||
|
'lz4-sparse': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4-testmode': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
'lz4hc-hugefile': {
|
||||||
|
'depends': [lz4, targets['datagen']],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach s, attrs : test_scripts
|
||||||
|
script = find_program(lz4_source_root / 'tests/test-@0@.sh'.format(s))
|
||||||
|
|
||||||
|
test(
|
||||||
|
'@0@'.format(s),
|
||||||
|
script,
|
||||||
|
depends: attrs.get('depends', []),
|
||||||
|
workdir: fs.parent(script.full_path()),
|
||||||
|
env: run_env,
|
||||||
|
timeout: 360
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
44
lz4/build/meson/meson_options.txt
Normal file
44
lz4/build/meson/meson_options.txt
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# #############################################################################
|
||||||
|
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
|
||||||
|
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
|
||||||
|
# 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).
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
option('enable_multithread', type: 'boolean', value: true,
|
||||||
|
description: 'Enable multi-threading support')
|
||||||
|
option('align-test', type: 'boolean', value: true,
|
||||||
|
description: 'See LZ4_ALIGN_TEST')
|
||||||
|
option('contrib', type: 'boolean', value: false,
|
||||||
|
description: 'Enable contrib')
|
||||||
|
option('debug-level', type: 'integer', min: 0, max: 7, value: 1,
|
||||||
|
description: 'Enable run-time debug. See lib/lz4hc.c')
|
||||||
|
option('disable-memory-allocation', type: 'boolean', value: false,
|
||||||
|
description: 'See LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION. Static builds only')
|
||||||
|
option('distance-max', type: 'integer', min: 0, max: 65535, value: 65535,
|
||||||
|
description: 'See LZ4_DISTANCE_MAX')
|
||||||
|
option('endianness-independent-output', type: 'boolean', value: false,
|
||||||
|
description: 'See LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT. Static builds only')
|
||||||
|
option('examples', type: 'boolean', value: false,
|
||||||
|
description: 'Enable examples')
|
||||||
|
option('fast-dec-loop', type: 'feature', value: 'auto',
|
||||||
|
description: 'See LZ4_FAST_DEC_LOOP')
|
||||||
|
option('force-sw-bitcount', type: 'boolean', value: false,
|
||||||
|
description: 'See LZ4_FORCE_SW_BITCOUNT')
|
||||||
|
option('freestanding', type: 'boolean', value: false,
|
||||||
|
description: 'See LZ4_FREESTANDING')
|
||||||
|
option('memory-usage', type: 'integer', min: 0, max: 20, value: 0,
|
||||||
|
description: 'See LZ4_MEMORY_USAGE. 0 means use the LZ4 default')
|
||||||
|
option('ossfuzz', type: 'boolean', value: true,
|
||||||
|
description: 'Enable ossfuzz')
|
||||||
|
option('programs', type: 'boolean', value: false,
|
||||||
|
description: 'Enable programs')
|
||||||
|
option('tests', type: 'boolean', value: false,
|
||||||
|
description: 'Enable tests')
|
||||||
|
option('unstable', type: 'boolean', value: false,
|
||||||
|
description: 'Expose unstable interfaces')
|
||||||
|
option('user-memory-functions', type: 'boolean', value: false,
|
||||||
|
description: 'See LZ4_USER_MEMORY_FUNCTIONS')
|
||||||
5
lz4/build/visual/README.md
Normal file
5
lz4/build/visual/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
These scripts will generate Visual Studio Solutions for a selected set of supported versions of MS Visual.
|
||||||
|
|
||||||
|
For these scripts to work, both `cmake` and the relevant Visual Studio version must be locally installed on the system where the script is run.
|
||||||
|
|
||||||
|
If `cmake` is installed into a non-standard directory, or user wants to test a specific version of `cmake`, the target `cmake` directory can be provided via the environment variable `CMAKE_PATH`.
|
||||||
55
lz4/build/visual/generate_solution.cmd
Normal file
55
lz4/build/visual/generate_solution.cmd
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
:: Requires 1 parameter == GENERATOR
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
:: Set path
|
||||||
|
set "BUILD_BASE_DIR=%~dp0" :: Use the directory where the script is located
|
||||||
|
set "CMAKELIST_DIR=..\..\cmake"
|
||||||
|
|
||||||
|
if "%~1"=="" (
|
||||||
|
echo No generator specified as first parameter
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
set "GENERATOR=%~1"
|
||||||
|
|
||||||
|
:: Check if a user-defined CMAKE_PATH is set and prioritize it
|
||||||
|
if defined CMAKE_PATH (
|
||||||
|
set "CMAKE_EXECUTABLE=%CMAKE_PATH%\cmake.exe"
|
||||||
|
echo Using user-defined cmake at %CMAKE_PATH%
|
||||||
|
) else (
|
||||||
|
:: Attempt to find cmake in the system PATH
|
||||||
|
where cmake >nul 2>&1
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
:: Use the default standard cmake installation directory if not found in PATH
|
||||||
|
set "CMAKE_PATH=C:\Program Files\CMake\bin"
|
||||||
|
echo CMake not in system PATH => using default CMAKE_PATH=%CMAKE_PATH%
|
||||||
|
set "CMAKE_EXECUTABLE=%CMAKE_PATH%\cmake.exe"
|
||||||
|
) else (
|
||||||
|
set "CMAKE_EXECUTABLE=cmake"
|
||||||
|
echo CMake found in system PATH.
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Set the build directory to a subdirectory named after the generator
|
||||||
|
set "BUILD_DIR=%BUILD_BASE_DIR%\%GENERATOR%"
|
||||||
|
|
||||||
|
:: Create the build directory if it doesn't exist
|
||||||
|
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
|
||||||
|
|
||||||
|
:: Run CMake to configure the project and generate the solution
|
||||||
|
pushd "%BUILD_DIR%"
|
||||||
|
"%CMAKE_EXECUTABLE%" -G "%GENERATOR%" "%CMAKELIST_DIR%"
|
||||||
|
if %ERRORLEVEL% neq 0 goto :error
|
||||||
|
|
||||||
|
:: If successful, end script
|
||||||
|
echo Build configuration successful for %GENERATOR%.
|
||||||
|
goto :end
|
||||||
|
|
||||||
|
:error
|
||||||
|
echo Failed to configure build for %GENERATOR%.
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:end
|
||||||
|
popd
|
||||||
|
endlocal
|
||||||
|
@echo on
|
||||||
3
lz4/build/visual/generate_vs2015.cmd
Normal file
3
lz4/build/visual/generate_vs2015.cmd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
:: Call the central script with the specific generator for VS2015
|
||||||
|
call generate_solution.cmd "Visual Studio 14 2015"
|
||||||
3
lz4/build/visual/generate_vs2017.cmd
Normal file
3
lz4/build/visual/generate_vs2017.cmd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
:: Call the central script with the specific generator for VS2017
|
||||||
|
call generate_solution.cmd "Visual Studio 15 2017"
|
||||||
3
lz4/build/visual/generate_vs2019.cmd
Normal file
3
lz4/build/visual/generate_vs2019.cmd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
:: Call the central script with the specific generator for VS2019
|
||||||
|
call generate_solution.cmd "Visual Studio 16 2019"
|
||||||
3
lz4/build/visual/generate_vs2022.cmd
Normal file
3
lz4/build/visual/generate_vs2022.cmd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
:: Call the central script with the specific generator for VS2022
|
||||||
|
call generate_solution.cmd "Visual Studio 17 2022"
|
||||||
24
lz4/contrib/djgpp/LICENSE
Normal file
24
lz4/contrib/djgpp/LICENSE
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
Copyright (c) 2014, lpsantil
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
130
lz4/contrib/djgpp/Makefile
Normal file
130
lz4/contrib/djgpp/Makefile
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
# Copyright (c) 2015, Louis P. Santillan <lpsantil@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
# See LICENSE for licensing details.
|
||||||
|
DESTDIR ?= /opt/local
|
||||||
|
|
||||||
|
# Pulled the code below from lib/Makefile. Might be nicer to derive this somehow without sed
|
||||||
|
# Version numbers
|
||||||
|
VERSION ?= 129
|
||||||
|
RELEASE ?= r$(VERSION)
|
||||||
|
LIBVER_MAJOR=$(shell sed -n '/define[[:blank:]][[:blank:]]*LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h)
|
||||||
|
LIBVER_MINOR=$(shell sed -n '/define[[:blank:]][[:blank:]]*LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h)
|
||||||
|
LIBVER_PATCH=$(shell sed -n '/define[[:blank:]][[:blank:]]*LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h)
|
||||||
|
LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
CROSS ?= i586-pc-msdosdjgpp
|
||||||
|
CC = $(CROSS)-gcc
|
||||||
|
AR = $(CROSS)-ar
|
||||||
|
LD = $(CROSS)-gcc
|
||||||
|
|
||||||
|
CFLAGS ?= -O3 -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -Wpedantic -DLZ4_VERSION=\"$(RELEASE)\"
|
||||||
|
LDFLAGS ?= -s
|
||||||
|
SRC = programs/bench.c programs/lz4io.c programs/lz4cli.c
|
||||||
|
OBJ = $(SRC:.c=.o)
|
||||||
|
SDEPS = $(SRC:.c=.d)
|
||||||
|
IDIR = lib
|
||||||
|
EDIR = .
|
||||||
|
EXE = lz4.exe
|
||||||
|
LNK = lz4
|
||||||
|
LDIR = lib
|
||||||
|
LSRC = lib/lz4.c lib/lz4hc.c lib/lz4frame.c lib/xxhash.c
|
||||||
|
INC = $(LSRC:.c=.h)
|
||||||
|
LOBJ = $(LSRC:.c=.o)
|
||||||
|
LSDEPS = $(LSRC:.c=.d)
|
||||||
|
LIB = $(LDIR)/lib$(LNK).a
|
||||||
|
|
||||||
|
# Since LDFLAGS defaults to "-s", probably better to override unless
|
||||||
|
# you have a default you would like to maintain
|
||||||
|
ifeq ($(WITH_DEBUG), 1)
|
||||||
|
CFLAGS += -g
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Since LDFLAGS defaults to "-s", probably better to override unless
|
||||||
|
# you have a default you would like to maintain
|
||||||
|
ifeq ($(WITH_PROFILING), 1)
|
||||||
|
CFLAGS += -pg
|
||||||
|
LDFLAGS += -pg
|
||||||
|
endif
|
||||||
|
|
||||||
|
%.o: %.c $(INC) Makefile
|
||||||
|
$(CC) $(CFLAGS) -MMD -MP -I$(IDIR) -c $< -o $@
|
||||||
|
|
||||||
|
%.exe: %.o $(LIB) Makefile
|
||||||
|
$(LD) $< -L$(LDIR) -l$(LNK) $(LDFLAGS) $(LIBDEP) -o $@
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
######################## DO NOT MODIFY BELOW #########################
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
.PHONY: all install uninstall showconfig gstat gpush
|
||||||
|
|
||||||
|
all: $(LIB) $(EXE)
|
||||||
|
|
||||||
|
$(LIB): $(LOBJ)
|
||||||
|
$(AR) -rcs $@ $^
|
||||||
|
|
||||||
|
$(EXE): $(LOBJ) $(OBJ)
|
||||||
|
$(LD) $(LDFLAGS) $(LOBJ) $(OBJ) -o $(EDIR)/$@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJ) $(EXE) $(LOBJ) $(LIB) *.tmp $(SDEPS) $(LSDEPS) $(TSDEPS)
|
||||||
|
|
||||||
|
install: $(INC) $(LIB) $(EXE)
|
||||||
|
mkdir -p $(DESTDIR)/bin $(DESTDIR)/include $(DESTDIR)/lib
|
||||||
|
rm -f .footprint
|
||||||
|
echo $(DESTDIR)/bin/$(EXE) >> .footprint
|
||||||
|
cp -v $(EXE) $(DESTDIR)/bin/
|
||||||
|
@for T in $(LIB); \
|
||||||
|
do ( \
|
||||||
|
echo $(DESTDIR)/$$T >> .footprint; \
|
||||||
|
cp -v --parents $$T $(DESTDIR) \
|
||||||
|
); done
|
||||||
|
@for T in $(INC); \
|
||||||
|
do ( \
|
||||||
|
echo $(DESTDIR)/include/`basename -a $$T` >> .footprint; \
|
||||||
|
cp -v $$T $(DESTDIR)/include/ \
|
||||||
|
); done
|
||||||
|
|
||||||
|
uninstall: .footprint
|
||||||
|
@for T in $(shell cat .footprint); do rm -v $$T; done
|
||||||
|
|
||||||
|
-include $(SDEPS) $(LSDEPS)
|
||||||
|
|
||||||
|
showconfig:
|
||||||
|
@echo "PWD="$(PWD)
|
||||||
|
@echo "VERSION="$(VERSION)
|
||||||
|
@echo "RELEASE="$(RELEASE)
|
||||||
|
@echo "LIBVER_MAJOR="$(LIBVER_MAJOR)
|
||||||
|
@echo "LIBVER_MINOR="$(LIBVER_MINOR)
|
||||||
|
@echo "LIBVER_PATCH="$(LIBVER_PATCH)
|
||||||
|
@echo "LIBVER="$(LIBVER)
|
||||||
|
@echo "CROSS="$(CROSS)
|
||||||
|
@echo "CC="$(CC)
|
||||||
|
@echo "AR="$(AR)
|
||||||
|
@echo "LD="$(LD)
|
||||||
|
@echo "DESTDIR="$(DESTDIR)
|
||||||
|
@echo "CFLAGS="$(CFLAGS)
|
||||||
|
@echo "LDFLAGS="$(LDFLAGS)
|
||||||
|
@echo "SRC="$(SRC)
|
||||||
|
@echo "OBJ="$(OBJ)
|
||||||
|
@echo "IDIR="$(IDIR)
|
||||||
|
@echo "INC="$(INC)
|
||||||
|
@echo "EDIR="$(EDIR)
|
||||||
|
@echo "EXE="$(EXE)
|
||||||
|
@echo "LDIR="$(LDIR)
|
||||||
|
@echo "LSRC="$(LSRC)
|
||||||
|
@echo "LOBJ="$(LOBJ)
|
||||||
|
@echo "LNK="$(LNK)
|
||||||
|
@echo "LIB="$(LIB)
|
||||||
|
@echo "SDEPS="$(SDEPS)
|
||||||
|
@echo "LSDEPS="$(LSDEPS)
|
||||||
|
|
||||||
|
gstat:
|
||||||
|
git status
|
||||||
|
|
||||||
|
gpush:
|
||||||
|
git commit
|
||||||
|
git push
|
||||||
21
lz4/contrib/djgpp/README.MD
Normal file
21
lz4/contrib/djgpp/README.MD
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# lz4 for DOS/djgpp
|
||||||
|
This file details on how to compile lz4.exe, and liblz4.a for use on DOS/djgpp using
|
||||||
|
Andrew Wu's build-djgpp cross compilers ([GH][0], [Binaries][1]) on OSX, Linux.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
* Download a djgpp tarball [binaries][1] for your platform.
|
||||||
|
* Extract and install it (`tar jxvf djgpp-linux64-gcc492.tar.bz2`). Note the path. We'll assume `/home/user/djgpp`.
|
||||||
|
* Add the `bin` folder to your `PATH`. In bash, do `export PATH=/home/user/djgpp/bin:$PATH`.
|
||||||
|
* The `Makefile` in `contrib/djgpp/` sets up `CC`, `AR`, `LD` for you. So, `CC=i586-pc-msdosdjgpp-gcc`, `AR=i586-pc-msdosdjgpp-ar`, `LD=i586-pc-msdosdjgpp-gcc`.
|
||||||
|
|
||||||
|
## Building LZ4 for DOS
|
||||||
|
In the base dir of lz4 and with `contrib/djgpp/Makefile`, try:
|
||||||
|
Try:
|
||||||
|
* `make -f contrib/djgpp/Makefile`
|
||||||
|
* `make -f contrib/djgpp/Makefile liblz4.a`
|
||||||
|
* `make -f contrib/djgpp/Makefile lz4.exe`
|
||||||
|
* `make -f contrib/djgpp/Makefile DESTDIR=/home/user/dos install`, however it doesn't make much sense on a \*nix.
|
||||||
|
* You can also do `make -f contrib/djgpp/Makefile uninstall`
|
||||||
|
|
||||||
|
[0]: https://github.com/andrewwutw/build-djgpp
|
||||||
|
[1]: https://github.com/andrewwutw/build-djgpp/releases
|
||||||
2
lz4/contrib/gen_manual/.gitignore
vendored
Normal file
2
lz4/contrib/gen_manual/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# build artefact
|
||||||
|
gen_manual
|
||||||
76
lz4/contrib/gen_manual/Makefile
Normal file
76
lz4/contrib/gen_manual/Makefile
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# ################################################################
|
||||||
|
# Copyright (C) Przemyslaw Skibinski 2016-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 :
|
||||||
|
# - LZ4 source repository : https://github.com/Cyan4973/lz4
|
||||||
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
||||||
|
# ################################################################
|
||||||
|
|
||||||
|
|
||||||
|
CXXFLAGS ?= -O2
|
||||||
|
CXXFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wno-comment
|
||||||
|
CPPFLAGS += $(MOREFLAGS)
|
||||||
|
FLAGS = $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
|
LZ4API = ../../lib/lz4.h
|
||||||
|
LZ4MANUAL = ../../doc/lz4_manual.html
|
||||||
|
LZ4FAPI = ../../lib/lz4frame.h
|
||||||
|
LZ4FMANUAL = ../../doc/lz4frame_manual.html
|
||||||
|
LIBVER_MAJOR_SCRIPT:=`sed -n '/define[[:blank:]][[:blank:]]*LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
|
||||||
|
LIBVER_MINOR_SCRIPT:=`sed -n '/define[[:blank:]][[:blank:]]*LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
|
||||||
|
LIBVER_PATCH_SCRIPT:=`sed -n '/define[[:blank:]][[:blank:]]*LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LZ4API)`
|
||||||
|
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
|
||||||
|
LZ4VER := $(shell echo $(LIBVER_SCRIPT))
|
||||||
|
|
||||||
|
# Define *.exe as extension for Windows systems
|
||||||
|
ifneq (,$(filter Windows%,$(OS)))
|
||||||
|
EXT =.exe
|
||||||
|
else
|
||||||
|
EXT =
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: default
|
||||||
|
default: gen_manual
|
||||||
|
|
||||||
|
gen_manual: gen_manual.cpp
|
||||||
|
$(CXX) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
$(LZ4MANUAL) : gen_manual $(LZ4API)
|
||||||
|
echo "Update lz4 manual in /doc"
|
||||||
|
./gen_manual $(LZ4VER) $(LZ4API) $@
|
||||||
|
|
||||||
|
$(LZ4FMANUAL) : gen_manual $(LZ4FAPI)
|
||||||
|
echo "Update lz4frame manual in /doc"
|
||||||
|
./gen_manual $(LZ4VER) $(LZ4FAPI) $@
|
||||||
|
|
||||||
|
.PHONY: manuals
|
||||||
|
manuals: $(LZ4MANUAL) $(LZ4FMANUAL)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
@$(RM) gen_manual$(EXT)
|
||||||
|
@echo Cleaning completed
|
||||||
31
lz4/contrib/gen_manual/README.md
Normal file
31
lz4/contrib/gen_manual/README.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
gen_manual - a program for automatic generation of manual from source code
|
||||||
|
==========================================================================
|
||||||
|
|
||||||
|
#### Introduction
|
||||||
|
|
||||||
|
This simple C++ program generates a single-page HTML manual from `lz4.h`.
|
||||||
|
|
||||||
|
The format of recognized comment blocks is following:
|
||||||
|
- comments of type `/*!` mean: this is a function declaration; switch comments with declarations
|
||||||
|
- comments of type `/**` and `/*-` mean: this is a comment; use a `<H2>` header for the first line
|
||||||
|
- comments of type `/*=` and `/**=` mean: use a `<H3>` header and show also all functions until first empty line
|
||||||
|
- comments of type `/*X` where `X` is different from above-mentioned are ignored
|
||||||
|
|
||||||
|
Moreover:
|
||||||
|
- `LZ4LIB_API` is removed to improve readability
|
||||||
|
- `typedef` are detected and included even if uncommented
|
||||||
|
- comments of type `/**<` and `/*!<` are detected and only function declaration is highlighted (bold)
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage
|
||||||
|
|
||||||
|
The program requires 3 parameters:
|
||||||
|
```
|
||||||
|
gen_manual [lz4_version] [input_file] [output_html]
|
||||||
|
```
|
||||||
|
|
||||||
|
To compile program and generate lz4 manual we have used:
|
||||||
|
```
|
||||||
|
make
|
||||||
|
./gen_manual.exe 1.7.3 ../../lib/lz4.h lz4_manual.html
|
||||||
|
```
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user