Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taocpp-tuple: modernize #9173

Merged
merged 1 commit into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions recipes/taocpp-tuple/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
from conans import ConanFile, tools
import os

required_conan_version = ">=1.43.0"

required_conan_version = ">=1.28.0"

class TaoCPPTupleConan(ConanFile):
name = "taocpp-tuple"
Expand All @@ -11,32 +12,36 @@ class TaoCPPTupleConan(ConanFile):
description = "Compile-time-efficient proof-of-concept implementation for std::tuple"
topics = ("template", "cpp11", "tuple")
no_copy_source = True
settings = "compiler"
settings = "os", "arch", "compiler", "build_type"

@property
def _source_subfolder(self):
return "source_subfolder"

def configure(self):
if self.settings.compiler.cppstd:
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 11)

def package_id(self):
self.info.header_only()

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = "tuple-" + self.version
os.rename(extracted_dir, self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def package(self):
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "taocpp-tuple")
self.cpp_info.set_property("cmake_target_name", "taocpp::tuple")

# TODO: to remove in conan v2 once cmake_find_package* generators removed
self.cpp_info.filenames["cmake_find_package"] = "taocpp-tuple"
self.cpp_info.filenames["cmake_find_package_multi"] = "taocpp-tuple"
self.cpp_info.names["cmake_find_package"] = "taocpp"
self.cpp_info.names["cmake_find_package_multi"] = "taocpp"
self.cpp_info.components["_taocpp-tuple"].names["cmake_find_package"] = "tuple"
self.cpp_info.components["_taocpp-tuple"].names["cmake_find_package_multi"] = "tuple"
self.cpp_info.components["_taocpp-tuple"].set_property("cmake_target_name", "taocpp::tuple")
2 changes: 1 addition & 1 deletion recipes/taocpp-tuple/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(TARGETS)

find_package(taocpp-tuple REQUIRED CONFIG)

Expand Down
7 changes: 3 additions & 4 deletions recipes/taocpp-tuple/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os.path

from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
Expand All @@ -13,6 +12,6 @@ def build(self):
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)