Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ hunter_default_version(libarchive VERSION 3.4.3)
hunter_default_version(libbacktrace VERSION 1.0.0-ca0de051)
hunter_default_version(libcpuid VERSION 0.4.0)
hunter_default_version(libdaemon VERSION 0.14)
hunter_default_version(libdeflate VERSION 1.24-p0)
hunter_default_version(libdill VERSION 1.6)
hunter_default_version(libevhtp VERSION 1.2.16-p4)
hunter_default_version(libffi VERSION 3.2.1)
Expand Down
36 changes: 36 additions & 0 deletions cmake/projects/libdeflate/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2016-2020, Rahul Sheth, Ruslan Baratov
# All rights reserved.

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

include(hunter_add_version)
include(hunter_cmake_args)
include(hunter_cacheable)
include(hunter_download)
include(hunter_pick_scheme)

# need to use hunter fork, v1.24 isn't relocatable yet
# open PR: https://github.com/ebiggers/libdeflate/pull/434
hunter_add_version(
PACKAGE_NAME
libdeflate
VERSION
1.24-p0
URL
"https://github.com/cpp-pm/libdeflate/archive/refs/tags/v1.24-p0.tar.gz"
SHA1
07f1a72f3938377615da6e4bb48be77d1e8938a4
)

hunter_cmake_args(
libdeflate
CMAKE_ARGS
LIBDEFLATE_BUILD_STATIC_LIB=YES
LIBDEFLATE_BUILD_SHARED_LIB=NO
LIBDEFLATE_USE_SHARED_LIB=NO
LIBDEFLATE_BUILD_TESTS=NO
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(libdeflate)
hunter_download(PACKAGE_NAME libdeflate)
22 changes: 22 additions & 0 deletions docs/packages/pkg/libdeflate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
```{spelling:word-list}

libdeflate
```

```{index} single: compression ; libdeflate
```

(pkg.libdeflate)=

# libdeflate

- [Official](https://github.com/ebiggers/libdeflate)
- [Hunterized](https://github.com/cpp-pm/libdeflate)
- [Example](https://github.com/cpp-pm/hunter/blob/master/examples/libdeflate/CMakeLists.txt)
- Added by [NeroBurner](https://github.com/neroburner) ([pr-812](https://github.com/cpp-pm/hunter/pull/812))

```{literalinclude} /../examples/libdeflate/CMakeLists.txt
:language: cmake
:start-after: "# DOCUMENTATION_START {"
:end-before: "# DOCUMENTATION_END }"
```
18 changes: 18 additions & 0 deletions examples/libdeflate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2025, NeroBurner
# All rights reserved.

cmake_minimum_required(VERSION 3.10)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-libdeflate)

# DOCUMENTATION_START {
hunter_add_package(libdeflate)
find_package(libdeflate CONFIG REQUIRED)

add_executable(boo boo.cpp)
target_link_libraries(boo PUBLIC libdeflate::libdeflate_static)
# DOCUMENTATION_END }
10 changes: 10 additions & 0 deletions examples/libdeflate/boo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <libdeflate.h>
#include <iostream>

int main() {
std::cout << "libdeflate version: " << LIBDEFLATE_VERSION_STRING << std::endl;
libdeflate_compressor *compressor = libdeflate_alloc_compressor(0);
size_t compressed_bound = libdeflate_deflate_compress_bound(compressor, 1337);
std::cout << "libdeflate_deflate_compress_bound(1337) => " << compressed_bound << std::endl;
libdeflate_free_compressor(compressor);
}
Loading