This commit is contained in:
codicodi 2016-12-30 13:31:33 +01:00 committed by GitHub
parent 31daeeb7f5
commit bf559d51ec
4 changed files with 86 additions and 0 deletions

26
ports/lz4/CMakeLists.txt Normal file
View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.0)
project(lz4)
if(BUILD_SHARED_LIBS)
add_definitions(-DLZ4_DLL_EXPORT)
endif()
add_definitions(-DXXH_NAMESPACE=LZ4_)
add_library(lz4
lib/lz4.c
lib/lz4frame.c
lib/lz4hc.c
lib/xxhash.c)
install(TARGETS lz4
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
if(NOT LZ4_SKIP_INCLUDES)
install(FILES
lib/lz4.h
lib/lz4frame.h
lib/lz4hc.h
DESTINATION include)
endif()

3
ports/lz4/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: lz4
Version: 1.7.4.2
Description: Lossless compression algorithm, providing compression speed at 400 MB/s per core.

View File

@ -0,0 +1,28 @@
diff --git a/lz4.h b/lz4.h
index 7420ad8..c1c3e56 100644
--- a/lz4.h
+++ b/lz4.h
@@ -73,6 +73,9 @@ extern "C" {
* LZ4_DLL_EXPORT :
* Enable exporting of functions when building a Windows DLL
*/
+
+#define LZ4_DLL_IMPORT 1
+
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
# define LZ4LIB_API __declspec(dllexport)
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
diff --git a/lz4frame.h b/lz4frame.h
index 3104d2e..4442461 100644
--- a/lz4frame.h
+++ b/lz4frame.h
@@ -55,6 +55,9 @@ extern "C" {
* LZ4_DLL_EXPORT :
* Enable exporting of functions when building a Windows DLL
*/
+
+#define LZ4_DLL_IMPORT 1
+
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
# define LZ4FLIB_API __declspec(dllexport)
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)

29
ports/lz4/portfile.cmake Normal file
View File

@ -0,0 +1,29 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lz4-1.7.4.2)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/lz4/lz4/archive/v1.7.4.2.zip"
FILENAME "lz4-1.7.4.2.zip"
SHA512 c9a65031225ccda43ad4c7622e9f36762c18e58b4aaf43b1a33f219186fb55c43ca354f574a1591188db39f57631351b1b90f96e0c150e28de08dcb65c6759d0)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG
-DLZ4_SKIP_INCLUDES=ON)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
PATCHES
${CMAKE_CURRENT_LIST_DIR}/auto-define-import-macro.patch)
endif()
file(COPY ${SOURCE_PATH}/lib/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lz4)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/lz4/LICENSE ${CURRENT_PACKAGES_DIR}/share/lz4/copyright)