diff options
Diffstat (limited to 'vcpkg/ports/openzl')
| -rw-r--r-- | vcpkg/ports/openzl/portfile.cmake | 55 | ||||
| -rw-r--r-- | vcpkg/ports/openzl/usage | 8 | ||||
| -rw-r--r-- | vcpkg/ports/openzl/use-system-zstd.patch | 38 | ||||
| -rw-r--r-- | vcpkg/ports/openzl/vcpkg.json | 24 | ||||
| -rw-r--r-- | vcpkg/ports/openzl/xxhash-wrapper.h | 11 |
5 files changed, 136 insertions, 0 deletions
diff --git a/vcpkg/ports/openzl/portfile.cmake b/vcpkg/ports/openzl/portfile.cmake new file mode 100644 index 0000000..efbe123 --- /dev/null +++ b/vcpkg/ports/openzl/portfile.cmake @@ -0,0 +1,55 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO facebook/openzl + REF v${VERSION} + SHA512 620ddbef22ba80266ad6f8655982a48d578bb0528bbeddc291e079a42883ec9bdeeb239cf5584eda0de4c7c493ced0a9c300e4cd4cd73f4c4a9449b54b3a477e + HEAD_REF main + PATCHES + use-system-zstd.patch +) + +file(REMOVE "${SOURCE_PATH}/src/openzl/shared/xxhash.h") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/xxhash-wrapper.h" DESTINATION "${SOURCE_PATH}/src/openzl/shared") +file(RENAME "${SOURCE_PATH}/src/openzl/shared/xxhash-wrapper.h" "${SOURCE_PATH}/src/openzl/shared/xxhash.h") + +vcpkg_cmake_get_vars(cmake_vars_file) +include("${cmake_vars_file}") +if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC") + message(FATAL_ERROR "MSVC is not supported; use clang-cl") +endif() + +set(OPENZL_BUILD_SHARED_LIBS OFF) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(OPENZL_BUILD_SHARED_LIBS ON) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_SHARED_LIBS=${OPENZL_BUILD_SHARED_LIBS} + -DOPENZL_BUILD_SHARED_LIBS=${OPENZL_BUILD_SHARED_LIBS} + -DOPENZL_BUILD_ALL=OFF + -DOPENZL_BUILD_CPP=ON + -DOPENZL_BUILD_CUSTOM_PARSERS=OFF + -DOPENZL_BUILD_TOOLS=OFF + -DOPENZL_BUILD_CLI=OFF + -DOPENZL_BUILD_EXAMPLES=OFF + -DOPENZL_BUILD_TESTS=OFF + -DOPENZL_BUILD_BENCHMARKS=OFF + -DOPENZL_BUILD_PARQUET_TOOLS=OFF + -DOPENZL_BUILD_PYTHON_EXT=OFF + -DOPENZL_BUILD_PYTHON_EXT_TESTS=OFF + -DOPENZL_ALLOW_INTROSPECTION=ON + -DOPENZL_INSTALL=ON + -DOPENZL_CPP_INSTALL=ON +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/openzl) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/vcpkg/ports/openzl/usage b/vcpkg/ports/openzl/usage new file mode 100644 index 0000000..ce625c6 --- /dev/null +++ b/vcpkg/ports/openzl/usage @@ -0,0 +1,8 @@ +OpenZL provides CMake targets: + + find_package(OpenZL CONFIG REQUIRED) + target_link_libraries(main PRIVATE OpenZL::openzl) + +Optional C++ bindings are available as: + + target_link_libraries(main PRIVATE OpenZL::openzl_cpp) diff --git a/vcpkg/ports/openzl/use-system-zstd.patch b/vcpkg/ports/openzl/use-system-zstd.patch new file mode 100644 index 0000000..ee1ac57 --- /dev/null +++ b/vcpkg/ports/openzl/use-system-zstd.patch @@ -0,0 +1,38 @@ +diff --git a/build/cmake/openzl-config.cmake.in b/build/cmake/openzl-config.cmake.in +index 60a354f..c5f3d96 100644 +--- a/build/cmake/openzl-config.cmake.in ++++ b/build/cmake/openzl-config.cmake.in +@@ -21,6 +21,8 @@ set_and_check(OPENZL_CMAKE_DIR "@PACKAGE_CMAKE_INSTALL_DIR@") + # openzl's prefix directory in the OPENZL_PREFIX_DIR variable + set(OPENZL_PREFIX_DIR "${PACKAGE_PREFIX_DIR}") + ++find_dependency(zstd CONFIG) ++ + # Include the openzl-targets.cmake file, which is generated from our CMake rules + if (NOT TARGET OpenZL::openzl) + include("${OPENZL_CMAKE_DIR}/openzl-targets.cmake") +diff --git a/build/cmake/openzl-deps.cmake b/build/cmake/openzl-deps.cmake +index 59b691a..c16d969 100644 +--- a/build/cmake/openzl-deps.cmake ++++ b/build/cmake/openzl-deps.cmake +@@ -40,7 +40,8 @@ endif() + message(STATUS "Attempting zstd dependency resolution...") + +-# Check if zstd is already available +-check_zstd_available(ZSTD_AVAILABLE) ++find_package(zstd CONFIG REQUIRED) ++set(ZSTD_AVAILABLE TRUE) ++add_library(libzstd ALIAS zstd::libzstd) + if(ZSTD_AVAILABLE) + message(STATUS "zstd dependency already present") + else() +--- a/build/cmake/openzl-deps.cmake ++++ b/build/cmake/openzl-deps.cmake +@@ -91,7 +91,6 @@ endif() + set(ZSTD_BUILD_TESTS OFF CACHE BOOL "") + + # Add zstd subdirectory directly instead of using FetchContent +-add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/deps/zstd/build/cmake" zstd_build) + # Note: find_package not needed when using add_subdirectory - targets are directly available + list(APPEND OPENZL_LINK_LIBRARIES libzstd) + diff --git a/vcpkg/ports/openzl/vcpkg.json b/vcpkg/ports/openzl/vcpkg.json new file mode 100644 index 0000000..84842e4 --- /dev/null +++ b/vcpkg/ports/openzl/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "openzl", + "version": "0.1.0", + "description": "Format-aware compression framework delivering high ratios while preserving speed.", + "homepage": "https://github.com/facebook/openzl", + "license": "BSD-3-Clause AND Apache-2.0", + "supports": "!uwp & !x86 & !arm32", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-cmake-get-vars", + "host": true + }, + "xxhash", + "zstd" + ] +} diff --git a/vcpkg/ports/openzl/xxhash-wrapper.h b/vcpkg/ports/openzl/xxhash-wrapper.h new file mode 100644 index 0000000..e00cdb9 --- /dev/null +++ b/vcpkg/ports/openzl/xxhash-wrapper.h @@ -0,0 +1,11 @@ +/* + * openzl wrapper around xxHash distributed via vcpkg. + * + * This header preserves the local configuration tweaks provided by + * zs_xxhash.h and then includes the xxhash header from the external + * dependency. + */ +#pragma once + +#include "openzl/shared/zs_xxhash.h" +#include <xxhash.h> |