mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-17 06:27:00 +07:00
add the library version to sources
This commit is contained in:
@@ -1,8 +1,40 @@
|
|||||||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||||
|
|
||||||
|
#
|
||||||
|
# version
|
||||||
|
#
|
||||||
|
|
||||||
|
file(READ "headers/meta.hpp/meta_base/base.hpp" META_HPP_BASE_HEADER_CONTENT)
|
||||||
|
|
||||||
|
set(META_HPP_VERSION_MAJOR_MATCHER "#[\t\r\n ]*define[\t\r\n ]*META_HPP_VERSION_MAJOR[\t\r\n ]*([0-9]+)")
|
||||||
|
set(META_HPP_VERSION_MINOR_MATCHER "#[\t\r\n ]*define[\t\r\n ]*META_HPP_VERSION_MINOR[\t\r\n ]*([0-9]+)")
|
||||||
|
set(META_HPP_VERSION_PATCH_MATCHER "#[\t\r\n ]*define[\t\r\n ]*META_HPP_VERSION_PATCH[\t\r\n ]*([0-9]+)")
|
||||||
|
|
||||||
|
if(META_HPP_BASE_HEADER_CONTENT MATCHES ${META_HPP_VERSION_MAJOR_MATCHER})
|
||||||
|
set(META_HPP_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "meta.hpp: failed to resolve a major version number")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(META_HPP_BASE_HEADER_CONTENT MATCHES ${META_HPP_VERSION_MINOR_MATCHER})
|
||||||
|
set(META_HPP_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "meta.hpp: failed to resolve a minor version number")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(META_HPP_BASE_HEADER_CONTENT MATCHES ${META_HPP_VERSION_PATCH_MATCHER})
|
||||||
|
set(META_HPP_VERSION_PATCH ${CMAKE_MATCH_1})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "meta.hpp: failed to resolve a patch version number")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# project
|
||||||
|
#
|
||||||
|
|
||||||
project(meta.hpp
|
project(meta.hpp
|
||||||
VERSION "0.0.1"
|
VERSION "${META_HPP_VERSION_MAJOR}.${META_HPP_VERSION_MINOR}.${META_HPP_VERSION_PATCH}"
|
||||||
DESCRIPTION "C++20 tiny dynamic reflection library"
|
DESCRIPTION "C++20 Dynamic Reflection Library"
|
||||||
HOMEPAGE_URL "https://github.com/blackmatov/meta.hpp"
|
HOMEPAGE_URL "https://github.com/blackmatov/meta.hpp"
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# meta.hpp
|
# meta.hpp
|
||||||
|
|
||||||
> C++20 tiny dynamic reflection library
|
> C++20 Dynamic Reflection Library
|
||||||
|
|
||||||
[![linux][badge.linux]][linux]
|
[![linux][badge.linux]][linux]
|
||||||
[![darwin][badge.darwin]][darwin]
|
[![darwin][badge.darwin]][darwin]
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
- type conversions
|
- type conversions
|
||||||
- non-linear search of methods/functions/...
|
- non-linear search of methods/functions/...
|
||||||
- register base types by `META_HPP_ENABLE_POLY_INFO`
|
- register base types by `META_HPP_ENABLE_POLY_INFO`
|
||||||
- add the library version to sources
|
|
||||||
- fix all includes to work with the library more flexible
|
- fix all includes to work with the library more flexible
|
||||||
- test and support shared libraries
|
- test and support shared libraries
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,36 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if !defined(META_HPP_VERSION_MAJOR)
|
||||||
|
# define META_HPP_VERSION_MAJOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(META_HPP_VERSION_MINOR)
|
||||||
|
# define META_HPP_VERSION_MINOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(META_HPP_VERSION_PATCH)
|
||||||
|
# define META_HPP_VERSION_PATCH 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#if META_HPP_VERSION_MINOR < 0 || META_HPP_VERSION_MINOR > 99
|
||||||
|
# error "meta.hpp: incorrect minor version number"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if META_HPP_VERSION_PATCH < 0 || META_HPP_VERSION_PATCH > 99
|
||||||
|
# error "meta.hpp: incorrect patch version number"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define META_HPP_VERSION META_HPP_VERSION_MAJOR * 10000 + META_HPP_VERSION_MINOR * 100 + META_HPP_VERSION_PATCH
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
#if !defined(META_HPP_NO_EXCEPTIONS) && !defined(__cpp_exceptions)
|
#if !defined(META_HPP_NO_EXCEPTIONS) && !defined(__cpp_exceptions)
|
||||||
# define META_HPP_NO_EXCEPTIONS
|
# define META_HPP_NO_EXCEPTIONS
|
||||||
#endif
|
#endif
|
||||||
@@ -58,15 +88,12 @@
|
|||||||
# define META_HPP_ASSERT(...) assert(__VA_ARGS__) // NOLINT
|
# define META_HPP_ASSERT(...) assert(__VA_ARGS__) // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(META_HPP_DEV_ASSERT)
|
||||||
# if defined(META_HPP_SANITIZERS)
|
# if defined(META_HPP_SANITIZERS)
|
||||||
# define META_HPP_DEV_ASSERT(...) META_HPP_ASSERT(__VA_ARGS__)
|
# define META_HPP_DEV_ASSERT(...) META_HPP_ASSERT(__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define META_HPP_DEV_ASSERT(...) (void)0
|
# define META_HPP_DEV_ASSERT(...) (void)0
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#if !defined(META_HPP_PP_CAT)
|
|
||||||
# define META_HPP_PP_CAT(x, y) META_HPP_PP_CAT_I(x, y)
|
|
||||||
# define META_HPP_PP_CAT_I(x, y) x##y
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -39,6 +39,36 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if !defined(META_HPP_VERSION_MAJOR)
|
||||||
|
# define META_HPP_VERSION_MAJOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(META_HPP_VERSION_MINOR)
|
||||||
|
# define META_HPP_VERSION_MINOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(META_HPP_VERSION_PATCH)
|
||||||
|
# define META_HPP_VERSION_PATCH 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#if META_HPP_VERSION_MINOR < 0 || META_HPP_VERSION_MINOR > 99
|
||||||
|
# error "meta.hpp: incorrect minor version number"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if META_HPP_VERSION_PATCH < 0 || META_HPP_VERSION_PATCH > 99
|
||||||
|
# error "meta.hpp: incorrect patch version number"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define META_HPP_VERSION META_HPP_VERSION_MAJOR * 10000 + META_HPP_VERSION_MINOR * 100 + META_HPP_VERSION_PATCH
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
#if !defined(META_HPP_NO_EXCEPTIONS) && !defined(__cpp_exceptions)
|
#if !defined(META_HPP_NO_EXCEPTIONS) && !defined(__cpp_exceptions)
|
||||||
# define META_HPP_NO_EXCEPTIONS
|
# define META_HPP_NO_EXCEPTIONS
|
||||||
#endif
|
#endif
|
||||||
@@ -59,15 +89,12 @@
|
|||||||
# define META_HPP_ASSERT(...) assert(__VA_ARGS__) // NOLINT
|
# define META_HPP_ASSERT(...) assert(__VA_ARGS__) // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(META_HPP_DEV_ASSERT)
|
||||||
# if defined(META_HPP_SANITIZERS)
|
# if defined(META_HPP_SANITIZERS)
|
||||||
# define META_HPP_DEV_ASSERT(...) META_HPP_ASSERT(__VA_ARGS__)
|
# define META_HPP_DEV_ASSERT(...) META_HPP_ASSERT(__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define META_HPP_DEV_ASSERT(...) (void)0
|
# define META_HPP_DEV_ASSERT(...) (void)0
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#if !defined(META_HPP_PP_CAT)
|
|
||||||
# define META_HPP_PP_CAT(x, y) META_HPP_PP_CAT_I(x, y)
|
|
||||||
# define META_HPP_PP_CAT_I(x, y) x##y
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user