-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#18218) platform.delegates: add version 0.3.7, support conan v2
- Loading branch information
Showing
5 changed files
with
73 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
sources: | ||
"0.1.3": | ||
url: https://github.com/linksplatform/Delegates/archive/refs/tags/0.1.3.zip | ||
sha256: e30b2e3c8aff6ffaa366b1c66a7af79f6bc828822f428a4427a7a89e14412fec | ||
"0.3.7": | ||
url: "https://github.com/linksplatform/Delegates/archive/refs/tags/cpp_0.3.7.tar.gz" | ||
sha256: "4b9c72f6fa40a7d968db47f61da302d77d865c07fc70e177b08b4bfeaedfb1c2" | ||
"0.2.7": | ||
url: https://github.com/linksplatform/Delegates/archive/refs/tags/cpp_0.2.7.zip | ||
sha256: 440e628dba541497a4d4075b0fd97e42279c5ed73a4156fbcb06556f09109435 | ||
url: "https://github.com/linksplatform/Delegates/archive/refs/tags/cpp_0.2.7.tar.gz" | ||
sha256: "b5e9d5b1094d90795cbd6f9c1377b49eaa6965f88b1730c0775381a3f4b6cb7f" | ||
"0.1.3": | ||
url: "https://github.com/linksplatform/Delegates/archive/refs/tags/0.1.3.tar.gz" | ||
sha256: "0745eda77f900f9985dcfe7d66e5c2e5b15b0d762977c42433dc0345f8866e16" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,73 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.files import get, copy | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.scm import Version | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
|
||
required_conan_version = ">=1.33.0" | ||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class PlatformDelegatesConan(ConanFile): | ||
name = "platform.delegates" | ||
description = """platform.delegates is one of the libraries of the LinksPlatform modular framework, which uses | ||
innovations from the C++17 standard, for easier use delegates/events in csharp style.""" | ||
license = "MIT" | ||
homepage = "https://github.com/linksplatform/Delegates" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
description = """platform.delegates is one of the libraries of the LinksPlatform modular framework, which uses | ||
innovations from the C++17 standard, for easier use delegates/events in csharp style.""" | ||
homepage = "https://github.com/linksplatform/Delegates" | ||
topics = ("linksplatform", "cpp17", "delegates", "events", "header-only") | ||
settings = "compiler" | ||
package_type = "header-library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
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.Delegates") | ||
def _min_cppstd(self): | ||
return 17 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"gcc": "8", | ||
"Visual Studio": "16", | ||
"msvc": "192", | ||
"clang": "14", | ||
"apple-clang": "14" | ||
"apple-clang": "14", | ||
} | ||
|
||
@property | ||
def _minimum_cpp_standard(self): | ||
return 17 | ||
|
||
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)) | ||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
if tools.Version(self.settings.compiler.version) < minimum_version: | ||
raise ConanInvalidConfiguration("platform.delegates/{} " | ||
"requires C++{} with {}, " | ||
"which is not supported " | ||
"by {} {}.".format( | ||
self.version, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler, | ||
self.settings.compiler.version)) | ||
def package_id(self): | ||
self.info.clear() | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
tools.check_min_cppstd(self, self._minimum_cpp_standard) | ||
|
||
check_min_cppstd(self, self._min_cppstd) | ||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) | ||
if minimum_version and Version(self.settings.compiler.version) < minimum_version: | ||
raise ConanInvalidConfiguration( | ||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." | ||
) | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) | ||
get(self, **self.conan_data["sources"][self.version], 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) | ||
copy( | ||
self, | ||
"*.h", | ||
dst=os.path.join(self.package_folder, "include"), | ||
src=os.path.join(self.source_folder, "cpp", "Platform.Delegates") | ||
) | ||
copy( | ||
self, | ||
"LICENSE", | ||
dst=os.path.join(self.package_folder, "licenses"), | ||
src=self.source_folder | ||
) | ||
|
||
def package_id(self): | ||
self.info.header_only() | ||
def package_info(self): | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.libdirs = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package) | ||
project(test_package LANGUAGES CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
find_package(platform.delegates REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} CONAN_PKG::platform.delegates) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE platform.delegates::platform.delegates) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
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) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
versions: | ||
"0.1.3": | ||
"0.3.7": | ||
folder: all | ||
"0.2.7": | ||
folder: all | ||
"0.1.3": | ||
folder: all |