mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-14 18:51:15 +00:00
(#11398) Add Platform.Converters/0.1.0
* Add platform.exceptions * Remove ranges tag * Use Clang 12 * Use Apple-Clang 12 * Upgrade Clangs * Use Clang 14 * Do not use CONAN_LIBS * Generate .cmake file
This commit is contained in:
4
recipes/platform.converters/all/conandata.yml
Normal file
4
recipes/platform.converters/all/conandata.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
sources:
|
||||
"0.1.0":
|
||||
url: https://github.com/linksplatform/Converters/archive/refs/tags/cpp_0.1.0.zip
|
||||
sha256: a1a9e566b6628b1e09875f9ee93fb7fb600a8371d07e00a25c127e1609375d96
|
65
recipes/platform.converters/all/conanfile.py
Normal file
65
recipes/platform.converters/all/conanfile.py
Normal file
@@ -0,0 +1,65 @@
|
||||
from conans import ConanFile, CMake, tools
|
||||
from conans.errors import ConanInvalidConfiguration
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.33.0"
|
||||
|
||||
|
||||
class PlatformConvertersConan(ConanFile):
|
||||
name = "platform.converters"
|
||||
license = "MIT"
|
||||
homepage = "https://github.com/linksplatform/Converters"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
description = "platform.converters is one of the libraries of the LinksPlatform modular framework, " \
|
||||
"to provide conversions between different types"
|
||||
topics = ("linksplatform", "cpp20", "converters", "any", "native")
|
||||
settings = "compiler", "arch"
|
||||
no_copy_source = True
|
||||
|
||||
@property
|
||||
def _source_subfolder(self):
|
||||
return "source_subfolder"
|
||||
|
||||
@property
|
||||
def _internal_cpp_subfolder(self):
|
||||
return os.path.join(self._source_subfolder, "cpp", "Platform.Converters")
|
||||
|
||||
@property
|
||||
def _compilers_minimum_version(self):
|
||||
return {
|
||||
"gcc": "10",
|
||||
"Visual Studio": "16",
|
||||
"clang": "14",
|
||||
"apple-clang": "14"
|
||||
}
|
||||
|
||||
@property
|
||||
def _minimum_cpp_standard(self):
|
||||
return 20
|
||||
|
||||
def validate(self):
|
||||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler))
|
||||
|
||||
if not minimum_version:
|
||||
self.output.warn("{} recipe lacks information about the {} compiler support.".format(
|
||||
self.name, self.settings.compiler))
|
||||
|
||||
elif tools.Version(self.settings.compiler.version) < minimum_version:
|
||||
raise ConanInvalidConfiguration("{}/{} requires c++{}, "
|
||||
"which is not supported by {} {}.".format(
|
||||
self.name, self.version, self._minimum_cpp_standard, self.settings.compiler,
|
||||
self.settings.compiler.version))
|
||||
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
tools.check_min_cppstd(self, self._minimum_cpp_standard)
|
||||
|
||||
def package_id(self):
|
||||
self.info.header_only()
|
||||
|
||||
def source(self):
|
||||
tools.get(**self.conan_data["sources"][self.version],
|
||||
destination=self._source_subfolder, strip_root=True)
|
||||
|
||||
def package(self):
|
||||
self.copy("*.h", dst="include", src=self._internal_cpp_subfolder)
|
||||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
|
11
recipes/platform.converters/all/test_package/CMakeLists.txt
Normal file
11
recipes/platform.converters/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(test_package CXX)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(platform.converters CONFIG REQUIRED)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} platform.converters::platform.converters)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
|
17
recipes/platform.converters/all/test_package/conanfile.py
Normal file
17
recipes/platform.converters/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from conans import ConanFile, CMake, tools
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not tools.cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
@@ -0,0 +1,12 @@
|
||||
#include <Platform.Converters.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace Platform::Converters;
|
||||
|
||||
int main() {
|
||||
int source {48};
|
||||
char to = Converter<int, char>::Convert(source);
|
||||
std::cout<<"int value: "<<source<<"\nchar value: "<<to<<'\n';
|
||||
return 0;
|
||||
}
|
3
recipes/platform.converters/config.yml
Normal file
3
recipes/platform.converters/config.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
versions:
|
||||
"0.1.0":
|
||||
folder: all
|
Reference in New Issue
Block a user