Skip to content

Commit

Permalink
Add 'tinyrefl' package (#137)
Browse files Browse the repository at this point in the history
* Initial tinyrefl commit

* Add url

* Add default version

* Change to cmake scheme

* Switch back to version 0.4.1

* First working version

* Cleanup for PR

* Add PR number

* Update tinyrefl release version
  • Loading branch information
Bjoe authored and rbsheth committed Jan 15, 2020
1 parent 08ed13f commit a80fcd5
Show file tree
Hide file tree
Showing 6 changed files with 84 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 @@ -497,6 +497,7 @@ hunter_default_version(thread-pool-cpp VERSION 1.1.0)
hunter_default_version(thrift VERSION 0.12.0-p0)
hunter_default_version(tiny-process-library VERSION 2.0.2-p0)
hunter_default_version(tinydir VERSION 1.2-p0)
hunter_default_version(tinyrefl VERSION 0.4.1-p0)
hunter_default_version(tinyxml2 VERSION 6.2.0-p1)
hunter_default_version(tmxparser VERSION 2.1.0-ab4125b-p1)
hunter_default_version(toluapp VERSION 1.0.93-p1)
Expand Down
25 changes: 25 additions & 0 deletions cmake/projects/tinyrefl/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# !!! 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
tinyrefl
VERSION
0.4.1-p0
URL
"https://github.com/cpp-pm/tinyrefl/archive/v0.4.1-p0.zip"
SHA1
8aa103cf3d0064cacca3188ef259d82dc9e9fa67
)

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

tinyrefl

.. index::
single: unsorted ; tinyrefl

.. _pkg.tinyrefl:

tinyrefl
========

- `Official <https://gitlab.com/Manu343726/tinyrefl/-/wikis/home>`__
- `Hunterized <https://github.com/cpp-pm/tinyrefl>`__
- `Example <https://github.com/cpp-pm/hunter/blob/master/examples/tinyrefl/CMakeLists.txt>`__
- Added by `Joerg-Christian Boehme <https://github.com/Bjoe>`__ (`pr-137 <https://github.com/cpp-pm/hunter/pull/137>`__)

.. literalinclude:: /../examples/tinyrefl/CMakeLists.txt
:language: cmake
:start-after: # DOCUMENTATION_START {
:end-before: # DOCUMENTATION_END }
20 changes: 20 additions & 0 deletions examples/tinyrefl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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(tinyrefl)

# DOCUMENTATION_START {
hunter_add_package(tinyrefl)
find_package(tinyrefl CONFIG REQUIRED)
find_package(tinyrefl_tool CONFIG REQUIRED)

add_executable(boo boo.cpp)
tinyrefl_tool(TARGET boo HEADERS example.hpp)
target_link_libraries(boo PUBLIC tinyrefl::tinyrefl)
# DOCUMENTATION_END }
8 changes: 8 additions & 0 deletions examples/tinyrefl/boo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <tinyrefl/api.hpp>

#include "example.hpp"
#include "example.hpp.tinyrefl" // This header is generated via tinyrefl_tool() in cmake.

int main() {
static_assert(tinyrefl::has_metadata<example::A>(), "");
}
9 changes: 9 additions & 0 deletions examples/tinyrefl/example.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace example
{

struct A
{
int a = 42;
};

}

0 comments on commit a80fcd5

Please sign in to comment.