Repository: conan-io/conan-center-index

Issue:
[request] jfalcou-eve/cci.20210823
### Package Details
  * Package Name/Version: **jfalcou-eve/cci.20210823**
  * Website: **https://github.com/jfalcou/eve**
  * Source code: **https://github.com/jfalcou/eve**


### Description Of The Library / Tool

EVE - the Expressive Vector Engine - is a reimplementation of the old EVE SIMD library by Falcou et al. which for a while was named Boost.SIMD. It's a C++20 and onward implementation of a type based wrapper around SIMD extensions sets for most current architectures. It aims at showing how C++20 can be used to design and implement efficient, low level, high abstraction library suited for high performances.


Discussion:

Resolving patch:
diff --git a/recipes/jfalcou-eve/all/conanfile.py b/recipes/jfalcou-eve/all/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/jfalcou-eve/all/conanfile.py
@@ -0,0 +1,66 @@
+from conans import ConanFile, CMake, tools
+from conans.errors import ConanInvalidConfiguration
+import os
+
+required_conan_version = ">=1.33.0"
+
+
+class JfalcouEveConan(ConanFile):
+    name = "jfalcou-eve"
+    description = ("Expressive Velocity Engine - reimplementation of the old "
+                   "Boost.SIMD on C++20"
+                   )
+    homepage = "https://github.com/jfalcou/eve"
+    topics = ("c++", "simd")
+    license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
+    settings = "os", "arch", "compiler", "build_type"
+
+    no_copy_source = True
+
+    @property
+    def _source_subfolder(self):
+        return "source_subfolder"
+
+    @property
+    def _min_cppstd(self):
+        return "20"
+
+    @property
+    def _compilers_minimum_version(self):
+        return {
+            "gcc": "10.2",
+            "Visual Studio": "16.9",
+            "clang": "10",
+        }
+
+    def validate(self):
+        if self.settings.compiler.get_safe("cppstd"):
+            tools.check_min_cppstd(self, self._min_cppstd)
+
+        def lazy_lt_semver(v1, v2):
+            lv1 = [int(v) for v in v1.split(".")]
+            lv2 = [int(v) for v in v2.split(".")]
+            min_length = min(len(lv1), len(lv2))
+            return lv1[:min_length] < lv2[:min_length]
+
+        minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
+        if not minimum_version:
+            self.output.warn("{} {} requires C++20. Your compiler is unknown. Assuming it supports C++20.".format(self.name, self.version))
+        elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version):
+            raise ConanInvalidConfiguration("{} {} requires C++20, which your compiler does not support.".format(self.name, self.version))
+
+    def package_id(self):
+        self.info.header_only()
+
+    def source(self):
+        tools.get(**self.conan_data["sources"][self.version], strip_root=True,
+                destination=self._source_subfolder)
+
+    def package(self):
+        self.copy(pattern="include/*", src=self._source_subfolder)
+        self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder)
+
+    def package_info(self):
+        self.cpp_info.names["cmake_find_package"] = "eve"
+        self.cpp_info.names["cmake_find_package_multi"] = "eve"


Test patch:
diff --git a/recipes/jfalcou-eve/all/test_package/CMakeLists.txt b/recipes/jfalcou-eve/all/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/jfalcou-eve/all/test_package/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.12)
+project(test_package)
+
+include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
+conan_basic_setup(TARGETS)
+
+find_package(eve REQUIRED)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} eve::eve)
+# FIXME: recipe should transitively sets proper minimum cxx standard.
+# See https://github.com/conan-io/conan/issues/7772 about revising cxx std model.
+set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
diff --git a/recipes/jfalcou-eve/all/test_package/conanfile.py b/recipes/jfalcou-eve/all/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/jfalcou-eve/all/test_package/conanfile.py
@@ -0,0 +1,16 @@
+from conans import ConanFile, CMake, tools
+import os
+
+
+class JfalcouEveConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "cmake", "cmake_find_package"
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        if not tools.cross_building(self):
+            self.run(os.path.join("bin", "test_package"), run_environment=True)
diff --git a/recipes/jfalcou-eve/all/test_package/test_package.cpp b/recipes/jfalcou-eve/all/test_package/test_package.cpp
new file mode 100644
--- /dev/null
+++ b/recipes/jfalcou-eve/all/test_package/test_package.cpp
@@ -0,0 +1,9 @@
+#include <eve/eve.hpp>
+#include <iostream>
+
+int main()
+{
+    eve::wide<float, eve::fixed<4>> p{1.f,2.f,3.f,4.f};
+    std::cout << "eve test: " << p + 10 * p << "\n";
+    return 0;
+}