From b9dddc06fe2ce326c372aaa2fd0a64f6bafd78bd Mon Sep 17 00:00:00 2001 From: Joerg-Christian Boehme Date: Mon, 9 Dec 2019 15:55:39 +0100 Subject: [PATCH] Add 'cppfs' package (#92) * Initial commit * First compiling version * Cleanup hunter.cmake * Fix findings * Add pull request id --- cmake/configs/default.cmake | 1 + cmake/projects/cppfs/hunter.cmake | 31 +++++++++++++++++++++++++++++++ docs/packages/pkg/cppfs.rst | 20 ++++++++++++++++++++ examples/cppfs/CMakeLists.txt | 18 ++++++++++++++++++ examples/cppfs/boo.cpp | 18 ++++++++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 cmake/projects/cppfs/hunter.cmake create mode 100644 docs/packages/pkg/cppfs.rst create mode 100644 examples/cppfs/CMakeLists.txt create mode 100644 examples/cppfs/boo.cpp diff --git a/cmake/configs/default.cmake b/cmake/configs/default.cmake index e1211b27b1..4a5a7efe8e 100644 --- a/cmake/configs/default.cmake +++ b/cmake/configs/default.cmake @@ -207,6 +207,7 @@ hunter_default_version(convertutf VERSION 1.0.1) hunter_default_version(corrade VERSION 2019.01) hunter_default_version(cpp_redis VERSION 3.5.0-h1) hunter_default_version(cppcodec VERSION 0.2-p0) +hunter_default_version(cppfs VERSION 1.3.0) hunter_default_version(cpr VERSION 1.3.0) hunter_default_version(cpuinfo VERSION 0.0.0-d5e37ad-p0) hunter_default_version(crashpad VERSION v0.0.1-p0) diff --git a/cmake/projects/cppfs/hunter.cmake b/cmake/projects/cppfs/hunter.cmake new file mode 100644 index 0000000000..5f5596e6bc --- /dev/null +++ b/cmake/projects/cppfs/hunter.cmake @@ -0,0 +1,31 @@ +# !!! 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 + cppfs + VERSION + 1.3.0 + URL + "https://github.com/cginternals/cppfs/archive/v1.3.0.zip" + SHA1 + b7ac401ba784c691546cd087a76701c39ed8f418 +) + +hunter_cmake_args( + cppfs + CMAKE_ARGS + OPTION_BUILD_TESTS=OFF +) + +hunter_pick_scheme(DEFAULT url_sha1_cmake) +hunter_cacheable(cppfs) +hunter_download( + PACKAGE_NAME cppfs + PACKAGE_INTERNAL_DEPS_ID "1" +) diff --git a/docs/packages/pkg/cppfs.rst b/docs/packages/pkg/cppfs.rst new file mode 100644 index 0000000000..ee73bf0608 --- /dev/null +++ b/docs/packages/pkg/cppfs.rst @@ -0,0 +1,20 @@ +.. spelling:: + + cppfs + +.. index:: + single: unsorted ; cppfs + +.. _pkg.cppfs: + +cppfs +===== + +- `Official `__ +- `Example `__ +- Added by `Joerg-Christian Boehme `__ (`pr-92 `__) + +.. literalinclude:: /../examples/cppfs/CMakeLists.txt + :language: cmake + :start-after: # DOCUMENTATION_START { + :end-before: # DOCUMENTATION_END } diff --git a/examples/cppfs/CMakeLists.txt b/examples/cppfs/CMakeLists.txt new file mode 100644 index 0000000000..0808319138 --- /dev/null +++ b/examples/cppfs/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (c) 2016-2018, Ruslan Baratov +# All rights reserved. + +cmake_minimum_required(VERSION 3.2) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(cppfs) + +# DOCUMENTATION_START { +hunter_add_package(cppfs) +find_package(cppfs CONFIG REQUIRED) + +add_executable(boo boo.cpp) +target_link_libraries(boo PRIVATE cppfs::cppfs) +# DOCUMENTATION_END } diff --git a/examples/cppfs/boo.cpp b/examples/cppfs/boo.cpp new file mode 100644 index 0000000000..b48a3669f5 --- /dev/null +++ b/examples/cppfs/boo.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +using namespace cppfs; + +int main() { + FileHandle fh = fs::open("testfile"); + + if (fh.isFile()) + { + auto in = fh.createInputStream(); + // ... + + auto out = fh.createOutputStream(); + // ... + } +}