From dd4bf5bdd46a6976253abc3e552e5a6c09f1535c Mon Sep 17 00:00:00 2001 From: drodin Date: Fri, 2 Sep 2022 14:37:09 +0700 Subject: [PATCH] Add 'brotli' package --- cmake/configs/default.cmake | 1 + cmake/projects/brotli/hunter.cmake | 30 ++++++++++++++++++++++++++++++ docs/packages/pkg/brotli.rst | 21 +++++++++++++++++++++ examples/brotli/CMakeLists.txt | 18 ++++++++++++++++++ examples/brotli/boo.cpp | 6 ++++++ 5 files changed, 76 insertions(+) create mode 100644 cmake/projects/brotli/hunter.cmake create mode 100644 docs/packages/pkg/brotli.rst create mode 100644 examples/brotli/CMakeLists.txt create mode 100644 examples/brotli/boo.cpp diff --git a/cmake/configs/default.cmake b/cmake/configs/default.cmake index 00060a19ef..f57c1fce66 100644 --- a/cmake/configs/default.cmake +++ b/cmake/configs/default.cmake @@ -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) diff --git a/cmake/projects/brotli/hunter.cmake b/cmake/projects/brotli/hunter.cmake new file mode 100644 index 0000000000..fea6aa2bc5 --- /dev/null +++ b/cmake/projects/brotli/hunter.cmake @@ -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) diff --git a/docs/packages/pkg/brotli.rst b/docs/packages/pkg/brotli.rst new file mode 100644 index 0000000000..14d158a095 --- /dev/null +++ b/docs/packages/pkg/brotli.rst @@ -0,0 +1,21 @@ +.. spelling:: + + brotli + +.. index:: + single: compression ; brotli + +.. _pkg.brotli: + +brotli +====== + +- `Official `__ +- `Hunterized `__ +- `Example `__ +- Added by `drodin `__ (`pr-604 `__) + +.. literalinclude:: /../examples/brotli/CMakeLists.txt + :language: cmake + :start-after: # DOCUMENTATION_START { + :end-before: # DOCUMENTATION_END } diff --git a/examples/brotli/CMakeLists.txt b/examples/brotli/CMakeLists.txt new file mode 100644 index 0000000000..2d47644cba --- /dev/null +++ b/examples/brotli/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (c) 2016-2020, Rahul Sheth, Ruslan Baratov +# All rights reserved. + +cmake_minimum_required(VERSION 3.5) + +# 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 } diff --git a/examples/brotli/boo.cpp b/examples/brotli/boo.cpp new file mode 100644 index 0000000000..ef4ee3bacc --- /dev/null +++ b/examples/brotli/boo.cpp @@ -0,0 +1,6 @@ +#include +#include + +int main() { + return !(BrotliDecoderVersion() == BrotliEncoderVersion()); +}