summaryrefslogtreecommitdiffstats
path: root/lib/dll
diff options
context:
space:
mode:
authorPrzemyslaw Skibinski <inikep@gmail.com>2016-11-15 11:57:56 (GMT)
committerPrzemyslaw Skibinski <inikep@gmail.com>2016-11-15 11:57:56 (GMT)
commitc093e256d46b9dce0b19a9594a6bb622639ac754 (patch)
tree019d2bf123cd7f693dc4d23ee4ad67cfad32a69b /lib/dll
parentbe471c69da7390a4d9729c4a45f286a6bf4a6e3b (diff)
downloadlz4-c093e256d46b9dce0b19a9594a6bb622639ac754.zip
lz4-c093e256d46b9dce0b19a9594a6bb622639ac754.tar.gz
lz4-c093e256d46b9dce0b19a9594a6bb622639ac754.tar.bz2
added files used by DLL package
Diffstat (limited to 'lib/dll')
-rw-r--r--lib/dll/Makefile61
-rw-r--r--lib/dll/README.md50
2 files changed, 111 insertions, 0 deletions
diff --git a/lib/dll/Makefile b/lib/dll/Makefile
new file mode 100644
index 0000000..32e13fc
--- /dev/null
+++ b/lib/dll/Makefile
@@ -0,0 +1,61 @@
+# ##########################################################################
+# LZ4 programs - Makefile
+# Copyright (C) Yann Collet 2016
+#
+# 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.
+#
+# You can contact the author at :
+# - LZ4 homepage : http://www.lz4.org
+# - LZ4 source repository : https://github.com/lz4/lz4
+# ##########################################################################
+
+VOID := /dev/null
+LZ4DIR := ./include
+
+CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make
+CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \
+ -Wdeclaration-after-statement -Wstrict-prototypes \
+ -Wpointer-arith -Wstrict-aliasing=1
+CFLAGS += $(MOREFLAGS)
+CPPFLAGS:= -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_
+FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+
+
+# Define *.exe as extension for Windows systems
+ifneq (,$(filter Windows%,$(OS)))
+EXT =.exe
+else
+EXT =
+endif
+
+.PHONY: default fullbench-dll fullbench-lib
+
+
+default: all
+
+all: fullbench-dll fullbench-lib
+
+
+fullbench-lib: fullbench/fullbench.c fullbench/xxhash.c
+ $(CC) $(FLAGS) $^ -o $@$(EXT) static/liblz4_static.lib
+
+fullbench-dll: fullbench/fullbench.c fullbench/xxhash.c
+ $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 dll/liblz4.lib
+
+clean:
+ @$(RM) fullbench-dll$(EXT) fullbench-lib$(EXT) \
+ @echo Cleaning completed
diff --git a/lib/dll/README.md b/lib/dll/README.md
new file mode 100644
index 0000000..bbbd768
--- /dev/null
+++ b/lib/dll/README.md
@@ -0,0 +1,50 @@
+The static and dynamic LZ4 libraries
+====================================
+
+#### The package content
+
+- `dll\liblz4.dll` : The DLL of LZ4 library
+- `dll\liblz4.lib` : The import library of LZ4 library
+- `include\` : Header files required with LZ4 library
+- `fullbench\` : The example of usage of LZ4 library
+- `static\liblz4_static.lib` : The static LZ4 library
+
+
+#### The example of usage of static and dynamic LZ4 libraries with gcc/MinGW
+
+Use `make` to build `fullbench-dll` and `fullbench-lib`.
+`fullbench-dll` uses a dynamic LZ4 library from the `dll` directory.
+`fullbench-lib` uses a static LZ4 library from the `lib` directory.
+
+
+#### Using LZ4 DLL with gcc/MinGW
+
+The header files from `include\` and the import library `dll\liblz4.lib`
+are required to compile a project using gcc/MinGW.
+The import library has to be added to linking options.
+It means that if a project that uses LZ4 consists of a single `test-dll.c`
+file it should be compiled with "liblz4.lib". For example:
+```
+ gcc $(CFLAGS) -Iinclude/ test-dll.c -o test-dll dll\liblz4.lib
+```
+The compiled executable will require LZ4 DLL which is available at `dll\liblz4.dll`.
+
+
+#### The example of usage of static and dynamic LZ4 libraries with Visual C++
+
+Open `fullbench\fullbench-dll.sln` to compile `fullbench-dll` that uses a
+dynamic LZ4 library from the `dll` directory.
+
+
+#### Using LZ4 DLL with Visual C++
+
+The header files from `include\` and the import library `dll\liblz4.lib`
+are required to compile a project using Visual C++.
+1. The header files should be added to a given project or referenced within
+ `Additional Include Directories` that can be found in project properties
+ `C/C++` then `General`.
+2. The import library has to be added to `Additional Dependencies` that can
+ be found in project properties `Linker` then `Input`.
+ If one will provide only the name `liblz4.lib` without a full path to the library
+ the directory has to be added to `Linker\General\Additional Library Directories`.
+The compiled executable will require LZ4 DLL which is available at `dll\liblz4.dll`.