diff --git a/cmake/configs/default.cmake b/cmake/configs/default.cmake index dcf3e14453..bc228b7d17 100644 --- a/cmake/configs/default.cmake +++ b/cmake/configs/default.cmake @@ -281,6 +281,7 @@ hunter_default_version(eos VERSION 0.12.1) hunter_default_version(etc2comp VERSION 0.0.0-9cd0f9c-p0) hunter_default_version(ethash VERSION 1.0.0) hunter_default_version(eventpp VERSION 0.1.2-for-hunter-pm) +hunter_default_version(eyalroz_printf VERSION 6.2.0) hunter_default_version(farmhash VERSION 1.1) hunter_default_version(fast_obj VERSION 1.1-9255172-p0) hunter_default_version(ffmpeg VERSION n4.1-dev-45499e557c-p7) diff --git a/cmake/projects/eyalroz_printf/hunter.cmake b/cmake/projects/eyalroz_printf/hunter.cmake new file mode 100644 index 0000000000..5dbf4f402a --- /dev/null +++ b/cmake/projects/eyalroz_printf/hunter.cmake @@ -0,0 +1,29 @@ +# Copyright (c) 2024 Eyal Rozenberg +# Copyright (c) 2024 Alexander Voronov +# 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 eyalroz_printf + VERSION "6.2.0" + URL "https://github.com/eyalroz/printf/archive/refs/tags/v6.2.0.zip" + SHA1 f60ce53b0d47e1ff0c4f54cd702a71eec362ffc6 +) + +hunter_cmake_args( + eyalroz_printf + CMAKE_ARGS + BUILD_TESTS=OFF +) + +hunter_pick_scheme(DEFAULT url_sha1_cmake) +hunter_cacheable(eyalroz_printf) +hunter_download(PACKAGE_NAME eyalroz_printf) + diff --git a/docs/packages/pkg/eyalroz_printf.rst b/docs/packages/pkg/eyalroz_printf.rst new file mode 100644 index 0000000000..ad520304a0 --- /dev/null +++ b/docs/packages/pkg/eyalroz_printf.rst @@ -0,0 +1,42 @@ +.. spelling:: + + eyalroz + printf + +.. index:: logging ; eyalroz_printf + +.. _pkg.eyalroz_printf: + +eyalroz_printf +============== + +- `Official `__ +- `Example `__ +- Added by `Alexander Voronov `__ (`pr-725 `__) + + +.. literalinclude:: /../examples/eyalroz_printf/CMakeLists.txt + :language: cmake + :start-after: # DOCUMENTATION_START { + :end-before: # DOCUMENTATION_END } + +CMake options +------------- + +The ``CMAKE_ARGS`` feature (see +`customization `__) +can be used to customize package: + +- For example, to build static library: + + .. code-block:: cmake + + hunter_config( + eyalroz_printf + VERSION ${HUNTER_eyalroz_printf_VERSION} + CMAKE_ARGS + BUILD_SHARED_LIBS=OFF + ) + +For more options see `original repository `__. + diff --git a/examples/eyalroz_printf/CMakeLists.txt b/examples/eyalroz_printf/CMakeLists.txt new file mode 100644 index 0000000000..3725360fb6 --- /dev/null +++ b/examples/eyalroz_printf/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (c) 2024 Eyal Rozenberg +# Copyright (c) 2024 Alexander Voronov +# All rights reserved. + +cmake_minimum_required(VERSION 3.5) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(download-eyalroz_printf) + +# DOCUMENTATION_START { +hunter_add_package(eyalroz_printf) +find_package(printf CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PUBLIC printf::printf) +# DOCUMENTATION_END } + +# Test double library creation +find_package(printf CONFIG REQUIRED) diff --git a/examples/eyalroz_printf/main.c b/examples/eyalroz_printf/main.c new file mode 100644 index 0000000000..683a18ca88 --- /dev/null +++ b/examples/eyalroz_printf/main.c @@ -0,0 +1,12 @@ +#include +#include + +void putchar_(char c) { + putchar(c); +} + +int main() { + printf_("%s %d %f\n", "Hello World!", 42, 3.1415); + return 0; +} +