Repository: conan-io/conan-center-index

Issue:
[request] crow/0.1
### Package Details
  * Package Name/Version: **crow/0.1**
  * Website: **https://github.com/ipkn/crow**
  * Source code: **https://github.com/ipkn/crow**


### Description Of The Library / Tool

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask) 

Related to #621



Discussion:

Resolving patch:
diff --git a/recipes/crow/all/conanfile.py b/recipes/crow/all/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/crow/all/conanfile.py
@@ -0,0 +1,45 @@
+from conans import ConanFile, tools, CMake
+import os
+
+class CrowConan(ConanFile):
+    name = "crow"
+    homepage = "https://github.com/ipkn/crow"
+    description = "Crow is C++ microframework for web. (inspired by Python Flask)"
+    topics = ("conan", "web", "microframework", "header-only")
+    url = "https://github.com/conan-io/conan-center-index"
+    settings = "os", "compiler", "arch", "build_type"
+    exports_sources = ["patches/*"]
+    license = "BSD-3-Clause"
+
+    @property
+    def _source_subfolder(self):
+        return "source_subfolder"
+
+    def requirements(self):
+        self.requires("boost/1.69.0")
+
+    def source(self):
+        tools.get(**self.conan_data["sources"][self.version])
+        extracted_dir = "crow-" + self.version
+        os.rename(extracted_dir, self._source_subfolder)
+
+    def build(self):
+        if tools.Version(self.deps_cpp_info["boost"].version) >= "1.70.0":
+            raise ConanInvalidConfiguration("Crow requires Boost <1.70.0")
+
+        for patch in self.conan_data.get("patches", {}).get(self.version, []):
+            tools.patch(**patch)
+        cmake = CMake(self)
+        cmake.configure(source_folder=self._source_subfolder)
+        cmake.build()
+
+    def package(self):
+        self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder)
+        self.copy("*.h", dst=os.path.join("include", "crow"), src="amalgamate")
+
+    def package_id(self):
+        self.info.header_only()
+
+    def package_info(self):
+        if self.settings.os == "Linux":
+            self.cpp_info.system_libs = ["pthread"]


Test patch:
diff --git a/recipes/crow/all/test_package/CMakeLists.txt b/recipes/crow/all/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/crow/all/test_package/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.1)
+project(test_package)
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup()
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
diff --git a/recipes/crow/all/test_package/conanfile.py b/recipes/crow/all/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/crow/all/test_package/conanfile.py
@@ -0,0 +1,17 @@
+from conans import ConanFile, CMake, tools
+import os
+
+
+class TestPackageConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "cmake"
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        if not tools.cross_building(self.settings):
+            bin_path = os.path.join("bin", "test_package")
+            self.run(bin_path, run_environment=True)
diff --git a/recipes/crow/all/test_package/test_package.cpp b/recipes/crow/all/test_package/test_package.cpp
new file mode 100644
--- /dev/null
+++ b/recipes/crow/all/test_package/test_package.cpp
@@ -0,0 +1,13 @@
+#include "crow/crow_all.h"
+
+int main()
+{
+    crow::SimpleApp app;
+
+    CROW_ROUTE(app, "/")
+    ([]() {
+        return "Hello world!";
+    });
+
+    app.port(18080);
+}