Repository: conan-io/conan-center-index

Issue:
[request] cotila/1.2.1
### Package Details
  * Package Name/Version: **cotila/1.2.1**
  * Website: **https://github.com/calebzulawski/cotila**
  * Source code: **https://github.com/calebzulawski/cotila**


### Description Of The Library / Tool
Cotila (compile-time linear algebra) is a header-only library that provides a set of linear algebra functions in C++ intended for use during compile time. All functions available in Cotila are constexpr, meaning they can be used at compile-time to generate constants and lookup tables in a type-safe, readable, and maintainable manner.


P.S. From [my libs list](https://github.com/conan-io/conan-center-index/issues/4#issuecomment-845223701)


Discussion:

Resolving patch:
diff --git a/recipes/cotila/all/conanfile.py b/recipes/cotila/all/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/cotila/all/conanfile.py
@@ -0,0 +1,66 @@
+from conans import ConanFile, tools
+from conans.errors import ConanInvalidConfiguration
+
+required_conan_version = ">=1.33.0"
+
+
+class CotilaConan(ConanFile):
+    name = "cotila"
+    description = "A compile time linear algebra system"
+    homepage = "https://github.com/calebzulawski/cotila"
+    topics = ("c++", "math", "linear algebra", "compile-time")
+    license = "Apache-2.0"
+    url = "https://github.com/conan-io/conan-center-index"
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "cmake"
+    no_copy_source = True
+
+    @property
+    def _source_subfolder(self):
+        return "source_subfolder"
+
+    @property
+    def _min_cppstd(self):
+        return "17"
+
+    @property
+    def _compilers_minimum_version(self):
+        return {
+            "gcc": "7",
+            "Visual Studio": "15.7",
+            "clang": "6.0",
+            "apple-clang": "10",
+        }
+
+    def validate(self):
+        if self.settings.compiler.get_safe("cppstd"):
+            tools.check_min_cppstd(self, "17")
+
+        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++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name, self.version))
+        elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version):
+            raise ConanInvalidConfiguration("{} {} requires C++17, 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="LICENSE", dst="licenses", src=self._source_subfolder)
+        self.copy(pattern="include/*", src=self._source_subfolder)
+
+    def package_info(self):
+        self.cpp_info.names["cmake_find_package"] = "cotila"
+        self.cpp_info.names["cmake_find_package_multi"] = "cotila"
+


Test patch:
diff --git a/recipes/cotila/all/test_package/CMakeLists.txt b/recipes/cotila/all/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/cotila/all/test_package/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.8)
+project(test_package LANGUAGES CXX)
+
+include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
+conan_basic_setup(TARGETS)
+
+find_package(cotila CONFIG REQUIRED)
+
+add_executable(test_package test_package.cpp)
+target_compile_features(test_package PRIVATE cxx_std_17)
+target_link_libraries(test_package cotila::cotila)
diff --git a/recipes/cotila/all/test_package/conanfile.py b/recipes/cotila/all/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/cotila/all/test_package/conanfile.py
@@ -0,0 +1,17 @@
+from conans import ConanFile, CMake, tools
+import os
+
+
+class CotilaTestConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "cmake", "cmake_find_package_multi"
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        if not tools.cross_building(self):
+            bin_path = os.path.join("bin", "test_package")
+            self.run(bin_path, run_environment=True)
diff --git a/recipes/cotila/all/test_package/test_package.cpp b/recipes/cotila/all/test_package/test_package.cpp
new file mode 100644
--- /dev/null
+++ b/recipes/cotila/all/test_package/test_package.cpp
@@ -0,0 +1,7 @@
+#include <cotila/cotila.h>
+
+int main() {
+	constexpr cotila::matrix<double, 2, 3> m1 {{{1., 2., 3.}, {4., 5., 6.}}}; // very explicit declaration
+	constexpr cotila::matrix m2 {{{1., 4.}, {2., 5.}, {3., 6.}}}; // deduces the type, but the extra braces are required
+	static_assert(m2 == cotila::transpose(m1));
+}