From a1a3b81cee8d921451f61bd1203b2a9b6bf44e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Thu, 4 Apr 2024 11:08:08 +0200 Subject: [PATCH] (#23114) mathter: add new version: 1.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update recipe to v1.1.0 with xsimd optional dependency * fix empty YAML blocks with explicit empty dict * yaml linter * add v1.1.0 to config.yml * move dependencies into python file * linter * print XSimd option * Improve xsimd option handling * update package options for compiler definitions --------- Co-authored-by: Rubén Rincón Blanco --- recipes/mathter/all/conandata.yml | 3 +++ recipes/mathter/all/conanfile.py | 16 ++++++++++++++++ .../mathter/all/test_package/test_package.cpp | 5 +++++ recipes/mathter/config.yml | 2 ++ 4 files changed, 26 insertions(+) diff --git a/recipes/mathter/all/conandata.yml b/recipes/mathter/all/conandata.yml index d93f0abf244639..10ce98e0118c4f 100644 --- a/recipes/mathter/all/conandata.yml +++ b/recipes/mathter/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/petiaccja/Mathter/archive/v1.1.0.tar.gz" + sha256: "a9a82126ecd80112854098a5646d38f72f0af03e9655b28ab8fa38b4c03b0870" "1.0.1": url: "https://github.com/petiaccja/Mathter/archive/v1.0.1.tar.gz" sha256: "ab90736abfa8774103b53fe2b8962981c5f117dc582b01698c18d66cd2398b8c" diff --git a/recipes/mathter/all/conanfile.py b/recipes/mathter/all/conanfile.py index b25becfd19c5b8..82cdb44fbd38a9 100644 --- a/recipes/mathter/all/conanfile.py +++ b/recipes/mathter/all/conanfile.py @@ -20,6 +20,12 @@ class MathterConan(ConanFile): package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + options = { + "with_xsimd": [True, False] # XSimd is optionally used for hand-rolled vectorization. + } + default_options = { + "with_xsimd": True + } no_copy_source = True @property @@ -34,6 +40,10 @@ def _compilers_minimum_version(self): "gcc": 7, "Visual Studio": 16, } + + def config_options(self): + if Version(self.version) < "1.1": + del self.options.with_xsimd def layout(self): basic_layout(self, src_folder="src") @@ -53,6 +63,10 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + def requirements(self): + if self.options.get_safe("with_xsimd"): + self.requires("xsimd/11.1.0") + def package(self): if self.version == "1.0.0": copy(self, "LICENCE", self.source_folder, os.path.join(self.package_folder, "licenses")) @@ -66,3 +80,5 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] + if self.options.get_safe("with_xsimd"): + self.cpp_info.defines = ["MATHTER_USE_XSIMD=1"] diff --git a/recipes/mathter/all/test_package/test_package.cpp b/recipes/mathter/all/test_package/test_package.cpp index f9de5516290387..c46788d9d6a1cc 100644 --- a/recipes/mathter/all/test_package/test_package.cpp +++ b/recipes/mathter/all/test_package/test_package.cpp @@ -7,5 +7,10 @@ int main() { Vec3 v2 = {2, 5, 3}; auto r = v1 + v2; std::cout << "Mathter installation works." << std::endl; +#ifdef MATHTER_USE_XSIMD + std::cout << "XSimd enabled." << std::endl; +#else + std::cout << "XSimd disabled." << std::endl; +#endif return 0; } diff --git a/recipes/mathter/config.yml b/recipes/mathter/config.yml index af3bb0714e65c0..d27c249ae17bf5 100644 --- a/recipes/mathter/config.yml +++ b/recipes/mathter/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.0": + folder: all "1.0.1": folder: all "1.0.0":