Skip to content

Commit

Permalink
Add 'brotli' package
Browse files Browse the repository at this point in the history
  • Loading branch information
drodin committed Apr 26, 2024
1 parent 89ab45f commit c521429
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ hunter_default_version(bison VERSION 3.0.4-p0)
hunter_default_version(boost-pba VERSION 1.0.0-p0)
hunter_default_version(botan VERSION 2.11.0-110af9494)
hunter_default_version(breakpad VERSION 0.0.0-12ecff3-p4)
hunter_default_version(brotli VERSION 1.0.9-p0)
hunter_default_version(bullet VERSION 2.87-p0)
hunter_default_version(byte-lite VERSION 0.3.0-p0)
hunter_default_version(c-ares VERSION 1.14.0-p0)
Expand Down
30 changes: 30 additions & 0 deletions cmake/projects/brotli/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2016-2020, Rahul Sheth, Ruslan Baratov
# All rights reserved.

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

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

hunter_add_version(
PACKAGE_NAME
brotli
VERSION
1.0.9-p0
URL
"https://github.com/cpp-pm/brotli/archive/v1.0.9-p0.tar.gz"
SHA1
04697e4bb782218ba2a19f3084b3795be8f7b6f1
)

hunter_cmake_args(brotli CMAKE_ARGS
BROTLI_DISABLE_TESTS=YES
BROTLI_BUILD_EXECUTABLE=NO
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(brotli)
hunter_download(PACKAGE_NAME brotli)
21 changes: 21 additions & 0 deletions docs/packages/pkg/brotli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. spelling::

brotli

.. index::
single: compression ; brotli

.. _pkg.brotli:

brotli
======

- `Official <https://github.com/google/brotli>`__
- `Hunterized <https://github.com/cpp-pm/brotli>`__
- `Example <https://github.com/cpp-pm/hunter/blob/master/examples/brotli/CMakeLists.txt>`__
- Added by `drodin <https://github.com/drodin>`__ (`pr-604 <https://github.com/cpp-pm/hunter/pull/604>`__)

.. literalinclude:: /../examples/brotli/CMakeLists.txt
:language: cmake
:start-after: # DOCUMENTATION_START {
:end-before: # DOCUMENTATION_END }
18 changes: 18 additions & 0 deletions examples/brotli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2016-2020, Rahul Sheth, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.2)

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

project(download-brotli)

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

add_executable(boo boo.cpp)
target_link_libraries(boo PUBLIC brotli::brotlicommon brotli::brotlidec brotli::brotlienc)
# DOCUMENTATION_END }
6 changes: 6 additions & 0 deletions examples/brotli/boo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <brotli/decode.h>
#include <brotli/encode.h>

int main() {
return !(BrotliDecoderVersion() == BrotliEncoderVersion());
}

0 comments on commit c521429

Please sign in to comment.