add version to sources and cmake project

This commit is contained in:
BlackMATov
2022-12-31 04:09:29 +07:00
parent 2e637d1b8c
commit 761eb11e47
19 changed files with 104 additions and 80 deletions

View File

@@ -1,12 +1,30 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR) cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
if(NOT DEFINED PROJECT_NAME) #
set(BUILD_AS_STANDALONE ON) # VERSION
else() #
set(BUILD_AS_STANDALONE OFF)
endif()
project(meta.hpp) file(READ headers/meta.hpp/meta_base/base.hpp META_HPP_BASE_FILE)
string(REGEX MATCH "#define[ ]+META_HPP_VERSION_MAJOR[ ]+([0-9]+)" _ ${META_HPP_BASE_FILE})
set(META_HPP_VERSION_MAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ ]+META_HPP_VERSION_MINOR[ ]+([0-9]+)" _ ${META_HPP_BASE_FILE})
set(META_HPP_VERSION_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ ]+META_HPP_VERSION_PATCH[ ]+([0-9]+)" _ ${META_HPP_BASE_FILE})
set(META_HPP_VERSION_PATCH "${CMAKE_MATCH_1}")
set(META_HPP_VERSION ${META_HPP_VERSION_MAJOR}.${META_HPP_VERSION_MINOR}.${META_HPP_VERSION_PATCH})
#
# PROJECT
#
project(meta.hpp
VERSION ${META_HPP_VERSION}
DESCRIPTION "C++20 tiny dynamic reflection library"
HOMEPAGE_URL "https://github.com/blackmatov/meta.hpp")
add_library(${PROJECT_NAME} INTERFACE) add_library(${PROJECT_NAME} INTERFACE)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_20) target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_20)
@@ -16,10 +34,10 @@ find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads) target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads)
# #
# BUILD_AS_STANDALONE # DEVELOPER
# #
if(NOT ${BUILD_AS_STANDALONE}) if(NOT PROJECT_IS_TOP_LEVEL)
return() return()
endif() endif()

View File

@@ -3,7 +3,7 @@
"cmakeMinimumRequired": { "cmakeMinimumRequired": {
"major": 3, "major": 3,
"minor": 20, "minor": 21,
"patch": 0 "patch": 0
}, },

View File

@@ -9,7 +9,6 @@
#include "meta_base.hpp" #include "meta_base.hpp"
#include "meta_binds.hpp" #include "meta_binds.hpp"
#include "meta_binds/array_bind.hpp" #include "meta_binds/array_bind.hpp"
#include "meta_binds/class_bind.hpp" #include "meta_binds/class_bind.hpp"
#include "meta_binds/enum_bind.hpp" #include "meta_binds/enum_bind.hpp"

View File

@@ -6,34 +6,7 @@
#pragma once #pragma once
#include <cassert> #include "meta_base/base.hpp"
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <atomic>
#include <concepts>
#include <functional>
#include <initializer_list>
#include <iosfwd>
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <span>
#include <stdexcept>
#include <string_view>
#include <string>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <utility>
#include <variant>
#include <vector>
#include "meta_base/bitflags.hpp" #include "meta_base/bitflags.hpp"
#include "meta_base/cv_traits.hpp" #include "meta_base/cv_traits.hpp"
#include "meta_base/cvref_traits.hpp" #include "meta_base/cvref_traits.hpp"
@@ -48,14 +21,6 @@
#include "meta_base/type_kinds.hpp" #include "meta_base/type_kinds.hpp"
#include "meta_base/type_list.hpp" #include "meta_base/type_list.hpp"
#if !defined(__cpp_exceptions)
# define META_HPP_NO_EXCEPTIONS
#endif
#if !defined(__cpp_rtti)
# define META_HPP_NO_RTTI
#endif
namespace meta_hpp namespace meta_hpp
{ {
using detail::select_const; using detail::select_const;

View File

@@ -0,0 +1,47 @@
/*******************************************************************************
* This file is part of the "https://github.com/blackmatov/meta.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2021-2022, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#pragma once
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <atomic>
#include <concepts>
#include <functional>
#include <initializer_list>
#include <iosfwd>
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <span>
#include <stdexcept>
#include <string_view>
#include <string>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <utility>
#include <variant>
#include <vector>
#define META_HPP_VERSION_MAJOR 0
#define META_HPP_VERSION_MINOR 0
#define META_HPP_VERSION_PATCH 1
#if !defined(__cpp_exceptions)
# define META_HPP_NO_EXCEPTIONS
#endif
#if !defined(__cpp_rtti)
# define META_HPP_NO_RTTI
#endif

View File

@@ -6,9 +6,7 @@
#pragma once #pragma once
#include <functional> #include "base.hpp"
#include <type_traits>
#include <utility>
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,7 +6,7 @@
#pragma once #pragma once
#include <type_traits> #include "base.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,7 +6,7 @@
#pragma once #pragma once
#include <type_traits> #include "base.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,14 +6,7 @@
#pragma once #pragma once
#include <cassert> #include "base.hpp"
#include <cstddef>
#include <concepts>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,8 +6,7 @@
#pragma once #pragma once
#include <cstddef> #include "base.hpp"
#include <functional>
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,8 +6,7 @@
#pragma once #pragma once
#include <type_traits> #include "base.hpp"
#include <utility>
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,6 +6,8 @@
#pragma once #pragma once
#include "base.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail
{ {
class noncopyable { class noncopyable {

View File

@@ -6,6 +6,8 @@
#pragma once #pragma once
#include "base.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail
{ {
template < typename... Ts > template < typename... Ts >

View File

@@ -6,6 +6,8 @@
#pragma once #pragma once
#include "base.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail
{ {
template < typename C, typename R, typename... Args > template < typename C, typename R, typename... Args >

View File

@@ -6,7 +6,7 @@
#pragma once #pragma once
#include <type_traits> #include "base.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,10 +6,7 @@
#pragma once #pragma once
#include <atomic> #include "base.hpp"
#include <cstdint>
#include <functional>
#include "type_list.hpp" #include "type_list.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail

View File

@@ -6,8 +6,7 @@
#pragma once #pragma once
#include <cstdint> #include "base.hpp"
#include <type_traits>
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -6,7 +6,7 @@
#pragma once #pragma once
#include <tuple> #include "base.hpp"
namespace meta_hpp::detail namespace meta_hpp::detail
{ {

View File

@@ -31,6 +31,18 @@
#include <variant> #include <variant>
#include <vector> #include <vector>
#define META_HPP_VERSION_MAJOR 0
#define META_HPP_VERSION_MINOR 0
#define META_HPP_VERSION_PATCH 1
#if !defined(__cpp_exceptions)
# define META_HPP_NO_EXCEPTIONS
#endif
#if !defined(__cpp_rtti)
# define META_HPP_NO_RTTI
#endif
namespace meta_hpp::detail namespace meta_hpp::detail
{ {
template < typename Enum > template < typename Enum >
@@ -718,14 +730,6 @@ namespace meta_hpp::detail
} }
} }
#if !defined(__cpp_exceptions)
# define META_HPP_NO_EXCEPTIONS
#endif
#if !defined(__cpp_rtti)
# define META_HPP_NO_RTTI
#endif
namespace meta_hpp namespace meta_hpp
{ {
using detail::select_const; using detail::select_const;