now in conan-center
This commit is contained in:
parent
735ba9fb1d
commit
7daf306654
5 changed files with 2 additions and 101 deletions
|
@ -8,7 +8,7 @@
|
||||||
```
|
```
|
||||||
|
|
||||||
[![Github releases](https://img.shields.io/github/release/Neargye/nameof.svg)](https://github.com/Neargye/nameof/releases)
|
[![Github releases](https://img.shields.io/github/release/Neargye/nameof.svg)](https://github.com/Neargye/nameof/releases)
|
||||||
[![Conan package](https://img.shields.io/badge/Conan-package-blueviolet)](https://bintray.com/neargye/conan-packages/nameof:neargye)
|
[![Conan package](https://img.shields.io/badge/Conan-package-blueviolet)](https://conan.io/center/nameof/0.9.4)
|
||||||
[![Vcpkg package](https://img.shields.io/badge/Vcpkg-package-blueviolet)](https://github.com/microsoft/vcpkg/tree/master/ports/nameof)
|
[![Vcpkg package](https://img.shields.io/badge/Vcpkg-package-blueviolet)](https://github.com/microsoft/vcpkg/tree/master/ports/nameof)
|
||||||
[![License](https://img.shields.io/github/license/Neargye/nameof.svg)](LICENSE)
|
[![License](https://img.shields.io/github/license/Neargye/nameof.svg)](LICENSE)
|
||||||
[![Build status](https://travis-ci.org/Neargye/nameof.svg?branch=master)](https://travis-ci.org/Neargye/nameof)
|
[![Build status](https://travis-ci.org/Neargye/nameof.svg?branch=master)](https://travis-ci.org/Neargye/nameof)
|
||||||
|
@ -120,7 +120,7 @@ You should add required file [nameof.hpp](include/nameof.hpp).
|
||||||
|
|
||||||
If you are using [vcpkg](https://github.com/Microsoft/vcpkg/) on your project for external dependencies, then you can use the [nameof package](https://github.com/microsoft/vcpkg/tree/master/ports/nameof).
|
If you are using [vcpkg](https://github.com/Microsoft/vcpkg/) on your project for external dependencies, then you can use the [nameof package](https://github.com/microsoft/vcpkg/tree/master/ports/nameof).
|
||||||
|
|
||||||
If you are using [Conan](https://www.conan.io/) to manage your dependencies, merely add `nameof/x.y.z@neargye/stable` to your conan's requires, where `x.y.z` is the release version you want to use.
|
If you are using [Conan](https://www.conan.io/) to manage your dependencies, merely add `nameof/x.y.z` to your conan's requires, where `x.y.z` is the release version you want to use.
|
||||||
|
|
||||||
Alternatively, you can use something like [CPM](https://github.com/TheLartians/CPM) which is based on CMake's `Fetch_Content` module.
|
Alternatively, you can use something like [CPM](https://github.com/TheLartians/CPM) which is based on CMake's `Fetch_Content` module.
|
||||||
|
|
||||||
|
|
52
conanfile.py
52
conanfile.py
|
@ -1,52 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from conans import ConanFile, tools
|
|
||||||
from conans.errors import ConanInvalidConfiguration
|
|
||||||
|
|
||||||
class NameofConan(ConanFile):
|
|
||||||
name = "nameof"
|
|
||||||
version = "0.9.4"
|
|
||||||
description = "Header-only C++17 library provides nameof macros and functions to simply obtain the name of a variable, type, function, macro, and enum."
|
|
||||||
topics = (
|
|
||||||
"conan",
|
|
||||||
"nameof",
|
|
||||||
"cplusplus",
|
|
||||||
"enum-to-string",
|
|
||||||
"serialization",
|
|
||||||
"reflection",
|
|
||||||
"header-only",
|
|
||||||
"compile-time"
|
|
||||||
)
|
|
||||||
url = "https://github.com/Neargye/nameof"
|
|
||||||
homepage = "https://github.com/Neargye/nameof"
|
|
||||||
author = "Daniil Goncharov <neargye@gmail.com>"
|
|
||||||
license = "MIT"
|
|
||||||
exports_sources = ["include/*", "LICENCE"]
|
|
||||||
exports = ["LICENSE"]
|
|
||||||
settings = "compiler"
|
|
||||||
no_copy_source = True
|
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_compiler(self):
|
|
||||||
compiler = str(self.settings.compiler)
|
|
||||||
version = tools.Version(self.settings.compiler.version)
|
|
||||||
if compiler == "Visual Studio" and version >= "15":
|
|
||||||
return True
|
|
||||||
if compiler == "gcc" and version >= "7":
|
|
||||||
return True
|
|
||||||
if compiler == "clang" and version >= "5":
|
|
||||||
return True
|
|
||||||
if compiler == "apple-clang" and version >= "9":
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def configure(self):
|
|
||||||
if not self.supported_compiler:
|
|
||||||
raise ConanInvalidConfiguration("nameof: Unsupported compiler (https://github.com/Neargye/nameof#compiler-compatibility).")
|
|
||||||
|
|
||||||
def package(self):
|
|
||||||
self.copy("include/*")
|
|
||||||
self.copy("LICENSE", dst="licenses")
|
|
||||||
|
|
||||||
def package_id(self):
|
|
||||||
self.info.header_only()
|
|
|
@ -1,10 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.8)
|
|
||||||
project(test_package CXX)
|
|
||||||
|
|
||||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
|
||||||
conan_basic_setup(TARGETS)
|
|
||||||
|
|
||||||
add_executable(test_package test_package.cpp)
|
|
||||||
target_link_libraries(test_package PRIVATE CONAN_PKG::nameof)
|
|
||||||
set_target_properties(test_package PROPERTIES CXX_EXTENSIONS OFF)
|
|
||||||
target_compile_features(test_package PRIVATE cxx_std_17)
|
|
|
@ -1,18 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from conans import ConanFile, CMake, tools
|
|
||||||
import os
|
|
||||||
|
|
||||||
class TestPackageConan(ConanFile):
|
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
|
||||||
generators = "cmake"
|
|
||||||
|
|
||||||
def build(self):
|
|
||||||
cmake = CMake(self)
|
|
||||||
cmake.configure()
|
|
||||||
cmake.build()
|
|
||||||
|
|
||||||
def test(self):
|
|
||||||
if not tools.cross_building(self.settings):
|
|
||||||
bin_path = os.path.join("bin", "test_package")
|
|
||||||
self.run(bin_path, run_environment=True)
|
|
|
@ -1,19 +0,0 @@
|
||||||
#include <nameof.hpp>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
struct SomeStruct {};
|
|
||||||
|
|
||||||
SomeStruct structvar;
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
constexpr auto name = NAMEOF(structvar);
|
|
||||||
static_assert("structvar" == name);
|
|
||||||
|
|
||||||
std::string_view res1 = NAMEOF(structvar);
|
|
||||||
std::string_view res2 = NAMEOF(::structvar);
|
|
||||||
|
|
||||||
bool success = (res1 == "structvar") && (res2 == "structvar");
|
|
||||||
|
|
||||||
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
||||||
}
|
|
Loading…
Reference in a new issue