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

Crow/0.1 #3123

Merged
merged 12 commits into from
Oct 21, 2020
8 changes: 8 additions & 0 deletions recipes/crow/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sources:
"0.1":
sha256: 140ca4a4d75ce5996cb103155580cb13b0b27082d1efbc331000a34af55b4390
url: https://github.com/ipkn/crow/archive/v0.1.tar.gz
patches:
"0.1":
- patch_file: "patches/001-fix-cmake-errors.patch"
base_path: "source_subfolder"
45 changes: 45 additions & 0 deletions recipes/crow/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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")
madduci marked this conversation as resolved.
Show resolved Hide resolved

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"]
25 changes: 25 additions & 0 deletions recipes/crow/all/patches/001-fix-cmake-errors.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40d53f8b420c70c002134996842c46f5a84e181b..5dc9bfdd063f81466c2072a6a308e998f4fe7d50 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,15 +48,15 @@ include_directories("${PROJECT_INCLUDE_DIR}")
include_directories("${PROJECT_SOURCE_DIR}")

#add_subdirectory(src)
-add_subdirectory(examples)
+#add_subdirectory(examples)

if (MSVC)
else()
- add_subdirectory(tests)
+ #add_subdirectory(tests)

- enable_testing()
- add_test(NAME crow_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest)
- add_test(NAME template_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/template/test.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests/template)
+ #enable_testing()
+ #add_test(NAME crow_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest)
+ #add_test(NAME template_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/template/test.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests/template)

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/amalgamate)

9 changes: 9 additions & 0 deletions recipes/crow/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 17 additions & 0 deletions recipes/crow/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 13 additions & 0 deletions recipes/crow/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "crow/crow_all.h"

int main()
{
crow::SimpleApp app;

CROW_ROUTE(app, "/")
([]() {
return "Hello world!";
});

app.port(18080);
}
3 changes: 3 additions & 0 deletions recipes/crow/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.1":
folder: all