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

Bump timsort to 3.0.0 #22516

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions recipes/timsort/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"3.0.0":
url: "https://github.com/timsort/cpp-TimSort/archive/v3.0.0.tar.gz"
sha256: "d61b92850996305e5248d1621c8ac437c31b474f74907e223019739e2e556b1f"
"2.1.0":
url: "https://github.com/timsort/cpp-TimSort/archive/v2.1.0.tar.gz"
sha256: "b16606f85316d9a3cfde638c02dd9ce23324b0a904bb020e4ad2497cb8cf9ebd"
Expand Down
32 changes: 29 additions & 3 deletions recipes/timsort/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from conan.tools.files import copy, get
from conan.tools.layout import basic_layout
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.50.0"
Expand All @@ -11,14 +12,34 @@
class TimsortConan(ConanFile):
name = "timsort"
description = "A C++ implementation of timsort"
topics = ("sorting", "algorithms")
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/timsort/cpp-TimSort"
license = "MIT"
topics = ("sorting", "algorithms", "header-only")
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True

@property
def _min_cppstd(self):
if Version(self.version) < "2.0.0":
return "98"
if Version(self.version) < "3.0.0":
return "11"
return "20"

@property
def _compilers_minimum_version(self):
return {
"20": {
"gcc": "11",
"clang": "12",
"apple-clang": "14",
"Visual Studio": "16",
"msvc": "192",
}
}.get(self._min_cppstd, {})

def layout(self):
basic_layout(self, src_folder="src")

Expand All @@ -28,7 +49,12 @@ def package_id(self):
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
if Version(self.version) >= "2.0.0":
check_min_cppstd(self, 11)
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):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand Down
2 changes: 1 addition & 1 deletion recipes/timsort/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ find_package(gfx-timsort REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE gfx::timsort)
Morwenn marked this conversation as resolved.
Show resolved Hide resolved
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
2 changes: 2 additions & 0 deletions recipes/timsort/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.0.0":
folder: all
"2.1.0":
folder: all
"2.0.2":
Expand Down
Loading