Skip to content

Commit d8bad23

Browse files
committed
libdeflate: add new package with v1.24-p0
Need to use a patched version of `libdeflate` as the created CMake config contains absolute paths breaking the caching. Once ebiggers/libdeflate#434 is merged and released we can use pure upstream. Fixes: #804
1 parent 15fa3e1 commit d8bad23

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed

cmake/configs/default.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ hunter_default_version(libarchive VERSION 3.4.3)
374374
hunter_default_version(libbacktrace VERSION 1.0.0-ca0de051)
375375
hunter_default_version(libcpuid VERSION 0.4.0)
376376
hunter_default_version(libdaemon VERSION 0.14)
377+
hunter_default_version(libdeflate VERSION 1.24-p0)
377378
hunter_default_version(libdill VERSION 1.6)
378379
hunter_default_version(libevhtp VERSION 1.2.16-p4)
379380
hunter_default_version(libffi VERSION 3.2.1)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2016-2020, Rahul Sheth, Ruslan Baratov
2+
# All rights reserved.
3+
4+
# !!! DO NOT PLACE HEADER GUARDS HERE !!!
5+
6+
include(hunter_add_version)
7+
include(hunter_cmake_args)
8+
include(hunter_cacheable)
9+
include(hunter_download)
10+
include(hunter_pick_scheme)
11+
12+
# need to use hunter fork, v1.24 isn't relocatable yet
13+
# open PR: https://github.com/ebiggers/libdeflate/pull/434
14+
hunter_add_version(
15+
PACKAGE_NAME
16+
libdeflate
17+
VERSION
18+
1.24-p0
19+
URL
20+
"https://github.com/cpp-pm/libdeflate/archive/refs/tags/v1.24-p0.tar.gz"
21+
SHA1
22+
07f1a72f3938377615da6e4bb48be77d1e8938a4
23+
)
24+
25+
hunter_cmake_args(
26+
libdeflate
27+
CMAKE_ARGS
28+
LIBDEFLATE_BUILD_STATIC_LIB=YES
29+
LIBDEFLATE_BUILD_SHARED_LIB=NO
30+
LIBDEFLATE_USE_SHARED_LIB=NO
31+
LIBDEFLATE_BUILD_TESTS=NO
32+
)
33+
34+
hunter_pick_scheme(DEFAULT url_sha1_cmake)
35+
hunter_cacheable(libdeflate)
36+
hunter_download(PACKAGE_NAME libdeflate)

docs/packages/pkg/libdeflate.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
```{spelling:word-list}
2+
3+
libdeflate
4+
```
5+
6+
```{index} single: compression ; libdeflate
7+
```
8+
9+
(pkg.libdeflate)=
10+
11+
# libdeflate
12+
13+
- [Official](https://github.com/ebiggers/libdeflate)
14+
- [Hunterized](https://github.com/cpp-pm/libdeflate)
15+
- [Example](https://github.com/cpp-pm/hunter/blob/master/examples/libdeflate/CMakeLists.txt)
16+
- Added by [NeroBurner](https://github.com/neroburner) ([pr-812](https://github.com/cpp-pm/hunter/pull/812))
17+
18+
```{literalinclude} /../examples/libdeflate/CMakeLists.txt
19+
:language: cmake
20+
:start-after: "# DOCUMENTATION_START {"
21+
:end-before: "# DOCUMENTATION_END }"
22+
```

examples/libdeflate/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2025, NeroBurner
2+
# All rights reserved.
3+
4+
cmake_minimum_required(VERSION 3.10)
5+
6+
# Emulate HunterGate:
7+
# * https://github.com/hunter-packages/gate
8+
include("../common.cmake")
9+
10+
project(download-libdeflate)
11+
12+
# DOCUMENTATION_START {
13+
hunter_add_package(libdeflate)
14+
find_package(libdeflate CONFIG REQUIRED)
15+
16+
add_executable(boo boo.cpp)
17+
target_link_libraries(boo PUBLIC libdeflate::libdeflate_static)
18+
# DOCUMENTATION_END }

examples/libdeflate/boo.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <libdeflate.h>
2+
#include <iostream>
3+
4+
int main() {
5+
std::cout << "libdeflate version: " << LIBDEFLATE_VERSION_STRING << std::endl;
6+
libdeflate_compressor *compressor = libdeflate_alloc_compressor(0);
7+
size_t compressed_bound = libdeflate_deflate_compress_bound(compressor, 1337);
8+
std::cout << "libdeflate_deflate_compress_bound(1337) => " << compressed_bound << std::endl;
9+
libdeflate_free_compressor(compressor);
10+
}

0 commit comments

Comments
 (0)