diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | appveyor.yml | 79 | ||||
-rw-r--r-- | lib/Makefile | 6 | ||||
-rw-r--r-- | lib/README.md | 6 | ||||
-rw-r--r-- | lib/dll/README.md | 53 | ||||
-rw-r--r-- | lib/dll/fullbench-dll/Makefile | 61 | ||||
-rw-r--r-- | lib/dll/fullbench-dll/fullbench-dll.sln | 25 | ||||
-rw-r--r-- | lib/dll/fullbench-dll/fullbench-dll.vcxproj | 182 | ||||
-rw-r--r-- | lib/dll/liblz4.def (renamed from lib/liblz4.def) | 0 | ||||
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | visual/README.md | 21 | ||||
-rw-r--r-- | visual/VS2010/fullbench-dll/fullbench-dll.vcxproj | 10 | ||||
-rw-r--r-- | visual/VS2010/liblz4-dll/liblz4-dll.rc (renamed from visual/VS2010/liblz4-dll/lz4-dll.rc) | 0 | ||||
-rw-r--r-- | visual/VS2010/liblz4-dll/liblz4-dll.vcxproj (renamed from visual/VS2010/liblz4-dll/lz4-dll.vcxproj) | 12 | ||||
-rw-r--r-- | visual/VS2010/liblz4/liblz4.vcxproj | 8 | ||||
-rw-r--r-- | visual/VS2010/lz4.sln | 2 |
16 files changed, 437 insertions, 31 deletions
@@ -23,6 +23,7 @@ lz4 .clang_complete _codelite/ _codelite_lz4/ +bin/ *.zip # Mac diff --git a/appveyor.yml b/appveyor.yml index d96ebc8..37f3bd5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,6 +22,7 @@ environment: install: - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% + - MKDIR bin - if [%COMPILER%]==[gcc] SET PATH_ORIGINAL=%PATH% - if [%COMPILER%]==[gcc] ( SET "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin" && @@ -46,12 +47,39 @@ build_script: make -v && echo ----- && if not [%PLATFORM%]==[clang] ( - make -C programs lz4 && make -C tests fullbench + make -C programs lz4 && make -C tests fullbench && make -C lib lib ) ELSE ( make -C programs lz4 CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && - make -C tests fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" + make -C tests fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && + make -C lib lib CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" ) ) + - if [%COMPILER%]==[gcc] if not [%PLATFORM%]==[clang] ( + MKDIR bin\dll bin\static bin\fullbench bin\include && + COPY tests\fullbench.c bin\fullbench\ && + COPY lib\xxhash.c bin\fullbench\ && + COPY lib\xxhash.h bin\fullbench\ && + COPY lib\lz4.h bin\include\ && + COPY lib\lz4hc.h bin\include\ && + COPY lib\lz4frame.h bin\include\ && + COPY lib\dll\liblz4.* bin\dll\ && + COPY lib\dll\fullbench-dll\Makefile bin\ && + COPY lib\dll\fullbench-dll\fullbench-dll.* bin\fullbench\ && + COPY lib\dll\README.md bin\ && + COPY lib\liblz4.a bin\static\liblz4_static.lib + ) + - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] ( + 7z.exe a bin\liblz4_x64.zip .\bin\fullbench .\bin\dll .\bin\static .\bin\include .\bin\Makefile .\bin\README.md && + appveyor PushArtifact bin\liblz4_x64.zip && + COPY programs\lz4.exe bin\lz4.exe && + appveyor PushArtifact bin\lz4.exe + ) + - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] ( + 7z.exe a bin\liblz4_x86.zip .\bin\fullbench .\bin\dll .\bin\static .\bin\include .\bin\Makefile .\bin\README.md && + appveyor PushArtifact bin\liblz4_x86.zip && + COPY programs\lz4.exe bin\lz4_32.exe && + appveyor PushArtifact bin\lz4_32.exe + ) - if [%COMPILER%]==[gcc] (COPY tests\fullbench.exe programs\) - if [%COMPILER%]==[visual] ( ECHO *** && @@ -87,3 +115,50 @@ test_script: echo ------- lz4 tested ------- && fullbench.exe -i1 fullbench.exe ) + +artifacts: + - path: bin\lz4.exe + - path: bin\lz4_32.exe + - path: bin\liblz4_x64.zip + - path: bin\liblz4_x86.zip + +deploy: +- provider: GitHub + auth_token: + secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4 + artifact: bin\lz4.exe + force_update: true + on: + COMPILER: gcc + PLATFORM: "mingw64" + appveyor_repo_tag: true + +- provider: GitHub + auth_token: + secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4 + artifact: bin\lz4_32.exe + force_update: true + on: + COMPILER: gcc + PLATFORM: "mingw32" + appveyor_repo_tag: true + +- provider: GitHub + auth_token: + secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4 + artifact: bin\liblz4_x64.zip + force_update: true + on: + COMPILER: gcc + PLATFORM: "mingw64" + appveyor_repo_tag: true + +- provider: GitHub + auth_token: + secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4 + artifact: bin\liblz4_x86.zip + force_update: true + on: + COMPILER: gcc + PLATFORM: "mingw32" + appveyor_repo_tag: true diff --git a/lib/Makefile b/lib/Makefile index d098846..4c9b929 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -86,8 +86,8 @@ endif liblz4: *.c @echo compiling dynamic library $(LIBVER) ifneq (,$(filter Windows%,$(OS))) - @$(CC) $(FLAGS) -DLZ4_DLL_EXPORT=1 -shared $^ -o $@.dll - dlltool -D liblz4.dll -d liblz4.def -l liblz4.dll.a + @$(CC) $(FLAGS) -DLZ4_DLL_EXPORT=1 -shared $^ -o dll\$@.dll + dlltool -D dll\liblz4.dll -d dll\liblz4.def -l dll\liblz4.lib else @$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER) @echo creating versioned links @@ -96,7 +96,7 @@ else endif clean: - @$(RM) -f core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* liblz4.pc + @$(RM) -f core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* liblz4.pc dll/liblz4.dll dll/liblz4.lib @echo Cleaning library completed diff --git a/lib/README.md b/lib/README.md index 19f429a..430be1f 100644 --- a/lib/README.md +++ b/lib/README.md @@ -41,12 +41,12 @@ It must be used with static linking ***only***. #### Using MinGW+MSYS to create DLL DLL can be created using MinGW+MSYS with the `make liblz4` command. -This command creates `liblz4.dll` and the import library `liblz4.dll.a`. +This command creates `dll\liblz4.dll` and the import library `dll\liblz4.lib`. To compile a project the import library has to be added to linking options. It means that if a project that uses LZ4 consists of a single `test-dll.c` -file it should be compiled with "liblz4.dll.a". For example: +file it should be compiled with "liblz4.lib". For example: ``` - gcc $(CFLAGS) test-dll.c -o test-dll liblz4.dll.a + gcc $(CFLAGS) test-dll.c -o test-dll liblz4.lib ``` diff --git a/lib/dll/README.md b/lib/dll/README.md new file mode 100644 index 0000000..779b8ae --- /dev/null +++ b/lib/dll/README.md @@ -0,0 +1,53 @@ +The static and dynamic LZ4 libraries +==================================== + +#### The package contents + +- `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. The solution works with Visual C++ +2010 or newer. When one will open the solution with Visual C++ newer than 2010 +then the solution will upgraded to the current version. + + +#### 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 `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`. diff --git a/lib/dll/fullbench-dll/Makefile b/lib/dll/fullbench-dll/Makefile new file mode 100644 index 0000000..32e13fc --- /dev/null +++ b/lib/dll/fullbench-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/fullbench-dll/fullbench-dll.sln b/lib/dll/fullbench-dll/fullbench-dll.sln new file mode 100644 index 0000000..72e302e --- /dev/null +++ b/lib/dll/fullbench-dll/fullbench-dll.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2012 for Windows Desktop +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll.vcxproj", "{13992FD2-077E-4954-B065-A428198201A9}" +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 + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/lib/dll/fullbench-dll/fullbench-dll.vcxproj b/lib/dll/fullbench-dll/fullbench-dll.vcxproj new file mode 100644 index 0000000..cdb5534 --- /dev/null +++ b/lib/dll/fullbench-dll/fullbench-dll.vcxproj @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.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> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </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;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + <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> + <IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(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)..\..\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;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <TreatWarningAsError>true</TreatWarningAsError> + <EnablePREfast>false</EnablePREfast> + <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalLibraryDirectories>$(SolutionDir)..\dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </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> + <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalLibraryDirectories>$(SolutionDir)..\dll;%(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> + <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalLibraryDirectories>$(SolutionDir)..\dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </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> + <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalLibraryDirectories>$(SolutionDir)..\dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="xxhash.c" /> + <ClCompile Include="fullbench.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\include\lz4.h" /> + <ClInclude Include="..\include\lz4frame.h" /> + <ClInclude Include="..\include\lz4hc.h" /> + <ClInclude Include="xxhash.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lib/liblz4.def b/lib/dll/liblz4.def index 0ace223..0ace223 100644 --- a/lib/liblz4.def +++ b/lib/dll/liblz4.def diff --git a/tests/Makefile b/tests/Makefile index a11cf9b..2132f85 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -94,7 +94,7 @@ fullbench-lib: fullbench.c $(LZ4DIR)/xxhash.c fullbench-dll: fullbench.c $(LZ4DIR)/xxhash.c $(MAKE) -C $(LZ4DIR) liblz4 - $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/liblz4.dll.a + $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/dll/liblz4.lib fuzzer : $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/xxhash.o fuzzer.c $(CC) $(FLAGS) $^ -o $@$(EXT) diff --git a/visual/README.md b/visual/README.md index 907cb92..4e76eb2 100644 --- a/visual/README.md +++ b/visual/README.md @@ -31,14 +31,23 @@ following projects: - `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_x86.lib` or `liblz4_x64.lib` -- `liblz4-dll` : A dynamic LZ4 library (DLL) compiled to `lz4_x86.dll` or `lz4_x64.dll` with the import library `lz4_x86.lib` or `lz4_x64.lib` +- `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 -1. Copy `lz4.h` into a directory found in the INCLUDE path list. -2. Copy the import library `lz4_x86.lib` or `lz4_x64.lib` into a directory found in the LIB path list. -3. Add `lz4_x86.lib` or `lz4_x64.lib` to your project. -4. Compile the project. The compiled executable requires `lz4_x86.dll` or `lz4_x64.dll`. +The header files `lib\lz4.h`, `lib\lz4hc.h`, `lib\lz4frame.h` and the import library +`visual\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 `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 +`visual\VS2010\bin\$(Platform)_$(Configuration)\liblz4.dll`. diff --git a/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj b/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj index c25e41c..16a4f0d 100644 --- a/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj +++ b/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -96,7 +96,7 @@ <SubSystem>Console</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>lz4_x86.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> @@ -114,7 +114,7 @@ <SubSystem>Console</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>lz4_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -135,7 +135,7 @@ <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>lz4_x86.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> @@ -157,7 +157,7 @@ <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <AdditionalLibraryDirectories>$(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>lz4_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>liblz4.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/visual/VS2010/liblz4-dll/lz4-dll.rc b/visual/VS2010/liblz4-dll/liblz4-dll.rc index b1871fe..b1871fe 100644 --- a/visual/VS2010/liblz4-dll/lz4-dll.rc +++ b/visual/VS2010/liblz4-dll/liblz4-dll.rc diff --git a/visual/VS2010/liblz4-dll/lz4-dll.vcxproj b/visual/VS2010/liblz4-dll/liblz4-dll.vcxproj index ac17287..389f13c 100644 --- a/visual/VS2010/liblz4-dll/lz4-dll.vcxproj +++ b/visual/VS2010/liblz4-dll/liblz4-dll.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -67,23 +67,23 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> - <TargetName>lz4_x86</TargetName> + <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>lz4_x64</TargetName> + <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>lz4_x86</TargetName> + <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>lz4_x64</TargetName> + <TargetName>liblz4</TargetName> <IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> <RunCodeAnalysis>true</RunCodeAnalysis> </PropertyGroup> @@ -167,7 +167,7 @@ <ClCompile Include="..\..\..\lib\xxhash.c" /> </ItemGroup> <ItemGroup> - <ResourceCompile Include="lz4-dll.rc" /> + <ResourceCompile Include="liblz4-dll.rc" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/visual/VS2010/liblz4/liblz4.vcxproj b/visual/VS2010/liblz4/liblz4.vcxproj index bafc998..a0b8000 100644 --- a/visual/VS2010/liblz4/liblz4.vcxproj +++ b/visual/VS2010/liblz4/liblz4.vcxproj @@ -66,23 +66,23 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> - <TargetName>liblz4_x86</TargetName> + <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_x64</TargetName> + <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_x86</TargetName> + <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_x64</TargetName> + <TargetName>liblz4_static</TargetName> <IncludePath>$(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath> <RunCodeAnalysis>true</RunCodeAnalysis> </PropertyGroup> diff --git a/visual/VS2010/lz4.sln b/visual/VS2010/lz4.sln index d3725ae..78f223b 100644 --- a/visual/VS2010/lz4.sln +++ b/visual/VS2010/lz4.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Express 2012 for Windows Desktop Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lz4", "lz4\lz4.vcxproj", "{E30329AC-0057-4FE0-8FDA-7F650D398C4C}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4-dll", "liblz4-dll\lz4-dll.vcxproj", "{9800039D-4AAA-43A4-BB78-FEF6F4836927}" +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 |